Unverified Commit 588d8f1f authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Fix when Accelerate is not installed (#17518)

parent f128ccb9
...@@ -2394,7 +2394,8 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix ...@@ -2394,7 +2394,8 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
del state_dict del state_dict
gc.collect() gc.collect()
save_offload_index(offload_index, offload_folder) if offload_index is not None and len(offload_index) > 0:
save_offload_index(offload_index, offload_folder)
if offload_state_dict: if offload_state_dict:
# Load back temporarily offloaded state dict # Load back temporarily offloaded state dict
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment