Views
No views yet

huggingface-cli download nvidia/omnivinci --local-dir ./omnivinci --local-dir-use-symlinks False
cd ./omnivincibash ./environment_setup.sh omnivinci1from transformers import AutoProcessor, AutoModel, AutoConfig,AutoModelForCausalLM
2import torch
3import os
4
5# default: Load the model on the available device(s)
6model_path = "./"
7video_path = "xxx.mp4"
8generation_kwargs = {"max_new_tokens": 1024, "max_length": 99999999}
9load_audio_in_video = True
10num_video_frames = 128
11audio_length = "max_3600"
12
13config = AutoConfig.from_pretrained(model_path, trust_remote_code=True)
14
15model = AutoModel.from_pretrained(model_path,
16 trust_remote_code=True,
17 torch_dtype="torch.float16",
18 device_map="auto")
19
20processor = AutoProcessor.from_pretrained(model_path, trust_remote_code=True)
21generation_config = model.default_generation_config
22generation_config.update(**generation_kwargs)
23
24model.config.load_audio_in_video = load_audio_in_video
25processor.config.load_audio_in_video = load_audio_in_video
26if num_video_frames > 0:
27 model.config.num_video_frames = num_video_frames
28 processor.config.num_video_frames = num_video_frames
29if audio_length != -1:
30 model.config.audio_chunk_length = audio_length
31 processor.config.audio_chunk_length = audio_length
32
33
34conversation = [{
35 "role": "user",
36 "content": [
37 {"type": "video", "video":video_path},
38 {"type": "text", "text": "Assess the video, followed by a detailed description of its video and audio contents."}
39 ]
40}]
41text = processor.apply_chat_template(conversation, tokenize=False, add_generation_prompt=True)
42
43inputs = processor([text])
44
45output_ids = model.generate(
46 input_ids=inputs.input_ids,
47 media=getattr(inputs, 'media', None),
48 media_config=getattr(inputs, 'media_config', None),
49 generation_config=generation_config,
50)
51print(processor.tokenizer.batch_decode(output_ids, skip_special_tokens=True))example_mini_audio.py and example_mini_image.py.1@article{ye2025omnivinci,
2 title={OmniVinci: Enhancing Architecture and Data for Omni-Modal Understanding LLM},
3 author={Ye, Hanrong and Yang, Chao-Han Huck and Goel, Arushi and Huang, Wei and Zhu, Ligeng and Su, Yuanhang and Lin, Sean and Cheng, An-Chieh and Wan, Zhen and Tian, Jinchuan and others},
4 journal={arXiv preprint arXiv:2510.15870},
5 year={2025}
6}