Update app.py
Browse files
app.py
CHANGED
@@ -40,9 +40,8 @@ def fine_tune_model(base_model_id, dataset):
|
|
40 |
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
|
41 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
42 |
|
43 |
-
if tokenizer.pad_token
|
44 |
-
tokenizer.
|
45 |
-
model.resize_token_embeddings(len(tokenizer))
|
46 |
|
47 |
# Preprocess the dataset
|
48 |
def preprocess(examples):
|
@@ -58,7 +57,7 @@ def fine_tune_model(base_model_id, dataset):
|
|
58 |
# Set training arguments
|
59 |
training_args = Seq2SeqTrainingArguments(
|
60 |
output_dir="./results",
|
61 |
-
num_train_epochs=
|
62 |
per_device_train_batch_size=16,
|
63 |
per_device_eval_batch_size=64,
|
64 |
warmup_steps=500,
|
|
|
40 |
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
|
41 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
42 |
|
43 |
+
if not tokenizer.pad_token:
|
44 |
+
tokenizer.pad_token = tokenizer.eos_token
|
|
|
45 |
|
46 |
# Preprocess the dataset
|
47 |
def preprocess(examples):
|
|
|
57 |
# Set training arguments
|
58 |
training_args = Seq2SeqTrainingArguments(
|
59 |
output_dir="./results",
|
60 |
+
num_train_epochs=1, # Adjust as needed
|
61 |
per_device_train_batch_size=16,
|
62 |
per_device_eval_batch_size=64,
|
63 |
warmup_steps=500,
|