darrenphodgson76 commited on
Commit
2051c3e
·
verified ·
1 Parent(s): 6daeff5

Update train.py

Browse files
Files changed (1) hide show
  1. train.py +7 -1
train.py CHANGED
@@ -5,6 +5,8 @@ from datasets import Dataset
5
  from transformers import TrainingArguments
6
  from unsloth import FastLanguageModel
7
  from trl import SFTTrainer # ✅ now works because we added 'trl'
 
 
8
 
9
 
10
  # Load and format your dataset
@@ -57,4 +59,8 @@ trainer = SFTTrainer(
57
  trainer.train()
58
 
59
  # Save the fine-tuned LoRA adapter
60
- model.save_pretrained("./lora-finetuned")
 
 
 
 
 
5
  from transformers import TrainingArguments
6
  from unsloth import FastLanguageModel
7
  from trl import SFTTrainer # ✅ now works because we added 'trl'
8
+ from shutil import copytree
9
+ import os
10
 
11
 
12
  # Load and format your dataset
 
59
  trainer.train()
60
 
61
  # Save the fine-tuned LoRA adapter
62
+ model.save_pretrained("./lora-finetuned")
63
+
64
+ # Copy LoRA output directory to current visible path
65
+ if os.path.exists("output") and os.path.isdir("output"):
66
+ copytree("output", "/home/user/app/final_model", dirs_exist_ok=True)