Image-Text-to-Text
Transformers
Safetensors
English
Chinese
qwen3_5
feature-extraction
wemm
multimodal
video
audio
conversational
custom_code
Instructions to use tencent/WeMM-Video-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/WeMM-Video-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="tencent/WeMM-Video-4B", 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-4B", trust_remote_code=True) model = AutoModel.from_pretrained("tencent/WeMM-Video-4B", 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-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tencent/WeMM-Video-4B" # 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-4B", "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-4B
- SGLang
How to use tencent/WeMM-Video-4B 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-4B" \ --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-4B", "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-4B" \ --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-4B", "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-4B with Docker Model Runner:
docker model run hf.co/tencent/WeMM-Video-4B
Download processor_config.json from tencent/WeMM-Video-4B: direct link, hf CLI and curl.
- Browser
- Download file 2.73 kB
-
https://huggingface.co/tencent/WeMM-Video-4B/resolve/main/processor_config.json
- Command line
-
hf download hf://tencent/WeMM-Video-4B/processor_config.json
-
curl -L -o processor_config.json https://huggingface.co/tencent/WeMM-Video-4B/resolve/main/processor_config.json
2.73 kB
| { | |
| "processor_class": "WeMMProcessor", | |
| "auto_map": { | |
| "AutoProcessor": "processing_wemm.WeMMProcessor" | |
| }, | |
| "wemm_defaults": { | |
| "fps": 2.0, | |
| "min_frames": 4, | |
| "max_frames": 128, | |
| "total_pixels": 25165824, | |
| "min_pixels": 4096, | |
| "system_prompt": "You are a helpful assistant.", | |
| "timestamp_interval_sec": 1.0 | |
| }, | |
| "audio_config": { | |
| "attn_implementation": "flash_attention_2", | |
| "activation_dropout": 0.0, | |
| "activation_function": "gelu", | |
| "apply_spec_augment": false, | |
| "attention_dropout": 0.0, | |
| "bos_token_id": 50257, | |
| "classifier_proj_size": 256, | |
| "d_model": 1280, | |
| "decoder_attention_heads": 20, | |
| "decoder_ffn_dim": 5120, | |
| "decoder_layerdrop": 0.0, | |
| "decoder_layers": 32, | |
| "decoder_start_token_id": 50258, | |
| "dropout": 0.0, | |
| "dtype": "bfloat16", | |
| "encoder_attention_heads": 20, | |
| "encoder_ffn_dim": 5120, | |
| "encoder_layerdrop": 0.0, | |
| "encoder_layers": 32, | |
| "eos_token_id": 50257, | |
| "init_std": 0.02, | |
| "mask_feature_length": 10, | |
| "mask_feature_min_masks": 0, | |
| "mask_feature_prob": 0.0, | |
| "mask_time_length": 10, | |
| "mask_time_min_masks": 2, | |
| "mask_time_prob": 0.05, | |
| "max_source_positions": 1500, | |
| "max_target_positions": 448, | |
| "median_filter_width": 7, | |
| "model_type": "whisper", | |
| "num_hidden_layers": 32, | |
| "num_mel_bins": 128, | |
| "pad_token_id": 50256, | |
| "qformer_config": { | |
| "_name_or_path": "", | |
| "add_cross_attention": true, | |
| "architectures": null, | |
| "attention_probs_dropout_prob": 0.1, | |
| "chunk_size_feed_forward": 0, | |
| "classifier_dropout": null, | |
| "cross_attention_freq": 1, | |
| "dtype": null, | |
| "encoder_width": 1280, | |
| "hidden_act": "gelu", | |
| "hidden_dropout_prob": 0.1, | |
| "hidden_size": 4104, | |
| "id2label": { | |
| "0": "LABEL_0", | |
| "1": "LABEL_1" | |
| }, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 12288, | |
| "is_encoder_decoder": false, | |
| "label2id": { | |
| "LABEL_0": 0, | |
| "LABEL_1": 1 | |
| }, | |
| "layer_norm_eps": 1e-12, | |
| "max_position_embeddings": 512, | |
| "model_type": "bert", | |
| "num_attention_heads": 12, | |
| "num_hidden_layers": 2, | |
| "out_hidden_size": 2560, | |
| "output_attentions": false, | |
| "output_hidden_states": false, | |
| "pad_token_id": 0, | |
| "position_embedding_type": "absolute", | |
| "problem_type": null, | |
| "query_length": 1, | |
| "return_dict": true, | |
| "type_vocab_size": 2, | |
| "use_cache": true, | |
| "vocab_size": 30522 | |
| }, | |
| "scale_embedding": false, | |
| "second_per_window": 0.1, | |
| "second_stride": 0.1, | |
| "tie_word_embeddings": true, | |
| "use_cache": true, | |
| "use_weighted_layer_sum": false, | |
| "vocab_size": 51866 | |
| } | |
| } | |