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

How to add an adapter to a quantized model without peft? #660

Closed
2 of 4 tasks
mkgs210 opened this issue Mar 20, 2024 · 1 comment · Fixed by #663
Closed
2 of 4 tasks

How to add an adapter to a quantized model without peft? #660

mkgs210 opened this issue Mar 20, 2024 · 1 comment · Fixed by #663
Assignees
Labels
enhancement New feature or request

Comments

@mkgs210
Copy link

mkgs210 commented Mar 20, 2024

Environment info

  • adapters version: 0.1.1
  • Platform: Windows 10
  • Python version: 3.11.0
  • PyTorch version (GPU?): 2.1.0
  • Using GPU in script?: Yes
  • Using distributed or parallel set-up in script?: No

Information

Model I am using "ai-forever/rugpt3large_based_on_gpt2":

Language I am using the model on Russian:

Adapter setup I am using (if any): BnConfig, SeqBnConfig, DoubleSeqBnConfig, PrefixTuningConfig, LoRAConfig, IA3Config, PromptTuningConfig, MAMConfig, UniPELTConfig

The problem arises when using:

The tasks I am working on is:

  • an official GLUE/SQUaD task: text generation
  • my own task or dataset:

To reproduce

Steps to reproduce the behavior:

  1. Use the Text_Generation_Training adapters example
  2. Load model in 4bit or 8bit
  3. delete "init(model)" because it is not working and replace AutoModelForCausalLM by AutoAdapterModel
  4. trainer.train

Expected behavior

Fine-tuning the model

Real behavior

I'm trying to add an adapter to a quantized model. I would like to use not only the LORA adapter available in PEFT, but also other adapters.
However, as soon as I run the training, the error appears:

ValueError: You cannot perform fine-tuning on purely quantized models. Please attach trainable adapters on top of the quantized model to correctly perform fine-tuning. Please see: https://huggingface.co/docs/transformers/peft for more details

i tried to use PEFT features like prepare_model_for_kbit_training but couldn't add non PEFT adapter

@mkgs210 mkgs210 added the bug Something isn't working label Mar 20, 2024
@calpt calpt added enhancement New feature or request and removed bug Something isn't working labels Mar 31, 2024
@calpt
Copy link
Member

calpt commented Mar 31, 2024

Hey @mkgs210, training on quantized models in the style of e.g. QLoRA is not currently supported by the released version ofadapters. There's a WIP pull request for adding this support here though: #663.

This PR also adds a colab notebook to demo finetuning Llama 2 with QLoRA and adapters: https://github.com/calpt/adapter-transformers/blob/dev/qlora/notebooks/QLoRA_Llama2_Finetuning.ipynb.

Would love for you to test this out and help us adding support for training quantized models to adapters, thanks!

@calpt calpt self-assigned this Mar 31, 2024
@calpt calpt linked a pull request Mar 31, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants