LlamaModel.forward() got an unexpected keyword argument 'token_type_ids'
Author: twang2218
Pull request: no

### System Info

* transformers version: **4.30.2**
* Python version: **3.10.11**
* System: Ubuntu 22.04.2 LTS

### 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


For the following code,

```python
model_name = 'TheBloke/guanaco-7B-HF'
model = AutoModel.from_pretrained(model_name, torch_dtype=torch.bfloat16, trust_remote_code=True)
model = model.to('cuda')

inputs = tokenizer(['hello'], max_length=100, truncation=True, return_tensors="pt").to(model.device)
outputs = model(**inputs)
```

I got following error messages:

```js
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[34], line 2
      1 inputs = tokenizer(['hello'], max_length=100, truncation=True, return_tensors="pt").to(model.device)
----> 2 outputs = model(**inputs)

File ~/miniconda/envs/vocab/lib/python3.10/site-packages/torch/nn/modules/module.py:1501, in Module._call_impl(self, *args, **kwargs)
   1496 # If we don't have any hooks, we want to skip the rest of the logic in
   1497 # this function, and just call forward.
   1498 if not (self._backward_hooks or self._backward_pre_hooks or self._forward_hooks or self._forward_pre_hooks
   1499         or _global_backward_pre_hooks or _global_backward_hooks
   1500         or _global_forward_hooks or _global_forward_pre_hooks):
-> 1501     return forward_call(*args, **kwargs)
   1502 # Do not call functions when jit is used
   1503 full_backward_hooks, non_full_backward_hooks = [], []

TypeError: LlamaModel.forward() got an unexpected keyword argument 'token_type_ids'
```

The `inputs` value is following:

```js
{'input_ids': tensor([[    1, 22172]], device='cuda:0'), 'token_type_ids': tensor([[0, 0]], device='cuda:0'), 'attention_mask': tensor([[1, 1]], device='cuda:0')}
```

There is `token_type_ids` in the value returned from `tokenizer`, however, `LlamaModel.forward()` don't accept the arguments.

And I compared `LlamaTokenizer` and `LlamaTokenizerFast`, I found they behave differently.

```python
from transformers import LlamaTokenizer, LlamaTokenizerFast
print(f"LlamaTokenizer: {LlamaTokenizer.from_pretrained(model_name)('hello')}")
print(f"LlamaTokenizerFast: {LlamaTokenizerFast.from_pretrained(model_name)('hello')}")
```

the results are:

```js
LlamaTokenizer: {'input_ids': [1, 22172], 'attention_mask': [1, 1]}
LlamaTokenizerFast: {'input_ids': [1, 22172], 'token_type_ids': [0, 0], 'attention_mask': [1, 1]}
```


### Expected behavior

Should `LlamaTokenizerFast` remove the `token_type_ids` in the returned value? or should `LlamaModel.forward()` accept the `token_type_ids` in the function arguments list? Thanks.

Comments:
cc @ArthurZucker 

Hey, this is a duplicate of #23818 , #24042. Make sure to use the latest version of transformers! 

@ArthurZucker I just double checked, as provided above, the `transformers` I used is version `4.30.2`, which is the latest version for now.

<img width="1186" alt="截屏2023-06-28 上午2 26 09" src="https://github.com/huggingface/transformers/assets/6299096/41da9fa9-de69-4564-9159-3c63273dafaa">

<img width="1421" alt="截屏2023-06-28 上午2 26 34" src="https://github.com/huggingface/transformers/assets/6299096/e9928d80-d4a6-4891-ac47-2242e915cd6e">

Is there any new version I missed?

You can use the latest version using `pip install git+https://github.com/huggingface/transformers`! The pull request is not part of the release 😉 

Oh, 👌, Thank you 🙏.

Would it make sense to let LlamaModel.forward() just ignore token_type_ids such that we can use AutoTokenizer in a modular style? Otherwise I have to do something like this:


`encoding = self.tokenizer.encode_plus(`
`           ...`
`           return_token_type_ids=False if "llama" in CONFIG.pretrained_model_name else True,`
`           ...`
 `)`
 

No, if you use the latest release then you won't have the issue anyway. Llama does not take token types ids so not adding this! 🤗 

@premsa if you use the latest tokenizer (with `AutoTokenizer`) it won't generate the token type IDs anymore, so there is no need to update the llama forward method :)

@ArthurZucker I got the same error even after installing the last transformer version using "pip install git+https://github.com/huggingface/transformers" command, I got the following error: "TypeError: MBartModel.forward() got an unexpected keyword argument 'token_type_ids'"

How can I resolve this?

Hey @HGamalElDin make sure to open a new issue with a proper reproducer if you want help