Error when using BART for Prefix Tuning. Replace `view` with `reshape` in `BartAttention`?
### System Info

- `transformers` version: 4.26.1
- Platform: Linux-5.10.147+-x86_64-with-glibc2.29
- Python version: 3.8.10
- Huggingface_hub version: 0.12.1
- PyTorch version (GPU?): 1.13.1+cu116 (False)
- Tensorflow version (GPU?): 2.11.0 (False)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: <fill in>
- Using distributed or parallel set-up in script?: <fill in>

### Who can help?

@ArthurZucker @younesbelkada

### Information

- [ ] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

When using Prefix Tuning with BART in PEFT, an error occurs for some edge cases, see [#129](https://github.com/huggingface/peft/issues/129#issue-1598538584), with a suggestion to replace `view` with `reshape` in `BartAttention`.

### Expected behavior

I would expect the example code provided in [#129](https://github.com/huggingface/peft/issues/129#issue-1598538584) to work regardless of the length of the input.
Hello! Thanks a lot for reporting. Will open a PR to fix this 😉 
<|||||>@ArthurZucker It seems in GPTJ there also have the same problem when using prefix-tuning trained model to generate text
```
  File "/root/miniconda3/envs/gpt_fine_tune/lib/python3.9/site-packages/transformers/generation/utils.py", line 1391, in generate
    return self.greedy_search(
  File "/root/miniconda3/envs/gpt_fine_tune/lib/python3.9/site-packages/transformers/generation/utils.py", line 2179, in greedy_search
    outputs = self(
  File "/root/miniconda3/envs/gpt_fine_tune/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/root/miniconda3/envs/gpt_fine_tune/lib/python3.9/site-packages/transformers/models/gptj/modeling_gptj.py", line 813, in forward
    transformer_outputs = self.transformer(
  File "/root/miniconda3/envs/gpt_fine_tune/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/root/miniconda3/envs/gpt_fine_tune/lib/python3.9/site-packages/transformers/models/gptj/modeling_gptj.py", line 575, in forward
    position_ids = position_ids.view(-1, input_shape[-1])
RuntimeError: shape '[-1, 108]' is invalid for input of size 128
```
___________________________________________________________________________
update
when not passing 'attention_mask', the error changed to:
```
  File "/root/miniconda3/envs/gpt_fine_tune/lib/python3.9/site-packages/transformers/models/gptj/modeling_gptj.py", line 302, in forward
    attn_outputs = self.attn(
  File "/root/miniconda3/envs/gpt_fine_tune/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/root/miniconda3/envs/gpt_fine_tune/lib/python3.9/site-packages/transformers/models/gptj/modeling_gptj.py", line 251, in forward
    attn_output, attn_weights = self._attn(query, key, value, attention_mask, head_mask)
  File "/root/miniconda3/envs/gpt_fine_tune/lib/python3.9/site-packages/transformers/models/gptj/modeling_gptj.py", line 176, in _attn
    attn_weights = attn_weights + attention_mask
RuntimeError: The size of tensor a (128) must match the size of tensor b (108) at non-singleton dimension 3
```
and I use num_virtual_tokens=20, which seems is a problem of `PEFT`?<|||||>Hey, not really sure this is the same, the error does not involve having to replace  `view` with `reshape`. You seem to have a problem with the positional ids. They are deprecated see #21869. <|||||>> Hey, not really sure this is the same, the error does not involve having to replace `view` with `reshape`. You seem to have a problem with the positional ids. They are deprecated see #21869.

yeah it seems not the same root cause, I will turn to PEFT to find resolution, thanks for your reply!

-------------------------------------------------------------------------------------------------------------------

the problem solved withou any code changing but just install transformers' main branch from source