Upload app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ import os
|
|
12 |
from huggingface_hub import login
|
13 |
from peft import get_peft_model, LoraConfig
|
14 |
|
15 |
-
|
16 |
|
17 |
@spaces.GPU(duration=120)
|
18 |
def fine_tune_model(model_name, dataset_name, hub_id, api_key, num_epochs, batch_size, lr, grad):
|
@@ -36,8 +36,8 @@ def fine_tune_model(model_name, dataset_name, hub_id, api_key, num_epochs, batch
|
|
36 |
|
37 |
# Load the model and tokenizer
|
38 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_name.strip(), num_labels=2, force_download=True)
|
39 |
-
model
|
40 |
-
|
41 |
|
42 |
|
43 |
# Set training arguments
|
|
|
12 |
from huggingface_hub import login
|
13 |
from peft import get_peft_model, LoraConfig
|
14 |
|
15 |
+
os.environ['HF_HOME'] = '/data/.huggingface'
|
16 |
|
17 |
@spaces.GPU(duration=120)
|
18 |
def fine_tune_model(model_name, dataset_name, hub_id, api_key, num_epochs, batch_size, lr, grad):
|
|
|
36 |
|
37 |
# Load the model and tokenizer
|
38 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_name.strip(), num_labels=2, force_download=True)
|
39 |
+
model = get_peft_model(model, lora_config)
|
40 |
+
model.gradient_checkpointing_enable()
|
41 |
|
42 |
|
43 |
# Set training arguments
|