Instructions to use lambertxiao/Vision-Language-Vision-Captioner-Qwen2.5-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lambertxiao/Vision-Language-Vision-Captioner-Qwen2.5-3B with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="lambertxiao/Vision-Language-Vision-Captioner-Qwen2.5-3B", trust_remote_code=True, device_map="auto")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("lambertxiao/Vision-Language-Vision-Captioner-Qwen2.5-3B", trust_remote_code=True, dtype="auto", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Path problem in loading model
I consistently get the following error when I try to load the model, where "vlv.py" is just an appropriately modified version of the first sample script. I also get the same error when I try to load directly as an AutoModel. Seems that "Qwen2" here should be "Qwen2.5-3B" since that's what's in the path it creates in the cache.
Traceback (most recent call last):
File "vlv.py", line 65, in
model = AutoModel.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/my_user_name/anaconda3/lib/python3.12/site-packages/transformers/models/auto/auto_factory.py", line 586, in from_pretrained
model_class = get_class_from_dynamic_module(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/my_user_name/anaconda3/lib/python3.12/site-packages/transformers/dynamic_module_utils.py", line 581, in get_class_from_dynamic_module
return get_class_in_module(class_name, final_module, force_reload=force_download)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/my_user_name/anaconda3/lib/python3.12/site-packages/transformers/dynamic_module_utils.py", line 276, in get_class_in_module
module_spec.loader.exec_module(module)
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/home/my_user_name/.cache/huggingface/modules/transformers_modules/lambertxiao/Vision-Language-Vision-Captioner-Qwen2.5-3B/094ba04d08519298a1f172fe62bc06646e051c30/VLV_stage2.py", line 12, in
from .build import load_sd_model, load_Florence2_model
ModuleNotFoundError: No module named 'transformers_modules.lambertxiao.Vision-Language-Vision-Captioner-Qwen2'