# "You cannot perform fine-tuning on purely quantized models." error in LoRA model training?

**URL:** <https://discuss.huggingface.co/t/you-cannot-perform-fine-tuning-on-purely-quantized-models-error-in-lora-model-training/70605>\
**Category:** 🤗Transformers\
**Created:** [January 25, 2024, 3:39pm UTC](https://discuss.huggingface.co/t/you-cannot-perform-fine-tuning-on-purely-quantized-models-error-in-lora-model-training/70605 "2024-01-25T15:39:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SingaporeBirdie](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@SingaporeBirdie](https://discuss.huggingface.co/u/SingaporeBirdie)\
**Post date:** [January 25, 2024, 3:39pm UTC](https://discuss.huggingface.co/t/you-cannot-perform-fine-tuning-on-purely-quantized-models-error-in-lora-model-training/70605/1 "2024-01-25T15:39:11Z")

</div>

I am training my LoRA model for fine tunning llms task, while training i got the following error, i had already add the adapters and LoRAConfig by following the suggest page:[Load adapters with 🤗 PEFT](https://huggingface.co/docs/transformers/peft) , but still got the problem, always facing the same issue, can anyone

```auto

from peft import LoraConfig, get_peft_model, prepare_model_for_int8_training
import transformers
LORA_R = 256 # 512
LORA_ALPHA = 512 # 1024
LORA_DROPOUT = 0.05

# Define LoRA Config
peft_config = LoraConfig(
                 r = LORA_R, # the dimension of the low-rank matrices
                 lora_alpha = LORA_ALPHA, # scaling factor for the weight matrices
                 lora_dropout = LORA_DROPOUT, # dropout probability of the LoRA layers
                 bias="none",
                 task_type="CAUSAL_LM",
                 target_modules=["query_key_value"]
)

# Prepare int-8 model for training - utility function that prepares a PyTorch model for int8 quantization training. <https://huggingface.co/docs/peft/task_guides/int8-asr>
model2 = prepare_model_for_int8_training(model)
# initialize the model with the LoRA framework

# model3 = get_peft_model(model2, lora_config)
# model.print_trainable_parameters()

model2.add_adapter(peft_config = peft_config, adapter_name = "adapter_1")

# training the model 
trainer = transformers.Trainer(
    model=model2,
    tokenizer=tokenizer,
    args=training_args,
    train_dataset=split_dataset['train'],
    eval_dataset=split_dataset["test"],
    data_collator=data_collator,
)
model.config.use_cache = False # silence the warnings. Please re-enable for inference!
trainer.train()

```

The error is:

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/e/9/e9a7d73534fe773a3e9e53a381f94f83a97230f3.png)

I just don’t understand, i had already add my adapters, why does it always showing that i am performing on purely quantized models that need to attach adapters??

---

<div class="post-metadata">

**Author:** ![jesuisduc](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jesuisduc/32/24251_2.png) [@jesuisduc](https://discuss.huggingface.co/u/jesuisduc)\
**Post date:** [February 27, 2024, 5:27am UTC](https://discuss.huggingface.co/t/you-cannot-perform-fine-tuning-on-purely-quantized-models-error-in-lora-model-training/70605/2 "2024-02-27T05:27:56Z")

</div>

Hey @SingaporeBirdie, did you solve the above problem?

---

<div class="post-metadata">

**Author:** ![bin780](https://avatars.discourse-cdn.com/v4/letter/b/e47774/32.png) [@bin780](https://discuss.huggingface.co/u/bin780)\
**Post date:** [June 5, 2024, 1:51pm UTC](https://discuss.huggingface.co/t/you-cannot-perform-fine-tuning-on-purely-quantized-models-error-in-lora-model-training/70605/3 "2024-06-05T13:51:56Z")

</div>

Hey @SingaporeBirdie , @jesuisduc ,

any of you able to resolve the issue?

---

<div class="post-metadata">

**Author:** ![hisairnessag3](https://avatars.discourse-cdn.com/v4/letter/h/858c86/32.png) [@hisairnessag3](https://discuss.huggingface.co/u/hisairnessag3)\
**Post date:** [August 16, 2024, 4:32pm UTC](https://discuss.huggingface.co/t/you-cannot-perform-fine-tuning-on-purely-quantized-models-error-in-lora-model-training/70605/4 "2024-08-16T16:32:31Z")

</div>

Try restarting the kernel 💪 💪
