There is no problem with the model package. It is clearly installed, but it always reports an error. My running code is as follows
!pip install -U transformers
!pip install num2words
from transformers import AutoProcessor, AutoModelForImageTextToText
import torch
model_path = "HuggingFaceTB/SmolVLM2-256M-Video-Instruct"
processor = AutoProcessor.from_pretrained(model_path)
model = AutoModelForImageTextToText.from_pretrained(
model_path,
torch_dtype=torch.bfloat16,
_attn_implementation="flash_attention_2"
).to("cuda")
ImportError Traceback (most recent call last)
/tmp/ipython-input-16-1605870874.py in <cell line: 0>()
3
4 model_path = "HuggingFaceTB/SmolVLM2-256M-Video-Instruct"
----> 5 processor = AutoProcessor.from_pretrained(model_path)
6 model = AutoModelForImageTextToText.from_pretrained(
7 model_path,
3 frames
/usr/local/lib/python3.11/dist-packages/transformers/models/smolvlm/processing_smolvlm.py in init(self, image_processor, tokenizer, video_processor, image_seq_len, chat_template, **kwargs)
175
176 if not num2words:
--> 177 raise ImportError(
178 "Package num2words
is required to run SmolVLM processor. Install it with pip install num2words
."
179 )
ImportError: Package num2words
is required to run SmolVLM processor. Install it with pip install num2words
.
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.