Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Unrecognized image processor in Qwen/Qwen2.5-VL-3B-Instruct. #36193

Open
SkalskiP opened this issue Feb 14, 2025 · 12 comments
Open
Labels

Comments

@SkalskiP
Copy link

SkalskiP commented Feb 14, 2025

System Info

  • transformers 4.49.0.dev0
  • Python 3.11.11

Reproduction

I follow model instructions from here.

  1. install transformers from GH
pip install git+https://github.com/huggingface/transformers
  1. laod Qwen/Qwen2.5-VL-3B-Instruct or Qwen/Qwen2.5-VL-7B-Instruct; I did not tested with others
from transformers import AutoProcessor

processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-VL-3B-Instruct")
  1. it raise exception
ValueError: Unrecognized image processor in Qwen/Qwen2.5-VL-3B-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, git, glpn, got_ocr2, grounding-dino, groupvit, hiera, idefics, idefics2, idefics3, ijepa, imagegpt, instructblip, instructblipvideo, kosmos-2, layoutlmv2, layoutlmv3, levit, llava, llava_next, llava_next_video, llava_onevision, mask2former, maskformer, mgp-str, mllama, mobilenet_v1, mobilenet_v2, mobilevit, mobilevitv2, nat, nougat, oneformer, owlv2, owlvit, paligemma, perceiver, pix2struct, pixtral, poolformer, pvt, pvt_v2, qwen2_5_vl, qwen2_vl, regnet, resnet, rt_detr, sam, segformer, seggpt, siglip, 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

Expected behavior

processor loads without exceptions

@SkalskiP SkalskiP added the bug label Feb 14, 2025
@SkalskiP
Copy link
Author

When installing pip install git+https://github.com/huggingface/transformers.git@1931a351408dbd1d0e2c4d6d7ee0eb5e8807d7bf AutoProcessor works. Looks like 33d1d71 might have broke it.

@JasonChenJC
Copy link

same problem

@Zzsf11
Copy link

Zzsf11 commented Feb 16, 2025

Delete "image_processor_type": "Qwen2_5_VLImageProcessor" in Qwen2.5-VL-7B-Instruct/preprocessor_config.json could work.

@hhhharold
Copy link

hhhharold commented Feb 17, 2025

update preprocessor_config.json, which is updated 2 days ago on huggingface

@zucchini-nlp
Copy link
Member

zucchini-nlp commented Feb 17, 2025

Hey all! Thanks for reporting this, I didn't see that the slow image processor was removed!

@ArthurZucker I believe the slow ones should stay for a while, at least until the fast ones become the default. The issue is fixed now by updating the hub files and forcing the model to use Qwen2VL slow processor (models have identical image processing)

@shubham-atlys
Copy link

I am facing this error while using unsloth for finetuning. Please post the solution in case anyone has got it.

model, tokenizer = FastVisionModel.from_pretrained(
    "Qwen/Qwen2.5-VL-3B-Instruct",
    load_in_4bit = True, # Use 4bit to reduce memory use. False for 16bit LoRA.
    use_gradient_checkpointing = "unsloth", # True or "unsloth" for long context
)

@ArthurZucker
Copy link
Collaborator

IMO no need for the slow, let's make sure this does not break for people as release is soon. The processor was introduced in the main branch only

@pooyadavoodi
Copy link

I tried to pass image_processor_type in kwargs of get_image_processor_dict, but this function doesn't use image_processor_type as a kwarg. Is that a bug?

The reason I am doing this is that this preprocessor_config.json is still using Qwen2_5_VLImageProcessor and I am trying to overwrite it with Qwen2VLImageProcessor via vLLM.

@pcuenca
Copy link
Member

pcuenca commented Feb 23, 2025

So just to understand it better, is the solution to update the image processor in all derivative models, such as MLX (search, example), fine-tunes and others?

And if so, this would only work on transformers >= 4.49.0, right?

cc @zucchini-nlp

@zucchini-nlp
Copy link
Member

@pcuenca yep, that is the solution and it will work in all version is that case. The problem is we deleted the class for qwen2-5-vl, since it is identical to qwen2-vl before the release. So using qwen2-vl works for all models

And sorry for a breaking change

@pcuenca
Copy link
Member

pcuenca commented Feb 24, 2025

Thanks, no worries! I'll test a bit and then open PRs for the MLX repos.

Copy link

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 are likely to be ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants