Update app.py
Browse files
app.py
CHANGED
@@ -102,28 +102,19 @@ def fine_tune_model(base_model_name, dataset_name):
|
|
102 |
|
103 |
# Create trainer
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
|
113 |
# Train model
|
114 |
|
115 |
-
|
116 |
-
|
117 |
-
# Save model and tokenizer to HF
|
118 |
|
119 |
-
#
|
120 |
-
|
121 |
-
#api = HfApi()
|
122 |
-
#api.create_repo(repo_id=FT_MODEL_NAME)
|
123 |
-
#api.upload_folder(
|
124 |
-
# folder_path="./output",
|
125 |
-
# repo_id="Meta-Llama-3.1-8B-Instruct-text-to-sql"
|
126 |
-
#)
|
127 |
|
128 |
tokenizer.push_to_hub("Meta-Llama-3.1-8B-Instruct-text-to-sql")
|
129 |
|
|
|
102 |
|
103 |
# Create trainer
|
104 |
|
105 |
+
trainer = Seq2SeqTrainer(
|
106 |
+
model=model,
|
107 |
+
args=training_args,
|
108 |
+
train_dataset=train_dataset,
|
109 |
+
eval_dataset=test_dataset,
|
110 |
+
#compute_metrics=lambda pred: {"accuracy": torch.sum(pred.label_ids == pred.predictions.argmax(-1))},
|
111 |
+
)
|
112 |
|
113 |
# Train model
|
114 |
|
115 |
+
trainer.train()
|
|
|
|
|
116 |
|
117 |
+
# Save tokenizer to HF
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
tokenizer.push_to_hub("Meta-Llama-3.1-8B-Instruct-text-to-sql")
|
120 |
|