-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add Support for IA3 Adapters in add_weighted_adapter Method, Currently facing issue that 'IA3Model' object has no attribute 'add_weighted_adapter' #1688
Comments
I am using your branch alexrs:multi-ia3 to test the addd_weighted_adapter for ia3 FIRST_ADAPTER_PATH = "/content/drive/MyDrive/FedMl_test_llm/TrainedModels/WestLake_SFT_IA3_1/Weights/Epoch_1/Job_1" FIRST_ADAPTER_NAME = "first" model = PeftModel.from_pretrained(quantized_model_4bit, FIRST_ADAPTER_PATH, FIRST_ADAPTER_NAME) adapters_li = [FIRST_ADAPTER_NAME,SECOND_ADAPTER_NAME] new_adapter= "ADAPTER_WEIGHTED" if new_adapter in model.peft_config: model.add_weighted_adapter(adapters=adapters_li, weights=weights_li, adapter_name=new_adapter) After this it shows me the error that : I meanulay test this using code I manually test this: print(module_types ) shows [list, list] Please @alexrs and @BenjaminBossan solve my problem I urgently need to merge few ia3 adapters , how can I add them |
Thanks for the ping @BenjaminBossan Hi @Abdullah-kwl, the code I wrote for #980 is very outdated. The HF folks have been shipping lots of code lately! 👏 I guess this is a good moment to start the conversation again (sorry for the very long delay!). We want to implement
I'd suggest that we can start with a simple implementation of Thoughts @BenjaminBossan @pacman100 ? I can try to prototype something in the next few days if you think this is a good approach! |
It is good to start with a simpler linear approach. |
That would be fantastic. Let's start with something simple and not try to have a "feature complete" copy of
Thanks, that would be great. Maybe once you have the first testable version, @Abdullah-kwl can test it out and give feedback on whether it works well or not. |
I found some time to prototype an implementation. You can find it in #1701 It is still work in progress, I did not do any manual testing to check that the result is correct. You can give it a try and report any issues! Assuming you have two peft_model.add_weighted_adapter(ia3_adapters, [0.1, 0.9], "weighted_adapter") to combine them using a weighted average of the adapters. |
i am also facing some issue relate ia3 that, Cannot merge ia3 layers when the model is loaded in 4-bit mention in this #1704 @BenjaminBossan please also look at this if we can also add this feature (merge_and_unload for ia3 adapters) for both 4bit and 8bit quantized models . |
Thanks for giving this a spin. If you have any numbers to share, like scores before and after merging, or even code, that would be great.
Indeed, this is not yet supported. We will certainly take a look at this at some point, but contributions are also very welcome. (And please don't post the same issue twice) |
Feature request
I propose adding support for IA3 adapters in the add_weighted_adapter method used within the PEFT module of the transformers library. IA3 adapters enhance model adaptability with minimal parameter increase, offering significant benefits for efficient and effective model fine-tuning across various tasks. This feature would allow users to integrate IA3 adapters seamlessly, thereby expanding the functional capabilities of the library.
Motivation
The motivation behind this proposal is to address the current limitation in the PEFT module of the transformers library, where IA3 adapters are supported but the merging of IA3 adapters using the add_weighted_adapter method is not implemented. This gap leads to errors such as 'IA3Model' object has no attribute 'add_weighted_adapter' when attempting to merge IA3 adapters.
The ability to merge IA3 adapters is crucial for users who rely on the PEFT module for efficient model adaptation and fine-tuning. Without this functionality, users are unable to leverage the benefits of IA3 adapters, such as reduced memory footprint and customizable model tuning, within the PEFT architecture.the
Your contribution
I do not have a complete implementation in mind, but I suggest starting with an evaluation of the current add_weighted_adapter function to determine the necessary modifications for supporting IA3 adapters. Collaboration with researchers familiar with IA3 and PEFT could provide insights into feasible approaches.
The text was updated successfully, but these errors were encountered: