Run this model with HF Jobs
Run gsarch/ViGoRL-3b-Spatial on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/gsarch/ViGoRL-3b-Spatial. Ask me which dataset to train on, then push the LoRA adapter to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs and Transformers to run batch inference with https://huggingface.co/gsarch/ViGoRL-3b-Spatial on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the predictions back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs and Lighteval to evaluate https://huggingface.co/gsarch/ViGoRL-3b-Spatial. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/gsarch/ViGoRL-3b-Spatial with Transformers and bitsandbytes. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use gsarch/ViGoRL-3b-Spatial with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gsarch/ViGoRL-3b-Spatial with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="gsarch/ViGoRL-3b-Spatial") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("gsarch/ViGoRL-3b-Spatial") model = AutoModelForMultimodalLM.from_pretrained("gsarch/ViGoRL-3b-Spatial", device_map="auto") 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use gsarch/ViGoRL-3b-Spatial with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gsarch/ViGoRL-3b-Spatial" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gsarch/ViGoRL-3b-Spatial", "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/gsarch/ViGoRL-3b-Spatial
- SGLang
How to use gsarch/ViGoRL-3b-Spatial 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 "gsarch/ViGoRL-3b-Spatial" \ --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": "gsarch/ViGoRL-3b-Spatial", "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 "gsarch/ViGoRL-3b-Spatial" \ --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": "gsarch/ViGoRL-3b-Spatial", "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 gsarch/ViGoRL-3b-Spatial with Docker Model Runner:
docker model run hf.co/gsarch/ViGoRL-3b-Spatial
Update README.md
Browse files123# ViGoRL-3b-SpatialCheckpoint for **ViGoRL** trained on *spatial* domain. Uploaded automatically from `/data/group_data/katefgroup/datasets/vigorl_datasets/checkpoints/spatial/ViGoRL-3b-Spatial`.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138# ViGoRL: Visually Grounded Reinforcement Learning for Visual ReasoningThis model card describes the ViGoRL (**Vi**sually **G**r**o**unded **R**einforcement **L**earning) model, introduced in our paper ["Grounded Reinforcement Learning for Visual Reasoning"](https://arxiv.org/abs/2505.23678).**Authors:** Gabriel Sarch, Snigdha Saha, Naitik Khandelwal, Ayush Jain, Michael J. Tarr, Aviral Kumar, Katerina Fragkiadaki---## Model OverviewViGoRL is a vision-language model fine-tuned using reinforcement learning (RL) to explicitly anchor textual reasoning steps to visual coordinates. Inspired by human visual cognition, ViGoRL employs multi-turn visual grounding, dynamically zooming into image regions to perform fine-grained visual reasoning and grounding.This model was trained using supervised fine-tuning (SFT) on visually-grounded reasoning traces generated via Monte Carlo Tree Search (MCTS), followed by reinforcement learning with Group Relative Policy Optimization (GRPO).---## Model Details* **Base Architecture:** Qwen2.5-Vision-Language (3B or 7B parameters)* **Training Paradigm:*** Supervised Fine-Tuning on MCTS-generated reasoning traces* Group Relative Policy Optimization (GRPO)* Multi-turn visual grounding with dynamic zoom-in feedback (if "Multiturn" appears in name)---## Use CasesThis model excels in visual reasoning tasks that require precise visual grounding and region-level reasoning. Please see model name for specific domain.* **Spatial Reasoning:** SAT-2, BLINK, RoboSpatial* **Visual Search:** V\*Bench* **Web Interaction and Grounding:** ScreenSpot (Pro and V2), VisualWebArena---## UsageYou can load this model easily using Hugging Face's Transformers library:```pythonfrom transformers import Qwen2_5_VLForConditionalGeneration, AutoTokenizer, AutoProcessorfrom qwen_vl_utils import process_vision_infoimport torch# # default: Load the model on the available device(s)# model = Qwen2_5_VLForConditionalGeneration.from_pretrained(# "", torch_dtype="auto", device_map="auto"# ) # replace with any of the ViGoRL models# We recommend enabling flash_attention_2 for better acceleration and memory saving.model = Qwen2_5_VLForConditionalGeneration.from_pretrained("",torch_dtype=torch.bfloat16,attn_implementation="flash_attention_2",device_map="auto",)# default processerprocessor = AutoProcessor.from_pretrained("")# The default range for the number of visual tokens per image in the model is 4-16384.# You can set min_pixels and max_pixels according to your needs, such as a token range of 256-1280, to balance performance and cost.# min_pixels = 256*28*28# max_pixels = 1280*28*28# processor = AutoProcessor.from_pretrained("", min_pixels=min_pixels, max_pixels=max_pixels)messages = [{"role": "user","content": [{"type": "image","image": "path/to/image.png",},{"type": "text", "text": "QUERY HERE"},],}]# Preparation for inferencetext = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)image_inputs, video_inputs = process_vision_info(messages)inputs = processor(text=[text],images=image_inputs,videos=video_inputs,padding=True,return_tensors="pt",)inputs = inputs.to("cuda")# Inference: Generation of the outputgenerated_ids = model.generate(**inputs, max_new_tokens=512)generated_ids_trimmed = [out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)]output_text = processor.batch_decode(generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False)print(output_text) # this will output a single tool call turn of the model if version is multiturn.```**Important**: This model requires a system prompt for proper usage. Please see the model's chat template for details.---## Datasets and Training DataTraining datasets and generated reasoning chains are publicly available:* [Code](https://github.com/Gabesarch/grounded-rl)* [ViGoRL Datasets on Hugging Face](https://huggingface.co/datasets/gsarch/vigorl_datasets)---## CitationIf you use ViGoRL in your research or applications, please cite our paper:```bibtex@article{sarch2025vigorl,title={Grounded Reinforcement Learning for Visual Reasoning},author={Sarch, Gabriel and Saha, Snigdha and Khandelwal, Naitik and Jain, Ayush and Tarr, Michael J and Kumar, Aviral and Fragkiadaki, Katerina},year={2025}}```---## ContactFor questions, feedback, or collaborations, please reach out to Gabriel Sarch or open an issue in our [GitHub repository](https://github.com/Gabesarch/grounded-rl).---
README.md+137-2