Kevin Fink
commited on
Commit
·
744bfc7
1
Parent(s):
94aee2e
dev
Browse files
app.py
CHANGED
@@ -52,24 +52,22 @@ def fine_tune_model(model, dataset_name, hub_id, api_key, num_epochs, batch_size
|
|
52 |
|
53 |
|
54 |
# Load the model and tokenizer
|
55 |
-
|
56 |
-
|
57 |
-
print(f"BATCH: {batch_size}")
|
58 |
# Set training arguments
|
59 |
training_args = TrainingArguments(
|
60 |
output_dir='/data/results',
|
61 |
eval_strategy="steps", # Change this to steps
|
62 |
save_strategy='steps',
|
63 |
-
learning_rate=lr*0.
|
64 |
per_device_train_batch_size=int(batch_size),
|
65 |
per_device_eval_batch_size=int(batch_size),
|
66 |
num_train_epochs=int(num_epochs),
|
67 |
weight_decay=0.01,
|
68 |
-
gradient_accumulation_steps=int(grad),
|
69 |
#max_grad_norm = 3.0,
|
70 |
load_best_model_at_end=True,
|
71 |
-
|
72 |
-
|
73 |
logging_dir='/data/logs',
|
74 |
logging_steps=10,
|
75 |
#push_to_hub=True,
|
@@ -230,7 +228,7 @@ def run_train(dataset_name, hub_id, api_key, num_epochs, batch_size, lr, grad):
|
|
230 |
lora_dropout=0.1, # Dropout for LoRA layers
|
231 |
bias="none" # Bias handling
|
232 |
)
|
233 |
-
|
234 |
result = fine_tune_model(model, dataset_name, hub_id, api_key, num_epochs, batch_size, lr, grad)
|
235 |
return result
|
236 |
# Create Gradio interface
|
|
|
52 |
|
53 |
|
54 |
# Load the model and tokenizer
|
55 |
+
|
|
|
|
|
56 |
# Set training arguments
|
57 |
training_args = TrainingArguments(
|
58 |
output_dir='/data/results',
|
59 |
eval_strategy="steps", # Change this to steps
|
60 |
save_strategy='steps',
|
61 |
+
learning_rate=lr*0.00001,
|
62 |
per_device_train_batch_size=int(batch_size),
|
63 |
per_device_eval_batch_size=int(batch_size),
|
64 |
num_train_epochs=int(num_epochs),
|
65 |
weight_decay=0.01,
|
66 |
+
#gradient_accumulation_steps=int(grad),
|
67 |
#max_grad_norm = 3.0,
|
68 |
load_best_model_at_end=True,
|
69 |
+
metric_for_best_model="accuracy",
|
70 |
+
greater_is_better=True,
|
71 |
logging_dir='/data/logs',
|
72 |
logging_steps=10,
|
73 |
#push_to_hub=True,
|
|
|
228 |
lora_dropout=0.1, # Dropout for LoRA layers
|
229 |
bias="none" # Bias handling
|
230 |
)
|
231 |
+
model = get_peft_model(model, lora_config)
|
232 |
result = fine_tune_model(model, dataset_name, hub_id, api_key, num_epochs, batch_size, lr, grad)
|
233 |
return result
|
234 |
# Create Gradio interface
|