Alpaca LoRA generate TypeError: LoraConfig.__init__() got an unexpected keyword argument 'enable_lora'

2.7k views Asked by At

I try to use alpaca lora generate.py to get a new model from costumize dataset, I have done finetune the lora weight, but when I using generate.py it show up this error msg, the resource I try is from Fine-tuning Alpaca: Train Alpaca LoRa for Sentiment Analysis on a Custom Dataset. Here is the error msg, can anyone tell me how to fix it?

Traceback (most recent call last):
  File "/content/alpaca-lora/generate.py", line 189, in <module>
    fire.Fire(main)
  File "/usr/local/lib/python3.10/dist-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/usr/local/lib/python3.10/dist-packages/fire/core.py", line 475, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/usr/local/lib/python3.10/dist-packages/fire/core.py", line 691, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/content/alpaca-lora/generate.py", line 40, in main
    model = PeftModel.from_pretrained(
  File "/usr/local/lib/python3.10/dist-packages/peft/peft_model.py", line 304, in from_pretrained
    config = PEFT_TYPE_TO_CONFIG_MAPPING[
  File "/usr/local/lib/python3.10/dist-packages/peft/config.py", line 134, in from_pretrained
    config = config_cls(**kwargs)
TypeError: LoraConfig.__init__() got an unexpected keyword argument 'enable_lora'

I have also try on my own env with conda, but still have same mistake. [sad emoji]

3

There are 3 answers

0
mohsen taleb On

Just Upgrade the package.

pip install --upgrade peft

0
Mouad On

try this :

pip install -q git+https://github.com/huggingface/peft.git
0
Dayoung Kang On

use this model "riverallzero/alpaca-lora-7b" when loading Peft

model = PeftModel.from_pretrained(model, 'riverallzero/alpaca-lora-7b')