Codex commited on
Commit ·
5680831
1
Parent(s): 6a2616f
chore: use dtype instead of deprecated torch_dtype and call volume.commit() in tune.py
Browse files
tune.py
CHANGED
|
@@ -403,7 +403,7 @@ def train_lora(hf_token: str | None = None, repo_id: str | None = None):
|
|
| 403 |
MODEL_ID,
|
| 404 |
quantization_config=bnb_config,
|
| 405 |
device_map="auto",
|
| 406 |
-
|
| 407 |
)
|
| 408 |
|
| 409 |
# Prepare quantized layers for PEFT adapter updates.
|
|
@@ -455,6 +455,10 @@ def train_lora(hf_token: str | None = None, repo_id: str | None = None):
|
|
| 455 |
model.save_pretrained("/checkpoints/inner-space-final")
|
| 456 |
tokenizer.save_pretrained("/checkpoints/inner-space-final")
|
| 457 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 458 |
# Prefer explicit token and repo values when provided.
|
| 459 |
if not hf_token:
|
| 460 |
hf_token = os.environ.get("HF_TOKEN")
|
|
|
|
| 403 |
MODEL_ID,
|
| 404 |
quantization_config=bnb_config,
|
| 405 |
device_map="auto",
|
| 406 |
+
dtype=torch.bfloat16,
|
| 407 |
)
|
| 408 |
|
| 409 |
# Prepare quantized layers for PEFT adapter updates.
|
|
|
|
| 455 |
model.save_pretrained("/checkpoints/inner-space-final")
|
| 456 |
tokenizer.save_pretrained("/checkpoints/inner-space-final")
|
| 457 |
|
| 458 |
+
# Commit the changes to the persistent volume in Modal
|
| 459 |
+
print("Committing checkpoint changes to Modal Volume...")
|
| 460 |
+
volume.commit()
|
| 461 |
+
|
| 462 |
# Prefer explicit token and repo values when provided.
|
| 463 |
if not hf_token:
|
| 464 |
hf_token = os.environ.get("HF_TOKEN")
|