Unverified Commit a3aabc70 authored by Zach Mueller's avatar Zach Mueller Committed by GitHub
Browse files

Include safetensors as part of `_load_best_model` (#30553)

* Include safetensors

* Cleanup
parent 9df8b301
...@@ -2611,7 +2611,9 @@ class Trainer: ...@@ -2611,7 +2611,9 @@ class Trainer:
load_result = model.load_state_dict(state_dict, False) load_result = model.load_state_dict(state_dict, False)
if not is_sagemaker_mp_enabled() and has_been_loaded: if not is_sagemaker_mp_enabled() and has_been_loaded:
self._issue_warnings_after_load(load_result) self._issue_warnings_after_load(load_result)
elif os.path.exists(os.path.join(self.state.best_model_checkpoint, WEIGHTS_INDEX_NAME)): elif os.path.exists(os.path.join(self.state.best_model_checkpoint, SAFE_WEIGHTS_INDEX_NAME)) or os.path.exists(
os.path.join(self.state.best_model_checkpoint, WEIGHTS_INDEX_NAME)
):
load_result = load_sharded_checkpoint( load_result = load_sharded_checkpoint(
model, self.state.best_model_checkpoint, strict=is_sagemaker_mp_enabled() model, self.state.best_model_checkpoint, strict=is_sagemaker_mp_enabled()
) )
......
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