Trainer.push_to_hub()
with PEFT doesn't work when the base model is loaded from local disk
#33922
Labels
Trainer.push_to_hub()
with PEFT doesn't work when the base model is loaded from local disk
#33922
System Info
transformers
version: 4.44.2Who can help?
@muellerzr @SunMarc
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
I have a
hub_model_id
present in theTrainingArgs
when I run my scripts. If I setpush_to_hub=True
in TrainingArgs, it ends up throwing a ValueError likeWhile reading the code I also noticed that if we passed a
finetuned_from
argument to thepush_to_hub
function, the trainer passes them down to thecreate_model_card
function, but that function ends up letting Peft change the generated card with a new one. The problem here is that PeftModel's create_or_update_model_card is not accounting for the value ofbase_model
set in the card and because of that the card is invalid and Huggingface doesn't allow pushing the model to the hub.I have a fix in the PeFT library to fix this : huggingface/peft#2124
Expected behavior
Overall the expected behavior for me when the model being loaded from disk and pushed to hub is :
If a model is loaded from local disk and then trained with Peft (or any other HF extensions/trainer), push to hub should work. For accommodating this the library should :
base_model
.base_model
in the TrainingArguments so thatpush_to_hub=True
can work with the trainer. Currentlypush_to_hub=True
wont work in the PEFT scenarios because the README.md created by the PeftModel's create_or_update_model_card Overrides the value with something which can be a name or a path. And if it is a path (like this issue), it will just crash!finetuned_from
can be passed down explicitly to extensions of the library like PEFT or does something like [bug fix] ensurebase_model
is correctly set in model card peft#2124 (don't write abase_model
value in the card if there is abase_model
set in it)The text was updated successfully, but these errors were encountered: