# Error with get\_peft\_model() and PromptTuningConfig

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-with-get-peft-model-and-prompttuningconfig%2F46485%3E%5C
**Category:** 🤗Transformers\
**Created:** [July 11, 2023, 8:53pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-with-get-peft-model-and-prompttuningconfig%2F46485 "2023-07-11T20:53:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidmakovoz](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/davidmakovoz/32/17319_2.png) [@davidmakovoz](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fdavidmakovoz)%5C
**Post date:** [July 11, 2023, 8:53pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-with-get-peft-model-and-prompttuningconfig%2F46485%2F1 "2023-07-11T20:53:45Z")

</div>

I am learning how to perform Prompt Tunning and running into a problem.

I am using get\_peft\_model function to initialize a model for training from ‘google/flan-t5-base’

```auto
model_name='google/flan-t5-base'
tokenizer = AutoTokenizer.from_pretrained(model_name,)
original_model = AutoModelForSeq2SeqLM.from_pretrained(model_name)

peft_prompt_config = PromptTuningConfig(task_type="SEQ_2_SEQ_LM", num_virtual_tokens=20)
prompt_model = get_peft_model(original_model, peft_prompt_config)

#create a dummy input
input_ids = tokenizer('test', return_tensors="pt").input_ids

original_model.generate(input_ids)
>>Out[76]: tensor([[0, 794, 1]])

prompt_model.generate(input_ids)
>> TypeError: generate() takes 1 positional argument but 2 were given

help(prompt_model.generate)
>>generate(**kwargs) method of peft.peft_model.PeftModelForSeq2SeqLM instance

prompt_model.generate(**{'input_ids':input_ids})
>> NotImplementedError: 

```

It does work for LoRA:

```auto
lora_config = LoraConfig(
    r=32, lora_alpha=32, target_modules=["q", "v"], lora_dropout=0.05, task_type=TaskType.SEQ_2_SEQ_LM 
)
lora_model = get_peft_model(original_model, lora_config)
lora_model.generate(**{'input_ids':input_ids})
>> Out[92]: tensor([[0, 794, 1]])

```

Here are the versions:

```auto
torch. __version__
>>Out[93]: '2.0.1+cu117'

transformers. __version__
>>Out[95]: '4.26.1'

peft. __version__
Out[98]: '0.3.0'

```

---

<div class="post-metadata">

**Author:** ![hulinpo](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/hulinpo/32/20946_2.png) [@hulinpo](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fhulinpo)%5C
**Post date:** [November 6, 2023, 6:05am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-with-get-peft-model-and-prompttuningconfig%2F46485%2F2 "2023-11-06T06:05:15Z")

</div>

Hello, has this problem been solved?
