Closed pranavbhat12 closed 9 months ago
Tried to downgrade Peft version to 0.5.0 and transformers to 4.32.0.
I assume that those are the versions you used when training the PEFT adapter? Did this resolve the issue or was the error still the same after the downgrade? If it was still the same error, could you please also try downgrading the bitsandbytes version to the one you used for training?
Other than that, what would be helpful is if you could jump into a debugger and print the keys of the state_dict
at the time that the error occurs.
Yep this are the versions used when training the PEFT adapter.Okay I am checking by downgrading the bitsandbytes version also.
I have the exact same problem today, but using Mistral. I tried with an adapter trained with PEFT 0.5 and another trained with 0.6.
KeyError: 'base_model.model.model.layers.0.self_attn.q_proj.weight
Downgrading bitsandbytes to 0.41.1 solves the issue.
Yep.Downgrading the bitsandbytes version worked for me.But just a concern that till yesterday it was working fine and bitsandbytes latest release was in July 23 how come this failed all of a sudden.
Thankyou @benjamin-marie @BenjaminBossan for the help.
Thanks both of you for investigating further.
But just a concern that till yesterday it was working fine and bitsandbytes latest release was in July 23 how come this failed all of a sudden.
We had the v0.6.0 PEFT release on Nov. 3rd, so theoretically it could be a change in PEFT that makes it not work with newer bnb versions. But if downgrading PEFT to v0.5.0 did not help, that seems unlikely. There was, however, a new bnb release (v0.41.2) just a few hours ago, so it's the most likely candidate.
A quick check in the bnb code base shows that there were indeed some changes to the loading behavior quite recently, e.g.:
https://github.com/TimDettmers/bitsandbytes/commit/76b40a5c9ae708db98e8b4a13249b2806601a387
This does not necessarily mean that bnb is "at fault", it could still be that the case that we're using it wrong in PEFT.
It's probably worth it to monitor the bnb issues in the upcoming days and see if users report errors loading models independent of PEFT. Other than that, someone could do a git bisect to identify the commit that caused the issue and try to understand exactly why that is. That's going to be quite some work though.
Yes for now the solution is to use bitsandbytes==0.41.1
cc @TimDettmers @poedator @Titus-von-Koeller I think the solution on bnb side is to simply ignore the state_dict in case it does not contain keys that matches the keys of the module since in PEFT we only save adapter weights
the problem comes from overriding _load_from_state_dict()
in https://github.com/TimDettmers/bitsandbytes/pull/753/commits/76b40a5c9ae708db98e8b4a13249b2806601a387
Sorry about that.
I am now testing the fix reverting the problem part, will make a PR soon. today.
It seems like Tim already fixed bitsandbytes a few hours ago. It should work now.
It seems like Tim already fixed bitsandbytes a few hours ago. It should work now.
He fixed another problem then. For this one I just created https://github.com/TimDettmers/bitsandbytes/pull/864
https://pypi.org/project/bitsandbytes/#history
Hi, he released some fix 3 hours ago. But that might have been the Python 3.8 type fix by @younesbelkada
I'm not at the computer right now and can't test if that's already a fix of some sort. Doesn't seem like it though.
I wrote to Tim to take a look before the end of his day, it's still morning in Seattle, so if @poedator has the fix ready soon, I'm pretty sure Tim can still release it today.
Would be good to add some automation to avoid such issues in the future, e.g. checking lowest supported Python version compliance and running HF bnb tests as part of the bnb release process.
@Titus-von-Koeller - that was an urgent PR by Younes to fix another problem related to Python version. - apparently, Python 3.8 needs from typing import Dict
and can not digest something like lowercase dict
. Yet another reason to use 3.8 for testing.
@pranavbhat12 @benjamin-marie Can you confirm that the latest bnb version solves your initial problem?
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
I am trying the load the finetuned adapter on the llama-2-7b model.But getting the following error.This was working fine till yesterday.Tried to downgrade Peft version to 0.5.0 and transformers to 4.32.0.
Code:
finetune_model=PeftModel.from_pretrained(model,"llama-finetuned/llama-7b-hf-4bit-3epochs/",device_map="auto")
Error:Any help would be appreciated.Thankyou.