Views
No views yet
1pip install "transformers>=4.43" peft "accelerate>=0.25" pillow qwen-vl-utils torch
2export HF_TOKEN=hf_********************************1import torch
2from transformers import AutoProcessor, Qwen2_5_VLForConditionalGeneration
3from peft import PeftModel
4
5BASE = "Qwen/Qwen2.5-VL-7B-Instruct"
6LORA_REPO = "omkarthawakar/EvoLMM"
7SUBFOLDER = "solver"
8DTYPE = torch.bfloat16
9
10# Loading base model
11model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
12 BASE, device_map="auto", torch_dtype=DTYPE
13)
14
15# Attachng LoRA
16model = PeftModel.from_pretrained(
17 model,
18 LORA_REPO,
19 subfolder=SUBFOLDER,
20 token=None,
21 use_safetensors=True,
22)
23
24processor = AutoProcessor.from_pretrained(BASE)
25model.eval()1from qwen_vl_utils import process_vision_info
2from PIL import Image
3
4msg = [
5 {"role": "system", "content": "You are a helpful assistant."},
6 {"role": "user", "content": [
7 {"type": "image", "image": Image.open("./assets/demo.png").convert("RGB")},
8 {"type": "text", "text": "What is the main object in this image?"}
9 ]},
10]
11
12text = processor.apply_chat_template(msg, tokenize=False, add_generation_prompt=True)
13image_inputs, video_inputs = process_vision_info([msg])
14
15inputs = processor(
16 text=[text], images=image_inputs, videos=video_inputs,
17 padding=True, return_tensors="pt"
18).to(model.device)
19
20out = model.generate(**inputs, max_new_tokens=512, do_sample=False)
21gen_only = out[0, inputs.input_ids.shape[1]:]
22print(processor.tokenizer.decode(gen_only, skip_special_tokens=True).strip())Qwen/Qwen2.5-VL-7B-Instruct. Ensure your usage complies with third-party terms.1@misc{thawakar2025evolmmselfevolvinglargemultimodal,
2 title={EvoLMM: Self-Evolving Large Multimodal Models with Continuous Rewards},
3 author={Omkar Thawakar and Shravan Venkatraman and Ritesh Thawkar and Abdelrahman Shaker and Hisham Cholakkal and Rao Muhammad Anwer and Salman Khan and Fahad Khan},
4 year={2025},
5 eprint={2511.16672},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV},
8 url={https://arxiv.org/abs/2511.16672},
9}