Skip to content

Commit 65f7073

Browse files
[Bugfix]Fix mdoel inference checkpoint saving when enabling HSDP (hao-ai-lab#660)
1 parent 109e2e7 commit 65f7073

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

fastvideo/training/training_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def gather_state_dict_on_cpu_rank0(
3333
cpu_state_dict = {}
3434
sharded_sd = model.state_dict()
3535
param_requires_grad = set([
36-
k for k, v in dict(model.named_parameters()).items() if v.requires_grad
36+
k.replace("._checkpoint_wrapped_module.", ".") for k, v in dict(model.named_parameters()).items() if v.requires_grad
3737
])
3838
for param_name, param in sharded_sd.items():
3939
if param_name not in param_requires_grad:
@@ -57,6 +57,7 @@ def gather_state_dict_on_cpu_rank0(
5757

5858
if rank == 0:
5959
cpu_state_dict[param_name] = param.cpu()
60+
6061
return cpu_state_dict
6162

6263

0 commit comments

Comments
 (0)