Upload train.py with huggingface_hub
Browse files
train.py
CHANGED
|
@@ -76,12 +76,12 @@ def main():
|
|
| 76 |
train_dataset=dataset,
|
| 77 |
peft_config=peft_config,
|
| 78 |
formatting_func=formatting_prompts_func,
|
| 79 |
-
max_seq_length=2048,
|
| 80 |
tokenizer=tokenizer,
|
| 81 |
-
args=
|
| 82 |
output_dir=OUTPUT_DIR,
|
|
|
|
| 83 |
per_device_train_batch_size=2,
|
| 84 |
-
gradient_accumulation_steps=4,
|
| 85 |
learning_rate=2e-4,
|
| 86 |
logging_steps=10,
|
| 87 |
num_train_epochs=1,
|
|
@@ -89,9 +89,10 @@ def main():
|
|
| 89 |
fp16=True,
|
| 90 |
group_by_length=True,
|
| 91 |
save_strategy="epoch",
|
| 92 |
-
report_to="none",
|
| 93 |
push_to_hub=True,
|
| 94 |
-
hub_model_id=f"ceperaltab/{OUTPUT_DIR}",
|
|
|
|
| 95 |
),
|
| 96 |
)
|
| 97 |
|
|
|
|
| 76 |
train_dataset=dataset,
|
| 77 |
peft_config=peft_config,
|
| 78 |
formatting_func=formatting_prompts_func,
|
|
|
|
| 79 |
tokenizer=tokenizer,
|
| 80 |
+
args=SFTConfig(
|
| 81 |
output_dir=OUTPUT_DIR,
|
| 82 |
+
max_seq_length=2048, # Moved here
|
| 83 |
per_device_train_batch_size=2,
|
| 84 |
+
gradient_accumulation_steps=4,
|
| 85 |
learning_rate=2e-4,
|
| 86 |
logging_steps=10,
|
| 87 |
num_train_epochs=1,
|
|
|
|
| 89 |
fp16=True,
|
| 90 |
group_by_length=True,
|
| 91 |
save_strategy="epoch",
|
| 92 |
+
report_to="none",
|
| 93 |
push_to_hub=True,
|
| 94 |
+
hub_model_id=f"ceperaltab/{OUTPUT_DIR}",
|
| 95 |
+
dataset_text_field="text", # SFTConfig requires this or packing, though we use formatting_func
|
| 96 |
),
|
| 97 |
)
|
| 98 |
|