Unverified Commit f4d4f0a1 authored by Laura Hanu's avatar Laura Hanu Committed by GitHub
Browse files

only load state dict when the checkpoint is not None (#16673)

parent d57da992
......@@ -1792,7 +1792,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
# load pt weights early so that we know which dtype to init the model under
if from_pt:
if not is_sharded:
if not is_sharded and state_dict is None:
# Time to load the checkpoint
state_dict = load_state_dict(resolved_archive_file)
# set dtype to instantiate the model under:
......
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