Visual Question Answering
Transformers
Safetensors
English
videollama3_qwen2
text-generation
multi-modal
large-language-model
video-language-model
custom_code
Instructions to use DAMO-NLP-SG/VideoLLaMA3-2B-Image with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DAMO-NLP-SG/VideoLLaMA3-2B-Image with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("visual-question-answering", model="DAMO-NLP-SG/VideoLLaMA3-2B-Image", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("DAMO-NLP-SG/VideoLLaMA3-2B-Image", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update processing_videollama3.py
Browse files- processing_videollama3.py +11 -8
processing_videollama3.py
CHANGED
|
@@ -304,14 +304,17 @@ class Videollama3Qwen2Processor(ProcessorMixin):
|
|
| 304 |
else:
|
| 305 |
raise ValueError(f"Unsupported image path type: {type(image_path)}")
|
| 306 |
return images
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
|
|
|
|
|
|
|
|
|
| 315 |
|
| 316 |
def load_video(
|
| 317 |
self,
|
|
|
|
| 304 |
else:
|
| 305 |
raise ValueError(f"Unsupported image path type: {type(image_path)}")
|
| 306 |
return images
|
| 307 |
+
|
| 308 |
+
try:
|
| 309 |
+
if isinstance(image_path, list):
|
| 310 |
+
images = [load_single_image(f) for f in image_path]
|
| 311 |
+
elif isinstance(image_path, str) and os.path.isdir(image_path):
|
| 312 |
+
images = [Image.open(os.path.join(image_path, f)).convert('RGB') for f in sorted(os.listdir(image_path))]
|
| 313 |
+
else:
|
| 314 |
+
images = [load_single_image(image_path)]
|
| 315 |
+
return images
|
| 316 |
+
except:
|
| 317 |
+
raise ValueError(f"Error when loading images: {type(image_path)}")
|
| 318 |
|
| 319 |
def load_video(
|
| 320 |
self,
|