DAMO-NLP-SG / DAMO-NLP-SG/VideoLLaMA2

Inference code does not work for videos

Open
#114 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.3k
Forks
90
PR merge metrics
No merged PRs in 30d

Description

The inference code provided does not work
```
import sys
sys.path.append('./')
from videollama2 import model_init, mm_infer
from videollama2.utils import disable_torch_init

def inference():
disable_torch_init()

# Video Inference
modal = 'video'
modal_path = 'assets/cat_and_chicken.mp4'
instruct = 'What animals are in the video, what are they doing, and how does the video feel?'
# Reply:
# The video features a kitten and a baby chick playing together. The kitten is seen laying on the floor while the baby chick hops around. The two animals interact playfully with each other, and the video has a cute and heartwarming feel to it.

model_path = 'DAMO-NLP-SG/VideoLLaMA2.1-7B-16F'
# Base model inference (only need to replace model_path)
# model_path = 'DAMO-NLP-SG/VideoLLaMA2.1-7B-16F-Base'
model, processor, tokenizer = model_init(model_path)
output = mm_infer(processor[modal](modal_path), instruct, model=model, tokenizer=tokenizer, do_sample=False, modal=modal)

print(output)

if __name__ == "__main__":
inference()
```
following error occur
![image](https://github.com/user-attachments/assets/23f3cd81-82f1-4d73-a5b0-471d8c3edc9e)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with the provided Python inference snippet, using assets/cat_and_chicken.mp4 and the model_init/mm_infer entry points. Read the attached error and trace it through videollama2.utils and the processor[modal]('video') call; done means the example runs and prints the expected video response.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.