Upload train.py with huggingface_hub
Browse files
train.py
CHANGED
|
@@ -116,20 +116,20 @@ def main():
|
|
| 116 |
gradient_checkpointing=True,
|
| 117 |
save_strategy="epoch",
|
| 118 |
report_to="none",
|
| 119 |
-
|
| 120 |
lr_scheduler_type="cosine",
|
|
|
|
| 121 |
# Push to Hugging Face Hub
|
| 122 |
push_to_hub=True,
|
| 123 |
hub_model_id=f"{HF_USERNAME}/{OUTPUT_DIR}",
|
| 124 |
)
|
| 125 |
|
| 126 |
-
# Initialize trainer
|
| 127 |
trainer = SFTTrainer(
|
| 128 |
model=model,
|
| 129 |
train_dataset=dataset,
|
| 130 |
peft_config=peft_config,
|
| 131 |
formatting_func=formatting_prompts_func,
|
| 132 |
-
max_seq_length=1024,
|
| 133 |
tokenizer=tokenizer,
|
| 134 |
args=training_args,
|
| 135 |
)
|
|
|
|
| 116 |
gradient_checkpointing=True,
|
| 117 |
save_strategy="epoch",
|
| 118 |
report_to="none",
|
| 119 |
+
warmup_steps=100,
|
| 120 |
lr_scheduler_type="cosine",
|
| 121 |
+
max_seq_length=1024,
|
| 122 |
# Push to Hugging Face Hub
|
| 123 |
push_to_hub=True,
|
| 124 |
hub_model_id=f"{HF_USERNAME}/{OUTPUT_DIR}",
|
| 125 |
)
|
| 126 |
|
| 127 |
+
# Initialize trainer (TRL 0.27+ API)
|
| 128 |
trainer = SFTTrainer(
|
| 129 |
model=model,
|
| 130 |
train_dataset=dataset,
|
| 131 |
peft_config=peft_config,
|
| 132 |
formatting_func=formatting_prompts_func,
|
|
|
|
| 133 |
tokenizer=tokenizer,
|
| 134 |
args=training_args,
|
| 135 |
)
|