Image-Text-to-Text
Transformers
Safetensors
Chinese
English
qwen3_5
wemm
multimodal
e-commerce
conversational
Instructions to use tencent/WeMM-Ecom-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tencent/WeMM-Ecom-9B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="tencent/WeMM-Ecom-9B") 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, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("tencent/WeMM-Ecom-9B") model = AutoModelForMultimodalLM.from_pretrained("tencent/WeMM-Ecom-9B", 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-Ecom-9B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tencent/WeMM-Ecom-9B" # 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-Ecom-9B", "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-Ecom-9B
- SGLang
How to use tencent/WeMM-Ecom-9B 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-Ecom-9B" \ --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-Ecom-9B", "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-Ecom-9B" \ --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-Ecom-9B", "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-Ecom-9B with Docker Model Runner:
docker model run hf.co/tencent/WeMM-Ecom-9B
docs: recommend SGLang 0.5.15 or newer
Browse files
README.md
CHANGED
|
@@ -262,12 +262,21 @@ print(final_text)
|
|
| 262 |
<details>
|
| 263 |
<summary>Video Understanding</summary>
|
| 264 |
|
| 265 |
-
Install [TorchCodec](https://github.com/meta-pytorch/torchcodec#installing-torchcodec)
|
| 266 |
|
| 267 |
```bash
|
| 268 |
pip install torchcodec
|
| 269 |
```
|
| 270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 271 |
This example samples 16 frames from a product demonstration:
|
| 272 |
|
| 273 |
```python
|
|
@@ -451,13 +460,13 @@ vllm serve "$MODEL" \
|
|
| 451 |
|
| 452 |
### SGLang
|
| 453 |
|
| 454 |
-
We recommend **SGLang 0.5.
|
| 455 |
|
| 456 |
```bash
|
| 457 |
python3.11 -m venv .venv-sglang
|
| 458 |
source .venv-sglang/bin/activate
|
| 459 |
pip install -U pip uv
|
| 460 |
-
uv pip install -U "sglang>=0.5.
|
| 461 |
|
| 462 |
MODEL=tencent/WeMM-Ecom-9B
|
| 463 |
python -m sglang.launch_server \
|
|
@@ -470,6 +479,20 @@ python -m sglang.launch_server \
|
|
| 470 |
--port 8000
|
| 471 |
```
|
| 472 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 473 |
### OpenAI-compatible API
|
| 474 |
|
| 475 |
Install the client where you send requests:
|
|
|
|
| 262 |
<details>
|
| 263 |
<summary>Video Understanding</summary>
|
| 264 |
|
| 265 |
+
Install a TorchCodec build compatible with your PyTorch installation, and make its supported FFmpeg shared libraries available in the same environment. Follow the [TorchCodec installation guide and compatibility table](https://github.com/meta-pytorch/torchcodec#installing-torchcodec).
|
| 266 |
|
| 267 |
```bash
|
| 268 |
pip install torchcodec
|
| 269 |
```
|
| 270 |
|
| 271 |
+
Check the decoder with your local clip before running the example:
|
| 272 |
+
|
| 273 |
+
```python
|
| 274 |
+
from torchcodec.decoders import VideoDecoder
|
| 275 |
+
|
| 276 |
+
decoder = VideoDecoder("./product_demo.mp4", device="cpu")
|
| 277 |
+
print(len(decoder), decoder[0].shape)
|
| 278 |
+
```
|
| 279 |
+
|
| 280 |
This example samples 16 frames from a product demonstration:
|
| 281 |
|
| 282 |
```python
|
|
|
|
| 460 |
|
| 461 |
### SGLang
|
| 462 |
|
| 463 |
+
We recommend **SGLang 0.5.15 or newer**. Use a fresh environment with matching CUDA/PyTorch builds of SGLang and its kernel dependencies, following the [SGLang installation guide](https://docs.sglang.io/docs/get-started/install.md).
|
| 464 |
|
| 465 |
```bash
|
| 466 |
python3.11 -m venv .venv-sglang
|
| 467 |
source .venv-sglang/bin/activate
|
| 468 |
pip install -U pip uv
|
| 469 |
+
uv pip install -U "sglang>=0.5.15" openai decord
|
| 470 |
|
| 471 |
MODEL=tencent/WeMM-Ecom-9B
|
| 472 |
python -m sglang.launch_server \
|
|
|
|
| 479 |
--port 8000
|
| 480 |
```
|
| 481 |
|
| 482 |
+
<details>
|
| 483 |
+
<summary>CUDA 12.9 environment setup</summary>
|
| 484 |
+
|
| 485 |
+
For **Linux x86_64 with SGLang 0.5.15 and PyTorch 2.11.0+cu129**, follow the [CUDA 12.9 override in SGLang's Dockerfile](https://github.com/sgl-project/sglang/blob/v0.5.15/docker/Dockerfile#L228-L234). If an incompatible DeepGEMM build produces an import error mentioning `libcudart.so.13`, install the matching CUDA 12.9 wheel in the activated environment:
|
| 486 |
+
|
| 487 |
+
```bash
|
| 488 |
+
python -m pip install --no-deps --force-reinstall \
|
| 489 |
+
"https://github.com/sgl-project/whl/releases/download/v0.1.4/sgl_deep_gemm-0.1.4+cu129-py3-none-manylinux2014_x86_64.whl"
|
| 490 |
+
```
|
| 491 |
+
|
| 492 |
+
For other SGLang, PyTorch, or CUDA versions, select the corresponding builds from the [official installation guide](https://docs.sglang.io/docs/get-started/install.md).
|
| 493 |
+
|
| 494 |
+
</details>
|
| 495 |
+
|
| 496 |
### OpenAI-compatible API
|
| 497 |
|
| 498 |
Install the client where you send requests:
|