From: BAAI <huggingface.co/BAAI>Newsgroups: alt.freeweights.textSubject:

Video-XL-2

Date: 2026-11-15Commit: 107a6ebSigned: 2DC28CC7B26A283B ✓

Video text to text model with 8.1B parameters. Safetensors weights, 16.3 GB in all. Published by BAAI under Apache-2.0.

8.1B params16.3GBVideo-XL-2safetensorspermissive
FactsParams8.1BSize16.3 GBFormatssafetensorsTaskvideo text to textLicenseApache-2.0From sourcepermissive
$ fw get BAAI/Video-XL-2
# manifest sha256 3b7ec8ce4bad… · 16.3 GB · 27 files
$ fw verify ./Video-XL-2 BAAI/Video-XL-2
From sourceHosted (signed)BAAI/Video-XL-2Last check: 2026-11-15 03:40 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Works with

Runs with

Ranked by fit to this model (safetensors), then by GitHub stars.

Overview

Size
16.3 GB
Weights
16.3 GB (safetensors)
Parameters
8.1B
Formats
safetensors
Task
video text to text
License
Apache-2.0 (permissive)
Files
27, each with a sha256
Publisher
BAAI
Added
2026-11-15
Section
alt.freeweights.text
Lineage

Original release from the publisher.

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-15 03:40 UTCpassed

Model card

From the publisher at commit 107a6eb. Shown as plain text with links; images open at the publisher.

Video-XL-2#

[\[📰 Blog\]](https://unabletousegit.github.io/video-xl2.github.io/) [\[📂 GitHub\]](https://github.com/VectorSpaceLab/Video-XL) [\[📜 Tech Report(comming soon)\]]()

How to use the model#

Video-XL-2 supply two efficiency optimization strategy: chunk-based prefill and bi-level kvs decoding. You can flexibly choose them based on your needs.

TODO

  • [X] Release model weights.
  • [X] Release the inference code w/o. efficiency optimization.
  • [X] Release the inference code w. chunk-based prefill.
  • [ ] Release the inference code w. chunk-based prefill & bi-level kvs decoding.

**Tips: Our inference code still under updating, you could update it by assign "--include '\.py'" in huggingface-cli to only update the inference code, avoid downloading the whole model.


0. Installing Required Packages#
pip install transformers==4.43.0
pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu121
pip install decord
pip install einops
pip install opencv-python
pip install accelerate==0.30.0
pip install numpy==1.26.4
# optional
pip install flash-attn --no-build-isolation

1. Inference w/o. Efficiency Optimization#
from transformers import AutoTokenizer, AutoModel, AutoConfig, BitsAndBytesConfig, AutoModelForCausalLM
import torch

# load model 
model_path = '/root/Models/Video-XL-2'
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
device = 'cuda' if torch.cuda.is_available() else 'cpu'
model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True, device_map=device,quantization_config=None, attn_implementation="sdpa", torch_dtype=torch.float16, low_cpu_mem_usage=True)

gen_kwargs = {
    "do_sample": False,
    "temperature": 0.01,
    "top_p": 0.001,
    "num_beams": 1,
    "use_cache": True,
    "max_new_tokens": 256
}

model.config.enable_sparse = False

# input data
video_path = "/asset/demo.mp4"
question1 = "How many people in the video? (A)3 people (B)6 people. Please only respone the letter"

# params
max_num_frames = 150
sample_fps = 1  # extract frame at 1fps
max_sample_fps = 4

with torch.inference_mode():
    response = model.chat(video_path, tokenizer, question1, chat_history=None, return_history=False,max_num_frames=max_num_frames, sample_fps=sample_fps, max_sample_fps=max_sample_fps, generation_config=gen_kwargs)
    
print(response)

2. Inference w. Chunk-based Pre-filling#

Chunk-based prefill significantly reduces memory demands and response latency by encoding video input in a streaming manner. This advantage becomes particularly noticeable with longer videos.

To enable this mode, you need to set enable_chunk_prefill to True and configure the prefill_config parameters:

  • chunk_prefill_mode: This defines the mode of chunk-based prefill. We currently support two modes:
    • streaming: This mode encodes video chunks streamingly.
    • mask: This mode achieves an equivalent effect using an attention mask. However, due to a lack of underlying optimized operators, the mask mode doesn't offer any efficiency improvements at this time. We recommend using the streaming mode.
  • chunk_size: This parameter specifies the size of each chunk processed in a single forward pass. The unit for chunk_size is 4 frames (e.g., chunk_size = 4 means processing visual tokens from 4×4 = 16 frames at once). A larger chunk_size will gradually approach full attention, resulting in a higher peak memory usage.
  • step_size: This controls the step size between chunks. A smaller step_size leads to more continuous information transfer between chunks but may slightly decrease inference speed.
  • offload: This boolean parameter determines whether to offload the key-value states (KVs) of each chunk to the CPU during forwarding. While this can reduce memory usage, it will also lower the inference speed.
  • chunk_size_for_vision_tower: For longer video inputs, the vision tower can become a memory bottleneck during forwarding. To mitigate this, we also support a streaming mode for the vision tower, which is controlled by this parameter. The unit for chunk_size_for_vision_tower is 1 frames. And, the value of chunk_size_for_vision_tower must be a multiple of 4.

**Tip: Currently, chunk-based prefill only supports the 'sdpa' attention implementation.*

from transformers import AutoTokenizer, AutoModel, AutoConfig, BitsAndBytesConfig, AutoModelForCausalLM
import torch
import pdb
import argparse

torch.cuda.reset_peak_memory_stats()
# load model 
model_path = '/root/Models/Video-XL-2'
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
device = 'cuda:0' if torch.cuda.is_available() else 'cpu'
model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True, device_map=device,quantization_config=None, attn_implementation="sdpa", torch_dtype=torch.float16, low_cpu_mem_usage=True) # sdpa

gen_kwargs = {"do_sample": False, "temperature": 0.01, "top_p": 0.001, "num_beams": 1, "use_cache": True, "max_new_tokens": 128}

model.config.enable_chunk_prefill = True
prefill_config = {
    'chunk_prefill_mode': 'streaming',
    'chunk_size': 4,
    'step_size': 1,
    'offload': True,
    'chunk_size_for_vision_tower': 24,
}
model.config.prefill_config = prefill_config

# input data
video_path = "/asset/demo.mp4"
question1 = "How many people in the video? (A)3 people (B)6 people. Please only respone the letter"

# params
max_num_frames = 1300
sample_fps = None  # uniform sampling
max_sample_fps = None

with torch.inference_mode():
    response = model.chat(video_path, tokenizer, question1, chat_history=None, return_history=False,max_num_frames=max_num_frames, sample_fps=sample_fps, max_sample_fps=max_sample_fps, generation_config=gen_kwargs)
    

peak_memory_allocated = torch.cuda.max_memory_allocated()
print(f"Memory Peak: {peak_memory_allocated / (1024**3):.2f} GB")
print(response)

3. Inference w. Chunk-based Pre-filling & Bi-level KVs Decoding#

coming soon

✏️ Citation#

@article{shu2024video,
  title={Video-XL: Extra-Long Vision Language Model for Hour-Scale Video Understanding},
  author={Shu, Yan and Zhang, Peitian and Liu, Zheng and Qin, Minghao and Zhou, Junjie and Huang, Tiejun and Zhao, Bo},
  journal={arXiv preprint arXiv:2409.14485},
  year={2024}
}

@article{liu2025video,
  title={Video-XL-Pro: Reconstructive Token Compression for Extremely Long Video Understanding},
  author={Liu, Xiangrui and Shu, Yan and Liu, Zheng and Li, Ao and Tian, Yang and Zhao, Bo},
  journal={arXiv preprint arXiv:2503.18478},
  year={2025}
}

Files

27 files · 16.3 GBWeights 16.3 GB (safetensors). Sizes and sha256 from the signed manifest.
Show all 27 files with their sha256
FileSizesha256
.gitattributes1.52 KB11ad7efa24975ee4b0c3c3a38ed18737f0658a5f75a0a96787b576a78a023361
README.md6.98 KB29a8e4f86b78e0ae1ee30c3b55a920e16c6e9101b63864443f9c2d148729aec5
added_tokens.json605 B58b54bbe36fc752f79a24a271ef66a0a0830054b4dfad94bde757d851968060b
config.json3.15 KB184677ded00714554b32369f766df09461c14285d3aa911464cd7ea2b3ff5c9f
constants.py293 B2c5a8a659b3c5c1c70360808ae901511db67da8fbe331e1329cd754f6f3a0879
conversation.py21.2 KB494422a9f0f22f1330996689b494a54af2fef2c3aaf13da594288dfa6afd475f
generation_config.json243 Bfb39aa05679679b858a36ac4853858b183b6e309b9ff94b4efea9e371a1fb1eb
llava_qwen.py69.3 KB5c19f8a7e7b82a9364b7593fa2a93a8401fb635e27570b9afd5aae63c17ce6af
merges.txt1.67 MB8831e4f1a044471340f7c0a83d7bd71306a5b867e95fd870f74d0c5308a904d5
mm_utils.py19.8 KB072aa379d6674ba1814d70023a839a3ab68e8fd0856c4fb910818ee33bf5a2b4
model-00001-of-00004.safetensors4.88 GB7b298da21333b109f649f8790f14e7ac6f25a2970c4cc32744c5225ee593f615
model-00002-of-00004.safetensors4.93 GBe9c82ed27d8370f418104ed3c49dcb60daeda4bee670727faaabd79e81b6526e
model-00003-of-00004.safetensors4.99 GBc9a43d330abca34089d2f9a3fa80052a99de6753f0a445dfc50f1db034801fde
model-00004-of-00004.safetensors1.47 GBfec7d9d9ba934168967a4b8adf5ca50dd8759ceca57a5634b468961a186d54a3
model.safetensors.index.json84.0 KB6747e2b39533b610189ea2022e1dc31b51e0389403c396ece073f58c0ab45858
modeling_qwen2.py72.4 KBc27de791aac1d343d83b94273b7ea287e0d0466525d629d0724de5836147c375
sae.py48.6 KBad3acf9275f32da8da43fec0a7874dd82f6a3db5eb3d1562d50891b0967cb810
special_tokens_map.json613 B76862e765266b85aa9459767e33cbaf13970f327a0e88d1c65846c2ddd3a1ecd
tokenizer.json7.03 MBa8506e7111b80c6d8635951a02eab0f4e1a8e4e5772da83846579e97b16f61bf
tokenizer_config.json7.33 KB959dd336b1964ef9861f05ff419906b6e96882273a780abef42d3ba192b3e0c7
trainer_state.json4.16 MB60393cd5bbed06f42c5711e9dcb2d21d61a0651b8b67e4fae10fac435b2f47d9
training_args.bin7.16 KB597bea5a31c49cd9c61db90830590fee60c5e0a7ed0b1590169dc7bd0615d2bf
utils.py5.42 KBa3aa651fa22090df43f96f50246607b1b8861de6b4aa4e74436f66c9006eaa89
vision_projector_builder.py2.99 KBcbf4d5fae9a155030550ef1257831007927db7063907fe98f354fd00233f5c6d
vision_resampler_builder.py2.32 KB5ebe2e03c56a9f08f7b3698e930dbb57525d6626727dc91d8221178ce54baa72
vision_tower_builder.py8.66 KBb18b646174955bc5c618f39a0357dd78504b43c12f56cfb528bd5a95e0077f9a
vocab.json2.78 MBca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
107a6ebaf3 pinned now2026-11-15 03:40 UTC27 files · 16.3 GB

Use it

$ fw get BAAI/Video-XL-2
# manifest sha256 3b7ec8ce4bad… · 16.3 GB · 27 files
$ fw verify ./Video-XL-2 BAAI/Video-XL-2
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/BAAI/Video-XL-2.json --dir ./Video-XL-2 $ python3 fw.py verify ./Video-XL-2 ./BAAI__Video-XL-2.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download BAAI/Video-XL-2 --revision 107a6ebaf32becf8abc73b6ada9cb68a27384be1 --local-dir ./Video-XL-2

License

Name
Apache License 2.0
Id
Apache-2.0
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-15
Text in
README.md
Text sha256
29a8e4f86b78e0ae1ee30c3b55a920e16c6e9101b63864443f9c2d148729aec5
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: BAAI <huggingface.co/BAAI>Newsgroups: alt.freeweights.textSubject: Video-XL-2Date: 2026-11-15Commit: 107a6ebSigned: 2DC28CC7B26A283B ✓
Upstream
BAAI/Video-XL-2
Pinned commit
107a6ebaf32becf8abc73b6ada9cb68a27384be1
Manifest
Video-XL-2.json · .minisig
Manifest sha256
3b7ec8ce4badc21f52846f90b16f8e8bbb69206eccf5ff1c9e6fbd881fef9934
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-15 03:40 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/BAAI/Video-XL-2.json $ curl -O https://freeweights.allternit.com/manifests/BAAI/Video-XL-2.json.minisig $ minisign -Vm Video-XL-2.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

No related models in this catalog.Nothing here lists this model as its parent, and it names no parent.
Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download BAAI/Video-XL-2
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. Video-XL-2.json. Provenance. Takedown history: none.
From: laion <huggingface.co/laion>Subject: a2-rl-e2egit_large-50-32B
From: laion <huggingface.co/laion>Subject: a3-rl-DCAgent_exp_rpt_e2egit-large-15-8B
From: laion <huggingface.co/laion>Subject: a3-rl-DCAgent_exp_rpt_e2egit-v2-10-8B
From: laion <huggingface.co/laion>Subject: a3-rl-DCAgent_exp_rpt_pymethods2test-large-80-8B
From: laion <huggingface.co/laion>Subject: a3-rl-DCAgent_exp_rpt_unitsyn-python-large-10-8B
From: laion <huggingface.co/laion>Subject: a3-rl-DCAgent_mix_h2_language_proportional-65-8B