mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
Include safetensors as part of _load_best_model
(#30553)
* Include safetensors * Cleanup
This commit is contained in:
parent
9df8b301ce
commit
a3aabc702e
@ -2611,7 +2611,9 @@ class Trainer:
|
||||
load_result = model.load_state_dict(state_dict, False)
|
||||
if not is_sagemaker_mp_enabled() and has_been_loaded:
|
||||
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(
|
||||
model, self.state.best_model_checkpoint, strict=is_sagemaker_mp_enabled()
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user