[BugFix] Avoid loading training file (#4966)

* bug fix

don't put scheduler.pdparams into model weights

* run pre-commit
This commit is contained in:
BossPi
2025-11-12 15:49:14 +08:00
committed by GitHub
parent c7b589d75b
commit bde6e2f931
@@ -398,9 +398,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 = [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"