Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug fix] ensure base_model is correctly set in model card #2124

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

valayDave
Copy link

TLDR:

When we train LoRA's on top of a model loaded from disk, SFTTrainer.push_to_hub fails because of the model card created by Trainer.create_model_card. The Trainer.create_model_card calls the peft library's create_or_update_model_card which overrides the base_model to the path of the model on disk even if the model card created by Trainer.create_model_card might have contained the value of the base_model.

Long Form Context :

The model card's parsing is an essential when pushing the model to hub. If the model card doesn't contain information that HF finds valid, then HF hub raises a ValueError. One of the fields in the model_card injected by the peft library is the base_model field. This field is set earlier using the model_config["_name_or_path"]. A problem occurs when the model_config["_name_or_path"] is not a model name on HuggingfaceHub but rather just a path on local file system. At this point the hf_hub's folder_upload method crashes. Now if the card already contained a base_modelset then uploading the model from disk is still possible. One way to set the base_model's value is to pass the SFTTrainer.push_to_hub/Trainer.push_to_hub kwargs which are passed down to the create_model_card function. These kwargs can contain a field called finetuned_from which allow the model card creation properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant