-
Notifications
You must be signed in to change notification settings - Fork 825
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
lora weights are not saved correctly #41
Comments
check your peft version and try: |
its peft version is 0.3.0.dev.0. it doesn't work. peft version must be peft==0.4.0.dev0, but the above-mentioned problems have arisen. |
Yes @taishan1994 is correct, we can't use older version of peft since it doesn't have the qlora changes. |
@taishan1994 can you try the changes in the PR and see if it works for you |
@KKcorps that works for me |
The model is saved as 112M, and loading the model for inference reports the following error: ValueError: Cannot merge LORA layers when the model is loaded in 8-bit mode, like #16 |
for merge just comment out the merge_and_unload line it is not mandatory to merge to do inference the combined peft model object can be used as i |
it can be solved, but new problem comes: #12 and just do: # model = model.cuda().eval() <- DO NOT ADD THIS |
To summarize all the issues:
# if args.bits < 16:
# old_state_dict = model.state_dict
# model.state_dict = (
# lambda self, *_, **__: get_peft_model_state_dict(self, old_state_dict())
# ).__get__(model, type(model))
model = AutoModel.from_pretrained(args["model_dir"],
trust_remote_code=True,
load_in_4bit=True,
device_map={"":0})
model = PeftModel.from_pretrained(model, args["save_dir"], trust_remote_code=True)
model.cuda().eval() <- DO NOT ADD THIS |
Based on the information you provided, it seems that the size of the saved
pip install -U git+https://github.com/huggingface/peft.git Updating to version 0.4.0.dev0 of
# if args.bits < 16:
# old_state_dict = model.state_dict
# model.state_dict = (
# lambda self, *_, **__: get_peft_model_state_dict(self, old_state_dict())
# ).__get__(model, type(model)) By commenting out this code block, you can prevent potential conflicts and ensure that the LORA weights are saved correctly. |
The saved adapter_model.bin is only 441kb.
#38
The text was updated successfully, but these errors were encountered: