Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,7 @@ import os
|
|
10 |
from datasets import Dataset, DatasetDict, load_dataset
|
11 |
from peft import LoraConfig, PeftModel, prepare_model_for_kbit_training, get_peft_model
|
12 |
from transformers import (AutoTokenizer, BitsAndBytesConfig, TrainingArguments, AutoModelForSequenceClassification, Trainer, EarlyStoppingCallback, DataCollatorWithPadding)
|
|
|
13 |
|
14 |
def process(model_id, dataset):
|
15 |
# Step 1: Load dataset
|
@@ -47,7 +48,8 @@ def process(model_id, dataset):
|
|
47 |
|
48 |
#Step 5: Fine-tune the model
|
49 |
|
50 |
-
|
|
|
51 |
|
52 |
model_id = model_id
|
53 |
model = AutoModelForSequenceClassification.from_pretrained(model_id)
|
|
|
10 |
from datasets import Dataset, DatasetDict, load_dataset
|
11 |
from peft import LoraConfig, PeftModel, prepare_model_for_kbit_training, get_peft_model
|
12 |
from transformers import (AutoTokenizer, BitsAndBytesConfig, TrainingArguments, AutoModelForSequenceClassification, Trainer, EarlyStoppingCallback, DataCollatorWithPadding)
|
13 |
+
from huggingface_hub import HfApi
|
14 |
|
15 |
def process(model_id, dataset):
|
16 |
# Step 1: Load dataset
|
|
|
48 |
|
49 |
#Step 5: Fine-tune the model
|
50 |
|
51 |
+
api = HfApi()
|
52 |
+
api.login(token=os.environ["HF_TOKEN"])
|
53 |
|
54 |
model_id = model_id
|
55 |
model = AutoModelForSequenceClassification.from_pretrained(model_id)
|