Spaces:
Paused
Paused
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ref: https://huggingface.co/blog/AmelieSchreiber/esmbind
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
# os.environ["CUDA_VISIBLE_DEVICES"] = "0"
|
| 5 |
+
import wandb
|
| 6 |
+
import numpy as np
|
| 7 |
+
import torch
|
| 8 |
+
import torch.nn as nn
|
| 9 |
+
import pickle
|
| 10 |
+
import xml.etree.ElementTree as ET
|
| 11 |
+
from datetime import datetime
|
| 12 |
+
from sklearn.model_selection import train_test_split
|
| 13 |
+
from sklearn.utils.class_weight import compute_class_weight
|
| 14 |
+
from sklearn.metrics import (
|
| 15 |
+
accuracy_score,
|
| 16 |
+
precision_recall_fscore_support,
|
| 17 |
+
roc_auc_score,
|
| 18 |
+
matthews_corrcoef
|
| 19 |
+
)
|
| 20 |
+
from transformers import (
|
| 21 |
+
AutoModelForTokenClassification,
|
| 22 |
+
AutoTokenizer,
|
| 23 |
+
DataCollatorForTokenClassification,
|
| 24 |
+
TrainingArguments,
|
| 25 |
+
Trainer
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
from datasets import Dataset
|
| 29 |
+
from accelerate import Accelerator
|
| 30 |
+
# Imports specific to the custom peft lora model
|
| 31 |
+
from peft import get_peft_config, PeftModel, PeftConfig, get_peft_model, LoraConfig, TaskType
|