don't use load and push together (#1284)

This commit is contained in:
Wing Lian
2024-02-09 14:54:31 -05:00
committed by GitHub
parent b2a4cb4396
commit ea00dd0852
2 changed files with 4 additions and 2 deletions

View File

@@ -208,7 +208,10 @@ def train(
model.save_pretrained(cfg.output_dir, safe_serialization=safe_serialization)
if not cfg.hub_model_id:
trainer.create_model_card(model_name=cfg.output_dir.lstrip("./"))
try:
trainer.create_model_card(model_name=cfg.output_dir.lstrip("./"))
except AttributeError:
pass
elif cfg.hub_model_id:
# defensively push to the hub to ensure the model card is updated
trainer.push_to_hub()