Can't load Llama4 Processor
Author: pb-sameerreddy
Pull request: no
Labels: name: bug

name: Vision

name: Processing

### System Info



Error:
```
ValueError: Unrecognized image processor in meta-llama/Llama-4-Maverick-17B-128E-Instruct. Should have a `image_processor_type` key in its preprocessor_config.json of config.json, or one of the following `model_type` keys in its config.json: align, aria, beit, bit, blip, blip-2, bridgetower, chameleon, chinese_clip, clip, clipseg, conditional_detr, convnext, convnextv2, cvt, data2vec-vision, deformable_detr, deit, depth_anything, depth_pro, deta, detr, dinat, dinov2, donut-swin, dpt, efficientformer, efficientnet, flava, focalnet, fuyu, gemma3, git, glpn, got_ocr2, grounding-dino, groupvit, hiera, idefics, idefics2, idefics3, ijepa, imagegpt, instructblip, instructblipvideo, kosmos-2, layoutlmv2, layoutlmv3, levit, llama4, llava, llava_next, llava_next_video, llava_onevision, mask2former, maskformer, mgp-str, mistral3, mllama, mobilenet_v1, mobilenet_v2, mobilevit, mobilevitv2, nat, nougat, oneformer, owlv2, owlvit, paligemma, perceiver, phi4_multimodal, pix2struct, pixtral, poolformer, prompt_depth_anything, pvt, pvt_v2, qwen2_5_vl, qwen2_vl, regnet, resnet, rt_detr, sam, segformer, seggpt, shieldgemma2, siglip, siglip2, superglue, swiftformer, swin, swin2sr, swinv2, table-transformer, timesformer, timm_wrapper, tvlt, tvp, udop, upernet, van, videomae, vilt, vipllava, vit, vit_hybrid, vit_mae, vit_msn, vitmatte, xclip, yolos, zoedepth
```

Env:
- `transformers` version: 4.51.1
- Platform: Linux-6.8.0-53-generic-x86_64-with-glibc2.35
- Python version: 3.10.12
- Huggingface_hub version: 0.30.2
- Safetensors version: 0.5.3
- Accelerate version: 0.34.2
- Accelerate config:    not found
- DeepSpeed version: 0.16.3
- PyTorch version (GPU?): 2.6.0+cu124 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using distributed or parallel set-up in script?: No
- Using GPU in script?: Yes
- GPU type: NVIDIA H200

### Who can help?

_No response_

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

Code: 
```
model_id = "meta-llama/Llama-4-Maverick-17B-128E-Instruct"

processor = AutoProcessor.from_pretrained(model_id)
```

### Expected behavior

Processor loads and can be used to tokenize messages. 

Comments:
Hi @pb-sameereddy, this code runs fine for me. Can you try running on different environments to see if there's some environment issue that's causing it?

@Rocketknight1 can you share your environment? (`transformers-cli env`)

Same problem "Unrecognized image processor ..." for me

Env
- `transformers` version: 4.51.1
- Platform: Linux-6.8.0-55-generic-x86_64-with-glibc2.39
- Python version: 3.12.9
- Huggingface_hub version: 0.30.2
- Safetensors version: 0.5.3
- Accelerate version: not installed
- Accelerate config: not found
- DeepSpeed version: not installed
- PyTorch version (GPU?): 2.8.0.dev20250408+cu128 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using distributed or parallel set-up in script?: <fill in>
- Using GPU in script?: <fill in>
- GPU type: NVIDIA B200


I get same issue even with `transformers` version: 4.52.0.dev0

same for me on 4.51.0

- `transformers` version: 4.51.0
- Platform: Linux-4.18.0-305.el8.x86_64-x86_64-with-glibc2.35
- Python version: 3.10.12
- Huggingface_hub version: 0.30.2
- Safetensors version: 0.5.2
- Accelerate version: 1.4.0
- Accelerate config: 	not found
- DeepSpeed version: not installed
- PyTorch version (GPU?): 2.6.0+cu124 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using distributed or parallel set-up in script?: no
- Using GPU in script?: yes
- GPU type: NVIDIA A100-SXM4-80GB


Do you have torchvision installed?

Can confirm that I get the same error after uninstalling `torchvision`. cc @qubvel @zucchini-nlp - maybe we should have a clearer error when it's missing rather than just the Processor class not being present?

I guess, when torchvision is not installed, it's trying to fallback to a slow image processor, which does not exist. 
cc @yonigozlan maybe you know better

Hmm, my guess was that torchvision is installed whenever one installs `transformers`. thus we don't break anything for users when fast processor become the only option 🤔 

It's going to be the "vision" option, which currently has Pillow only, however not mandatory, because text-only models don't require image processors

> I guess, when torchvision is not installed, it's trying to fallback to a slow image processor, which does not exist.

Yes the auto file for image processors assumes that all image processors have at least a slow version, llama4 had one in the PR at some point, not sure what happened to it 😅. But since now llama4 and phi4 only have a fast image processor, I'll open a PR to take this into account 

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.