Skip to content

Commit 39c8249

Browse files
committed
removes missing safetensors.index if not attempting to save_in_hf
1 parent dcd17de commit 39c8249

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

torchtitan/protocols/state_dict_adapter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __init__(self, model_args: BaseModelArgs, hf_assets_path: str | None):
6767
except FileNotFoundError:
6868
logger.warning(
6969
f"model.safetensors.index.json not found at hf_assets_path: {mapping_path}. \
70-
Defaulting to saving a single safetensors file if checkpoint is saved in HF format."
70+
Defaulting to saving final checkpoint to a single safetensors file."
7171
)
7272
hf_safetensors_indx = None
7373

torchtitan/train.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,11 @@ def __init__(self, job_config: JobConfig):
309309
checkpoint_config=job_config.checkpoint,
310310
sd_adapter=(
311311
self.train_spec.state_dict_adapter(
312-
model_args, job_config.model.hf_assets_path
312+
model_args,
313+
job_config.model.hf_assets_path
314+
if job_config.checkpoint.enable_checkpoint
315+
and job_config.checkpoint.last_save_in_hf
316+
else None,
313317
)
314318
if self.train_spec.state_dict_adapter
315319
else None

0 commit comments

Comments
 (0)