Fix: add hub_token for push_to_hub
Browse files
train.py
CHANGED
|
@@ -192,6 +192,10 @@ class D1337CipherTrainer:
|
|
| 192 |
|
| 193 |
# Training arguments (standard TrainingArguments)
|
| 194 |
self.training_status = "Setting up training..."
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
training_args = TrainingArguments(
|
| 196 |
output_dir="./d1337-cipher-output",
|
| 197 |
num_train_epochs=self.config.num_epochs,
|
|
@@ -211,9 +215,10 @@ class D1337CipherTrainer:
|
|
| 211 |
group_by_length=True,
|
| 212 |
dataloader_num_workers=4,
|
| 213 |
remove_unused_columns=False,
|
| 214 |
-
push_to_hub=True,
|
| 215 |
hub_model_id=self.config.output_model,
|
| 216 |
hub_private_repo=True,
|
|
|
|
| 217 |
report_to="none",
|
| 218 |
)
|
| 219 |
|
|
|
|
| 192 |
|
| 193 |
# Training arguments (standard TrainingArguments)
|
| 194 |
self.training_status = "Setting up training..."
|
| 195 |
+
|
| 196 |
+
# Get HF token from environment
|
| 197 |
+
hf_token = os.environ.get("HF_TOKEN", None)
|
| 198 |
+
|
| 199 |
training_args = TrainingArguments(
|
| 200 |
output_dir="./d1337-cipher-output",
|
| 201 |
num_train_epochs=self.config.num_epochs,
|
|
|
|
| 215 |
group_by_length=True,
|
| 216 |
dataloader_num_workers=4,
|
| 217 |
remove_unused_columns=False,
|
| 218 |
+
push_to_hub=True if hf_token else False,
|
| 219 |
hub_model_id=self.config.output_model,
|
| 220 |
hub_private_repo=True,
|
| 221 |
+
hub_token=hf_token,
|
| 222 |
report_to="none",
|
| 223 |
)
|
| 224 |
|