Skip to content

Commit

Permalink
Fixing issue#2134 Axolotl Crashes At The End Of Training If Base Mode…
Browse files Browse the repository at this point in the history
…l Is Local (#2140)
  • Loading branch information
bursteratom authored Dec 8, 2024
1 parent 3938537 commit 343a4d8
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/axolotl/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,7 @@ def terminate_handler(_, __, model_weakref):
model.save_pretrained(cfg.output_dir, safe_serialization=safe_serialization)

if not cfg.hub_model_id:
from huggingface_hub import HfApi
from huggingface_hub.utils import RepositoryNotFoundError

try:
# Check to make sure the base model is from HuggingFace not a local directory
hf_api = HfApi()
hf_api.model_info(cfg.base_model)

model_card_kwarg = {
"model_name": cfg.output_dir.lstrip("./")
.encode("utf-8")
Expand All @@ -283,7 +276,7 @@ def terminate_handler(_, __, model_weakref):
]

trainer.create_model_card(**model_card_kwarg)
except (AttributeError, UnicodeDecodeError, RepositoryNotFoundError):
except (AttributeError, UnicodeDecodeError):
pass
elif cfg.hub_model_id:
# defensively push to the hub to ensure the model card is updated
Expand Down

0 comments on commit 343a4d8

Please sign in to comment.