Video-Text-to-Text
Transformers
Safetensors
English
Chinese
moss_vl
feature-extraction
MOSS-VL
image-understanding
video-understanding
FP8
compressed-tensors
quantized
SGLang
custom_code
Instructions to use OpenMOSS-Team/MOSS-VL-Instruct-0708-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenMOSS-Team/MOSS-VL-Instruct-0708-FP8 with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("OpenMOSS-Team/MOSS-VL-Instruct-0708-FP8", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 6,397 Bytes
44eff6f ace4683 44eff6f ace4683 f73d006 19eba05 13e9412 19eba05 ace4683 cf49f73 19eba05 cf49f73 ace4683 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | ---
license: apache-2.0
language:
- en
- zh
library_name: transformers
pipeline_tag: video-text-to-text
base_model: OpenMOSS-Team/MOSS-VL-Instruct-0708
tags:
- MOSS-VL
- image-understanding
- video-understanding
- FP8
- compressed-tensors
- quantized
- SGLang
- custom_code
---
<p align="center">
<img src="assets/logo.png" width="300" alt="MOSS-VL"/>
</p>
<p align="center">
English | <a href="https://huggingface.co/OpenMOSS-Team/MOSS-VL-Instruct-0708-FP8/blob/main/README_zh.md">中文</a>
</p>
# MOSS-VL-Instruct-0708 FP8 Dynamic + Transformers KV8
This is the 24 GiB quantized release of MOSS-VL-Instruct-0708. The same
checkpoint directory is supported by both the standard Transformers inference
path and the native SGLang MOSS-VL backend.
## Quantization profile
| Component | Format |
| --- | --- |
| Most language layers | FP8 weights + per-token dynamic FP8 input activations |
| Cross-attention, vision modules and `lm_head` | BF16 |
| Transformers KV cache | HQQ INT8 |
| SGLang KV cache | Native SGLang BF16 cache |
The FP8 weights are shared across both engines. Transformers reads the HQQ KV8
configuration from `generation_config.json`; SGLang loads the same weights with
`model_impl=sglang` and uses its own cache implementation.
## Quantization benchmark
Across the selected benchmarks, the quantized models remain close to their
non-quantized BF16 counterparts, showing that overall model quality is largely
preserved after quantization.
<p align="center">
<img src="assets/mossvl_quantization_benchmark_comparison_en_4k.png" alt="MOSS-VL quantization benchmark comparison" width="100%"/>
</p>
## Hardware requirements
The model is designed to run with the Transformers inference path on a single
NVIDIA GPU with 24 GB of VRAM. SGLang memory requirements depend on its server
configuration and KV cache allocation.
## Transformers environment
### Installation
Start from the standard MOSS-VL release environment, then install the FP8
checkpoint loader and HQQ cache backend:
```bash
git clone https://github.com/OpenMOSS/MOSS-VL.git
cd MOSS-VL
conda create -n moss_vl_quant python=3.12 pip -y
conda activate moss_vl_quant
pip install -i https://pypi.org/simple --no-build-isolation -r requirements.txt
pip install -i https://pypi.org/simple \
compressed-tensors==0.14.0 \
hqq==0.2.8.post1
python -m pip check
```
Core versions used by the standard Transformers path:
| Package | Version |
| --- | --- |
| Python | 3.12 |
| PyTorch | 2.8.0 + CUDA 12.8 |
| Transformers | 4.57.1 |
| Accelerate | 1.12.0 |
| FlashAttention | 2.8.1 |
| compressed-tensors checkpoint format | 0.14.0 |
| HQQ | 0.2.8.post1 |
Video decoding also requires FFmpeg to be available in `PATH`.
### Load the model
```python
import torch
from transformers import AutoModelForCausalLM, AutoProcessor
checkpoint = "/path/to/MOSS-VL-0708-Instruct-FP8-Dynamic-KV8-HQQ"
processor = AutoProcessor.from_pretrained(
checkpoint,
trust_remote_code=True,
frame_extract_num_threads=1,
)
model = AutoModelForCausalLM.from_pretrained(
checkpoint,
trust_remote_code=True,
device_map="auto",
torch_dtype=torch.bfloat16,
attn_implementation="flash_attention_2",
)
model.eval()
```
`generation_config.json` enables HQQ KV8 automatically. Keep that file beside
the checkpoint and do not pass a conflicting cache configuration.
### Image inference
```python
text = model.offline_image_generate(
processor,
prompt="Describe this image.",
image="data/example_image.jpg",
shortest_edge=4096,
longest_edge=16777216,
multi_image_max_pixels=201326592,
patch_size=16,
temporal_patch_size=1,
merge_size=2,
image_mean=[0.5, 0.5, 0.5],
image_std=[0.5, 0.5, 0.5],
max_new_tokens=256,
temperature=1.0,
top_k=50,
top_p=1.0,
repetition_penalty=1.0,
do_sample=False,
vision_chunked_length=64,
)
print(text)
```
### Video inference
```python
text = model.offline_video_generate(
processor,
prompt="Describe this video.",
video="data/example_video.mp4",
shortest_edge=4096,
longest_edge=16777216,
video_max_pixels=201326592,
patch_size=16,
temporal_patch_size=1,
merge_size=2,
video_fps=1.0,
min_frames=1,
max_frames=256,
num_extract_threads=4,
image_mean=[0.5, 0.5, 0.5],
image_std=[0.5, 0.5, 0.5],
max_new_tokens=256,
temperature=1.0,
top_k=50,
top_p=1.0,
repetition_penalty=1.0,
do_sample=False,
vision_chunked_length=64,
)
print(text)
```
### Repository inference runner
The standard repository runner accepts JSON/JSONL queries with image or video
content and loads this directory directly:
```bash
python inference/run_inference.py \
--checkpoint /path/to/MOSS-VL-0708-Instruct-FP8-Dynamic-KV8-HQQ \
--mode offline \
--input inference/video_queries.json \
--output video_results.json
```
## SGLang environment
Use a separate environment for SGLang. The native backend in the
`mossvl_sglang` release directory pins:
| Package | Version |
| --- | --- |
| Python | 3.12.8 |
| SGLang | 0.5.11 |
| sglang-kernel | 0.4.2 |
| PyTorch | 2.11.0 + CUDA 13.0 |
| Transformers | 5.6.0 |
| compressed-tensors | 0.17.1 |
Create the environment from its complete lock file:
```bash
cd /path/to/mossvl_sglang
env -u INDEX_URL -u PIP_INDEX_URL conda create -y -n mossvl-sglang-0511 \
--override-channels \
-c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main \
python=3.12.8 pip=24.2
conda activate mossvl-sglang-0511
env -u INDEX_URL -u PIP_INDEX_URL python -m pip install -r requirements.txt
python -m pip check
```
Start the OpenAI-compatible service with the quantized directory as the model
path:
```bash
conda activate mossvl-sglang-0511
cd /path/to/mossvl_sglang
GPU_IDS=0 TP_SIZE=1 MEM_FRACTION_STATIC=0.35 \
./start_sglang_moss_vl.sh \
--model-path /path/to/MOSS-VL-0708-Instruct-FP8-Dynamic-KV8-HQQ
```
The service listens on `http://127.0.0.1:30000` by default. Keep
`MODEL_IMPL=sglang`; do not force the Transformers remote implementation.
SGLang intentionally uses its native BF16 KV cache rather than the HQQ cache in
`generation_config.json`.
## Configuration files
- `config.json`: model and FP8 weight/activation configuration.
- `generation_config.json`: Transformers HQQ KV8 configuration.
- `modeling_moss_vl.py`: checkpoint-local cross-attention/QuantizedCache code.
|