Update app.py
Browse files
app.py
CHANGED
@@ -79,7 +79,8 @@ def fine_tune_model(base_model_name, dataset_name):
|
|
79 |
training_args = Seq2SeqTrainingArguments(
|
80 |
output_dir="./output",
|
81 |
logging_dir="./logging",
|
82 |
-
num_train_epochs=1
|
|
|
83 |
#per_device_train_batch_size=16,
|
84 |
#per_device_eval_batch_size=64,
|
85 |
#eval_strategy="steps",
|
@@ -109,8 +110,8 @@ def fine_tune_model(base_model_name, dataset_name):
|
|
109 |
)
|
110 |
|
111 |
# Train and save model
|
112 |
-
|
113 |
-
|
114 |
|
115 |
def prompt_model(model_name, system_prompt, user_prompt, sql_schema):
|
116 |
pipe = pipeline("text-generation",
|
@@ -136,7 +137,7 @@ def prompt_model(model_name, system_prompt, user_prompt, sql_schema):
|
|
136 |
|
137 |
def load_model(model_name):
|
138 |
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
|
139 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
140 |
#tokenizer.pad_token = tokenizer.eos_token
|
141 |
|
142 |
return model, tokenizer
|
|
|
79 |
training_args = Seq2SeqTrainingArguments(
|
80 |
output_dir="./output",
|
81 |
logging_dir="./logging",
|
82 |
+
num_train_epochs=1
|
83 |
+
max_steps=2, ###
|
84 |
#per_device_train_batch_size=16,
|
85 |
#per_device_eval_batch_size=64,
|
86 |
#eval_strategy="steps",
|
|
|
110 |
)
|
111 |
|
112 |
# Train and save model
|
113 |
+
trainer.train()
|
114 |
+
trainer.save_model()
|
115 |
|
116 |
def prompt_model(model_name, system_prompt, user_prompt, sql_schema):
|
117 |
pipe = pipeline("text-generation",
|
|
|
137 |
|
138 |
def load_model(model_name):
|
139 |
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
|
140 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
141 |
#tokenizer.pad_token = tokenizer.eos_token
|
142 |
|
143 |
return model, tokenizer
|