bugfix: ValueError: Unsloth: instruction_part and response_part must be given!
Browse files- train_with_unsloth.py +5 -3
train_with_unsloth.py
CHANGED
|
@@ -106,7 +106,11 @@ trainer = SFTTrainer(
|
|
| 106 |
train_dataset = new_dataset["train"],
|
| 107 |
eval_dataset = new_dataset["test"],
|
| 108 |
)
|
| 109 |
-
trainer = train_on_responses_only(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
trainer.train()
|
| 111 |
|
| 112 |
model.push_to_hub_merged(
|
|
@@ -116,8 +120,6 @@ model.push_to_hub_merged(
|
|
| 116 |
safe_serialization=None
|
| 117 |
)
|
| 118 |
|
| 119 |
-
|
| 120 |
-
|
| 121 |
# 1. load merged model + tokenizer from your HF repo
|
| 122 |
tokenizer = AutoTokenizer.from_pretrained(f'Luigi/{PROJECT_NAME}')
|
| 123 |
model = AutoModelForCausalLM.from_pretrained(f'Luigi/{PROJECT_NAME}')
|
|
|
|
| 106 |
train_dataset = new_dataset["train"],
|
| 107 |
eval_dataset = new_dataset["test"],
|
| 108 |
)
|
| 109 |
+
trainer = train_on_responses_only(
|
| 110 |
+
trainer,
|
| 111 |
+
instruction_part = "<|start_header_id|>user<|end_header_id|>\n\n",
|
| 112 |
+
response_part = "<|start_header_id|>assistant<|end_header_id|>\n\n",
|
| 113 |
+
)
|
| 114 |
trainer.train()
|
| 115 |
|
| 116 |
model.push_to_hub_merged(
|
|
|
|
| 120 |
safe_serialization=None
|
| 121 |
)
|
| 122 |
|
|
|
|
|
|
|
| 123 |
# 1. load merged model + tokenizer from your HF repo
|
| 124 |
tokenizer = AutoTokenizer.from_pretrained(f'Luigi/{PROJECT_NAME}')
|
| 125 |
model = AutoModelForCausalLM.from_pretrained(f'Luigi/{PROJECT_NAME}')
|