Views
No views yet
AutoModel, so you
need the code from the VLZip repository to load it.1git clone https://github.com/ShareLab-SII/VLZip.git
2cd VLZip/qwen-vl-finetune1import torch
2from model.vlzip import Qwen2_5_VL_VLZipForConditionalGeneration
3from model.processor import Qwen2_5_VL_VLZipProcessor
4
5model_path = "SII-BIU/VLZip-3B" # or a local checkpoint path
6
7processor = Qwen2_5_VL_VLZipProcessor.from_pretrained(model_path)
8model = Qwen2_5_VL_VLZipForConditionalGeneration.from_pretrained(
9 model_path,
10 torch_dtype=torch.bfloat16,
11 attn_implementation="flash_attention_2",
12 device_map="cuda",
13).eval()
14
15messages = [{
16 "role": "user",
17 "content": [
18 {"type": "image", "image": "path/to/image.jpg"},
19 {"type": "text", "text": "Describe this image."},
20 ],
21}]
22inputs = processor.apply_chat_template(
23 messages, tokenize=True, add_generation_prompt=True, return_dict=True, return_tensors="pt"
24).to(model.device)
25
26with torch.no_grad():
27 output_ids = model.generate(**inputs, max_new_tokens=256, do_sample=False)
28
29response = processor.batch_decode(
30 output_ids[:, inputs["input_ids"].shape[1]:], skip_special_tokens=True
31)[0]
32print(response)processor.encode_chunked_text.1@inproceedings{vlzip,
2 title = {VLZip: Unified Visual and Textual Compression for Interleaved Long-Context Modeling},
3 author = {Zhang, Yuqi and Chen, Cheng and Guo, Yuyu and Yang, Wenjie and Meng, Lingchen and Di, Peng and Yu, Hang and Wu, Zuxuan and Jiang, Yu-Gang},
4 booktitle = {European Conference on Computer Vision (ECCV)},
5 year = {2026}
6}