[Cherry-Pick] [BugFix] Avoid loading training file (#4966) (#4979)

* [BugFix] Avoid loading training file (#4966)

* bug fix

don't put scheduler.pdparams into model weights

* run pre-commit

* bug fix
This commit is contained in:
BossPi
2025-11-13 10:47:58 +08:00
committed by GitHub
parent 38f6e6c7c6
commit 9590072a91
@@ -380,9 +380,9 @@ def get_all_weights_file(model_path: str):
"""
model_path = Path(model_path)
use_safetensors = True
if any(model_path.glob("*.pdparams")):
files_list = [str(file) for file in model_path.glob("*.pdparams") if file.name != "scheduler.pdparams"]
if len(files_list) > 0:
key_name_list = []
files_list = [str(file) for file in model_path.glob("*.pdparams")]
use_safetensors = False
else:
safe_model_path = model_path / "model.safetensors"