AutoTokenizer loading fails with `object has no attribute 'config'`
### System Info

- `transformers` version: 4.25.1
- Platform: macOS-10.16-x86_64-i386-64bit
- Python version: 3.9.16
- Huggingface_hub version: 0.11.1
- PyTorch version (GPU?): 1.13.1 (False)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: no
- Using distributed or parallel set-up in script?: no

### Who can help?

@ArthurZucker, @younesbelkada

### Information

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

### Tasks

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

### Reproduction

Run the following script:

```python
from transformers import AutoTokenizer, AutoModelForTokenClassification, TokenClassificationPipeline

model_name = "QCRI/bert-base-multilingual-cased-pos-english"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForTokenClassification.from_pretrained(model_name)

pipeline = TokenClassificationPipeline(model, tokenizer)
outputs = pipeline("A test example")
print(outputs)
```

### Expected behavior

Since this is a part-of-speech model, I expect part-of-speech tags for "A test example". This works as expected in atleast version `4.2.0`.

With the lastest (`4.25.1`), the tokenizer loading fails with the error:

`AttributeError: 'BertTokenizerFast' object has no attribute 'config'`

Forcing the python tokenizer by setting `use_fast=False` changes the error to:

`AttributeError: 'BertTokenizer' object has no attribute 'config'`

Since the model and the code worked recently, is this a regression or is there a (intended) breaking change in the recent versions? Either way, whats the best way to fix the model/code to make it work again?

Thanks!
Hi, @fdalvi the code runs as expected if you use `pipeline` instead of `TokenClassificationPipeline`,
```
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline

model_name = "QCRI/bert-base-multilingual-cased-pos-english"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForTokenClassification.from_pretrained(model_name)

pipe = pipeline(task="token-classification", model=model, tokenizer=tokenizer)
outputs = pipe("A test example")
print(outputs)
```
>>[{'entity': 'DT', 'score': 0.9997243, 'index': 1, 'word': 'A', 'start': 0, 'end': 1}, {'entity': 'NN', 'score': 0.9997472, 'index': 2, 'word': 'test', 'start': 2, 'end': 6}, {'entity': 'NN', 'score': 0.99973196, 'index': 3, 'word': 'example', 'start': 7, 'end': 14}]

I think there might be a problem with `TokenClassificationPipeline`.
EDIT - as mentioned by @younesbelkada there is no problem with `TokenClassificationPipeline`, it was due to not passing positional arguments correctly, sorry I completely overlooked that part!<|||||>Thanks @susnato for narrowing it down and for the quick temporary fix! Hope this makes it easier to figure out what the underlying issue is.<|||||>Hi @fdalvi 
Thanks for the issue, you need to pass explicit positional arguments into `TokenClassificationPipeline` to make it work. The snippet below works fine:
```
from transformers import AutoTokenizer, AutoModelForTokenClassification, TokenClassificationPipeline

model_name = "QCRI/bert-base-multilingual-cased-pos-english"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForTokenClassification.from_pretrained(model_name)

pipeline = TokenClassificationPipeline(model=model, tokenizer=tokenizer)
outputs = pipeline("A test example")
```
the snippet shared by @susnato will also fail if you don't pass positional arguments<|||||>Ah thats an easy fix! Thanks a lot for the quick response.