Instructions to use xupy21/ContextRL_Qwen2.5_VL_7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use xupy21/ContextRL_Qwen2.5_VL_7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="xupy21/ContextRL_Qwen2.5_VL_7B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("xupy21/ContextRL_Qwen2.5_VL_7B") model = AutoModelForMultimodalLM.from_pretrained("xupy21/ContextRL_Qwen2.5_VL_7B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use xupy21/ContextRL_Qwen2.5_VL_7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "xupy21/ContextRL_Qwen2.5_VL_7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xupy21/ContextRL_Qwen2.5_VL_7B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/xupy21/ContextRL_Qwen2.5_VL_7B
- SGLang
How to use xupy21/ContextRL_Qwen2.5_VL_7B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "xupy21/ContextRL_Qwen2.5_VL_7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xupy21/ContextRL_Qwen2.5_VL_7B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "xupy21/ContextRL_Qwen2.5_VL_7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xupy21/ContextRL_Qwen2.5_VL_7B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use xupy21/ContextRL_Qwen2.5_VL_7B with Docker Model Runner:
docker model run hf.co/xupy21/ContextRL_Qwen2.5_VL_7B
ContextRL-Qwen2.5-VL-7B
This is the multimodal model released with the paper Context-Aware RL for Agentic and Multimodal LLMs. It is fine-tuned from Qwen2.5-VL-7B-Instruct using ContextRL, a context-aware reinforcement learning method that augments standard GRPO with an auxiliary context-selection objective to improve fine-grained visual grounding.
Results
Across 12 diverse multimodal benchmarks, ContextRL improves over the standard GRPO baseline by +2.0 points on average, while improving every individual benchmark.
| Benchmark | Base | RL (GRPO) | ContextRL (Ours) |
|---|---|---|---|
| MathVista | 68.2 | 72.5 | 73.6 |
| MathVerse | 43.9 | 45.3 | 49.1 |
| MathVision | 22.8 | 25.5 | 26.8 |
| MMMU-Pro | 36.6 | 41.3 | 42.8 |
| MMMU | 50.7 | 53.3 | 54.6 |
| V* | 70.1 | 70.7 | 73.3 |
| MMStar | 62.6 | 64.1 | 65.1 |
| BLINK | 55.3 | 56.5 | 58.9 |
| ScienceQA | 88.2 | 91.0 | 95.4 |
| PhyX | 25.4 | 48.7 | 50.0 |
| OlympiadBench Phy | 1.5 | 3.1 | 4.6 |
| MME-RealWorld Lite | 38.4 | 45.1 | 46.7 |
| Overall Avg. | 47.0 | 51.4 | 53.4 |
The +2.0 average gain over GRPO also exceeds the +0.8 of PAPO, a method purpose-built for multimodal perception (see the paper for the full comparison).
Usage
This model follows the same interface as Qwen2.5-VL-7B-Instruct and can be loaded with
transformers. Training and evaluation code, data construction pipelines, and detailed
configurations are available in the repository:
👉 https://github.com/xupy2003/ContextAwareRL
Please refer to the repo's README for environment setup, inference scripts, and
reproduction instructions.
- Downloads last month
- 28
Model tree for xupy21/ContextRL_Qwen2.5_VL_7B
Base model
Qwen/Qwen2.5-VL-7B-Instruct