Instructions to use tencent/WeMM-Video-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/WeMM-Video-2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="tencent/WeMM-Video-2B", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModel processor = AutoProcessor.from_pretrained("tencent/WeMM-Video-2B", trust_remote_code=True) model = AutoModel.from_pretrained("tencent/WeMM-Video-2B", trust_remote_code=True, device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tencent/WeMM-Video-2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tencent/WeMM-Video-2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tencent/WeMM-Video-2B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/tencent/WeMM-Video-2B
- SGLang
How to use tencent/WeMM-Video-2B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "tencent/WeMM-Video-2B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tencent/WeMM-Video-2B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "tencent/WeMM-Video-2B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tencent/WeMM-Video-2B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use tencent/WeMM-Video-2B with Docker Model Runner:
docker model run hf.co/tencent/WeMM-Video-2B
Download README_PROCESSOR.md from tencent/WeMM-Video-2B: direct link, hf CLI and curl.
- Browser
- Download file 2.91 kB
-
https://huggingface.co/tencent/WeMM-Video-2B/resolve/main/README_PROCESSOR.md
- Command line
-
hf download hf://tencent/WeMM-Video-2B/README_PROCESSOR.md
-
curl -L -o README_PROCESSOR.md https://huggingface.co/tencent/WeMM-Video-2B/resolve/main/README_PROCESSOR.md
WeMM processor usage
Load the processor from the same model directory as the weights:
from transformers import AutoProcessor
model_dir = "." # Run from the downloaded model directory, or set your own path.
processor = AutoProcessor.from_pretrained(model_dir, trust_remote_code=True)
The main README contains the model loading and generation example, media defaults and runtime requirements.
Ordered messages
Use apply_chat_template with tokenization enabled to decode media and construct the complete model inputs. The order of media and text follows the message content list.
messages = [{"role": "user", "content": [
{"type": "image", "image": "image.jpg"},
{"type": "audio", "audio": "audio.wav"},
{"type": "text", "text": "结合图片和声音描述内容。"},
]}]
inputs = processor.apply_chat_template(
messages,
tokenize=True,
return_dict=True,
return_tensors="pt",
add_generation_prompt=True,
enable_thinking=False,
)
Supported media items include image, video, audio and video_audio. A video_audio item uses the video field for its source. video can also include audio when use_audio_in_video=True is passed to the processor. A video without an audio stream falls back to visual processing.
Direct media calls
inputs = processor(question="比较两段音频。", audios=["first.wav", "second.wav"])
inputs = processor(question="概括视频。", videos="clip.mp4", fps=2, max_frames=128)
inputs = processor(question="结合画面和声音概括视频。", video_audio="clip.mp4")
These calls construct one conversation, including when multiple media files are supplied. Move the selected input with inputs.to(model.device) before calling model.generate(**inputs, max_new_tokens=128).
apply_chat_template(..., tokenize=False) only formats a prompt. For ordinary multimodal generation use the tokenized form shown above so the processor also decodes media and expands the media tokens.
Media controls
The model's processor_config.json stores defaults. Call arguments can override fps, num_frames, min_frames, max_frames, total_pixels, min_pixels and max_pixels. Individual video items can override their own media options. Advanced image and video processor settings can be passed through images_kwargs and videos_kwargs.
timestamp_interval_sec controls standalone-audio timestamp grouping. The audio window and stride come from the model's audio configuration; keep them with the matching weights. Longer clips and larger frame/pixel budgets require more context and memory.
The returned BatchFeature contains model input fields. Diagnostic attributes media_metadata and prompt_text describe processing and are not model generation arguments. The default chat mode is instruct; enable_thinking=False selects it explicitly.