Glm4vProcessor passes False instead of tokenizer instance when use_fast=False
Author: zRzRzRzRzRzRzR
Pull request: no
Labels: name: bug

If this command is used:
```
processor = AutoProcessor.from_pretrained(model_path, use_fast=False)
```
the following error occurs:
```
Traceback (most recent call last):
  File "/mnt/transformers/test_file/test_images.py", line 23, in <module>
    processor = AutoProcessor.from_pretrained(model_path, use_fast=False)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/transformers/src/transformers/models/auto/processing_auto.py", line 380, in from_pretrained
    return processor_class.from_pretrained(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/transformers/src/transformers/processing_utils.py", line 1371, in from_pretrained
    return cls.from_args_and_dict(args, processor_dict, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/transformers/src/transformers/processing_utils.py", line 1143, in from_args_and_dict
    processor = cls(*args, **valid_kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/transformers/src/transformers/models/glm4v/processing_glm4v.py", line 74, in __init__
    else tokenizer.convert_tokens_to_ids(self.image_token)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'bool' object has no attribute 'convert_tokens_to_ids'
```

This error is only found in GLM. I tested Qwen3-VL and did not encounter it.
The Processor specifications of both models should be very similar. Through debugging, I discovered that during GLM initialization, the tokenizer variable was passed False (a bool) instead of the tokenizer itself. Fixed as follows:
```
processor = AutoProcessor.from_pretrained(model_path, use_fast=False, tokenizer=AutoTokenizer.from_pretrained(model_path))
```
This works normally. The code issue has not yet been identified.

I hope it can work without passing in the tokenizer parameter.

transformers version: main branch or 4.57.1
python 3.10


### Who can help?

_No response_

### Information

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

### Tasks

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

### Reproduction

```
from transformers import AutoProcessor, AutoModelForImageTextToText
model_path = "zai-org/GLM-4.1V-9B-Thinking"
processor = AutoProcessor.from_pretrained(model_path, use_fast=False)
```

### Expected behavior

processor = AutoProcessor.from_pretrained(model_path, use_fast=False) working

Comments:
The model has no tokenizer class implemented and maps to a `PreTrainedTokenizer` in auto-mapping. So when we want to load a slow tokenizer, it fails to find some tokenizer methods (`self.get_vocab()` here)

cc @itazap for tokenizers, I am not sure it's oke that we map to PreTrainedTokenizer in auto

How was it done before? Because I haven't encountered this issue previously

I don't think it worked before, the model has no slow tokenizer. Prob the "use_fast" kwarg wasn't used before if it worked

This works, we used the slow method before version 4.52.

I suggest to keep using fast tokenizer until resolved. @itazap will help with the slow tokenizer

Any updates here?

@zRzRzRzRzRzRzR hey! Thank you for your patience on this, I will take a look ASAP! FYI for our next release we won't be using "slow"/"fast" terminology anymore but we still will enable models to have a Python / `tokenizers` backend.

Generally the goal is that the behavior from 'fast' is the ground-truth correct tokenizer. Can you please share the issues you are having with it ? (when using `use_fast=True`? Thanks!

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.