Views
No views yet
1from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
2from qwen_vl_utils import process_vision_info
3
4model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
5 "qwangcv/VDC-Agent-7B", torch_dtype="auto", device_map="auto"
6)
7processor = AutoProcessor.from_pretrained("qwangcv/VDC-Agent-7B")
8
9messages = [
10 {
11 "role": "user",
12 "content": [
13 {
14 "type": "video",
15 "video": "file:///path/to/video.mp4",
16 },
17 {"type": "text", "text": "Describe the video in detail."},
18 ],
19 }
20]
21
22text = processor.apply_chat_template(
23 messages, tokenize=False, add_generation_prompt=True
24)
25image_inputs, video_inputs = process_vision_info(messages)
26inputs = processor(
27 text=[text],
28 images=image_inputs,
29 videos=video_inputs,
30 padding=True,
31 return_tensors="pt",
32)
33inputs = inputs.to(model.device)
34
35generated_ids = model.generate(**inputs, max_new_tokens=1024)
36generated_ids_trimmed = [
37 out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
38]
39output_text = processor.batch_decode(
40 generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
41)
42print(output_text[0])1@article{vdcagent,
2 title={VDC-Agent: When Video Detailed Captioners Evolve Themselves via Agentic Self-Reflection},
3 author={Wang, Qiang and Gao, Xinyuan and He, Yuhang and Han, Jizhou and Li, Jiangyang and Dong, Songlin and Ma, Zhiheng and Gong, Yihong},
4 journal={arXiv preprint arXiv:2511.19436},
5 year={2025}
6}