Instructions to use OneThink/OneThinker-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OneThink/OneThinker-8B with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("OneThink/OneThinker-8B") model = AutoModelForMultimodalLM.from_pretrained("OneThink/OneThinker-8B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files10 unmodified lines1112131415161718192021222324252 unmodified lines28293031323334353637383940414243444546474849505152535455565758596 unmodified lines6667686970717223 unmodified lines9697989910010110213 unmodified lines1161171181191201211229 unmodified lines13213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628710 unmodified linesThis repository contains the model presented in: [OneThinker: All-in-one Reasoning Model for Image and Video](https://huggingface.co/papers/2512.03043)**Project Page**: https://github.com/tulerfeng/OneThinker**Code**: https://github.com/tulerfeng/OneThinker## 👀 About OneThinker<div align="center"><img src="https://huggingface.co/datasets/OneThink/OneThinker-8B/resolve/main/assets/teaser.png" alt="Descriptive alt text" width="95%"></div>We introduce **OneThinker**, an all-in-one multimodal reasoning generalist that is **capable of thinking across a wide range of fundamental visual tasks within a single model**.We construct the large-scale **OneThinker-600k** multi-task training corpus and build **OneThinker-SFT-340k** with high-quality CoT annotations for cold-start SFT. Moreover, we propose **EMA-GRPO**, a new RL method that **balances heterogeneous reward signals across diverse visual tasks**, via simply tracking task-wise moving averages of reward std.2 unmodified linesAll code, models, and data are fully released.## 🔥 News- [2025/12/03] We release the code, model, data of OneThinker## 📍 Features+ Support Qwen3-VL Training+ Support Image-Video mixed training+ Support reward types in diverse visual tasks+ Provide full pipeline (dataset, SFT training, RL training, evaluation, etc)## 🔍 DatasetOur dataset covers both image and video modalities and spans a series of fundamental visual reasoning tasks, including rule-based QA, open-ended QA, captioning, spatial grounding, temporal grounding, spatio-temporal grounding, tracking, and segmentation<div align="center"><img src="https://huggingface.co/datasets/OneThink/OneThinker-8B/resolve/main/assets/dataset.png" alt="Descriptive alt text" width="90%"></div>To enable effective SFT initialization for reasoning, we leverage a strong proprietary model, Seed1.5-VL to produce CoT annotations.## 🏆 PerformanceOur model obtains significant performance gains after training based on Qwen3-VL-Instruct-8B across diverse visual tasks. For examle, OneThinker-8B reaches 70.6% accuracy on MMMU, 64.3% on MathVerse, 66.2% on VideoMMMU, 93.7 on Refcoco-testA, 54.9 J&F on ReasonVOS.<div align="center"><img src="https://huggingface.co/datasets/OneThink/OneThinker-8B/resolve/main/assets/performance.png" alt="Descriptive alt text" width="90%"></div>Besides, we also observe beneficial cross-task and cross-modality knowledge transfer, along with promising preliminary zero-shot generalization under unified training. This highlights the effectiveness and generalization ability of our unified training framework across diverse visual tasks.6 unmodified lines<summary>Demo 1 (QA)</summary><div align="center"><img src="https://huggingface.co/datasets/OneThink/OneThinker-8B/resolve/main/assets/math.png" width="36%"></div>**Question:**23 unmodified lines<summary>Demo 2 (Tracking)</summary><div align="center"><img src="https://huggingface.co/datasets/OneThink/OneThinker-8B/resolve/main/assets/got_car.gif" width="60%"></div>**Question:**13 unmodified lines<summary>Demo 3 (Segmentation)</summary><div align="center"><img src="https://huggingface.co/datasets/OneThink/OneThinker-8B/resolve/main/assets/lalaland.gif" width="60%"></div>**Question:**9 unmodified lines</details>## 🚀 Quick Start (Inference)Here's a simple example to run inference with the OneThinker model using the Hugging Face `transformers` library:```pythonimport numpy as npimport torchfrom PIL import Imagefrom transformers import AutoProcessor, AutoModelForCausalLM# Load model and processormodel_id = "OneThink/OneThinker-8B" # This modelprocessor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True).eval()# Example 1: Image QAprint("--- Image QA Demo ---")# Replace with a valid local path to your image, e.g., downloaded from the GitHub repo or assetsimage_path = "./assets/math.png"try:image = Image.open(image_path).convert("RGB")except FileNotFoundError:print(f"Warning: Image '{image_path}' not found. Using a placeholder image.")image = Image.new('RGB', (500, 500), color = 'blue') # Placeholder if image not foundprompt_qa = "As shown in the figure, AB is the diameter of ⊙O, and points C and D are on ⊙O. If ∠ABD = 50.0, then the degree of ∠BCD is () Choices: (A) 30° (B) 35° (C) 40° (D) 45°"messages_qa = [{"role": "user", "content": [{"type": "image", "content": image},{"type": "text", "content": prompt_qa}]}]input_ids = processor.apply_chat_template(messages_qa, tokenize=True, add_generation_prompt=True, return_tensors="pt", max_new_tokens=2048)inputs = processor(messages_qa, return_tensors="pt")inputs = {k: v.to(model.device) for k, v in inputs.items()}with torch.no_grad():output_ids = model.generate(**inputs, max_new_tokens=2048)output_text = processor.batch_decode(output_ids[:, inputs["input_ids"].shape[1]:], skip_special_tokens=True)[0]print(f"Question: {prompt_qa}Answer: {output_text}")# Example 2: Video Tracking (Conceptual/Simplified)print("--- Video Tracking Demo (Conceptual/Simplified) ---")# For full video processing, refer to the scripts in the original GitHub repository.# This is a simplified example showing how to pass video frames.# In a real scenario, you would load a sequence of actual video frames:# video_frames_list = [Image.open(f"path/to/video_frame_{i:04d}.jpg").convert("RGB") for i in range(num_frames)]# For demonstration, we'll use a list of placeholder images:video_frames_list = [Image.new('RGB', (224, 224), color = 'red') for _ in range(5)] # 5 placeholder framesprompt_tracking = "Given the bounding box [537,403,768,703] of the target object in the first frame, track this object in each frame."messages_tracking = [{"role": "user", "content": [{"type": "video", "content": video_frames_list}, # Pass video frames directly{"type": "text", "content": prompt_tracking}]}]inputs_tracking = processor(messages_tracking, return_tensors="pt")inputs_tracking = {k: v.to(model.device) for k, v in inputs_tracking.items()}with torch.no_grad():output_ids_tracking = model.generate(**inputs_tracking, max_new_tokens=2048)output_text_tracking = processor.batch_decode(output_ids_tracking[:, inputs_tracking["input_ids"].shape[1]:], skip_special_tokens=True)[0]print(f"Question: {prompt_tracking}Answer: {output_text_tracking}")```## 📐 Set up```bashgit clone https://github.com/tulerfeng/OneThinkercd OneThinker# build SFT environmentconda create -n llamafactory python=3.11conda activate llamafactorycd LLaMA-Factorypip install -e ".[torch,metrics]" --no-build-isolation# build RL environmentconda create -n easyr1 python=3.11conda activate easyr1cd EasyR1pip install -e .```For more details for the SFT and RL environment installation, please refer to [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory), [EasyR1](https://github.com/hiyouga/EasyR1)Then, download the training datasets [[🤗 OneThinker-train-data](https://huggingface.co/datasets/OneThink/OneThinker-train-data)] and unzip all the data.The `onethinker_rl_train.json` file is for RL training while `onethinker_sft_image.json` and `onethinker_sft_video.json` is for SFT cold start. The json files end with `_unsampled` are unsampled full set.## 🚀 TrainingFor SFT and RL training, a minimum of 8 × 80GB GPUs is required; alternatively, you may reduce the number of frames or the input resolution.We first perform SFT cold start.```bashbash ./LLaMA-Factory/local_scripts/run_onethinker_sft.sh```If you want to skip the SFT process, we also provide our SFT model at [🤗[OneThinker-SFT-model](https://huggingface.co/OneThink/OneThinker-SFT-Qwen3-8B)]Then, we perform RL training as follows```bashbash ./EasyR1/local_scripts/run_onethinker_rl.sh```For setting Ray in multi-node training, please refer to [EasyR1](https://github.com/hiyouga/EasyR1), or you may use single-node training by setting `NNODES=1`. Performing RL training for about 200 steps can already yield strong performance.If you want to use model-based rewards for open-ended problem, please use vllm to lanuch [POLAR-7B](https://github.com/InternLM/POLAR) and revised the setting in `/EasyR1/verl/reward_function/onethinker_reward.py`## 🔮 Inference & EvaluationFor the majority of tasks and benchmarks, we recommend using our provided json files and scripts for easier evaluation.The json files can be downloaded at: [🤗 [OneThinker-eval](https://huggingface.co/datasets/OneThink/OneThinker-eval)]Download the trained model [[🤗 OneThinker-8B-model](https://huggingface.co/OneThink/OneThinker-8B)]Conduct evaluation on all benchmarks using the following scripts```bashbash ./Evaluation/Eval/eval_bench_all.sh```If you want to perform evaluation on segmentation tasks, please download and install [sam2](https://github.com/facebookresearch/sam2) and revise the related path in `/Evaluation/Eval/seg_post_sam2.py`For image QA and part of video QA, we use [VLMEvalKit](https://github.com/open-compass/VLMEvalKit) for evaluation, please install corresponding environment and run:```bashbash ./Evaluation/VLMEvalKit/local_scripts/eval_vlmevalkit.sh```For infernce on a single example, you may refer to:```bashpython ./Evaluation/inference_single/inference.py```## AcknowledgementsWe sincerely appreciate the contributions of the open-source community. The related projects are as follows: [Video-R1](https://github.com/tulerfeng/Video-R1), [DeepSeek-R1](https://github.com/deepseek-ai/DeepSeek-R1), [EasyR1](https://github.com/hiyouga/EasyR1), [verl](https://github.com/volcengine/verl), [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory), [VLMEvalKit](https://github.com/open-compass/VLMEvalKit)## Citations10 unmodified lines111213141516171819202122232425262728292 unmodified lines323334353637383940414243446 unmodified lines5152535455565723 unmodified lines8182838485868713 unmodified lines1011021031041051061079 unmodified lines11711811912012112210 unmodified linesThis repository contains the model presented in: [OneThinker: All-in-one Reasoning Model for Image and Video](https://huggingface.co/papers/2512.03043)For inference, please refer to:**Project Page**: https://github.com/tulerfeng/OneThinker**Code**: https://github.com/tulerfeng/OneThinker## 👀 About OneThinker<div align="center"><img src="https://github.com/tulerfeng/OneThinker/blob/main/assets/teaser.png?raw=true" alt="OneThinker teaser" width="95%"></div>We introduce **OneThinker**, an all-in-one multimodal reasoning generalist that is **capable of thinking across a wide range of fundamental visual tasks within a single model**.We construct the large-scale **OneThinker-600k** multi-task training corpus and build **OneThinker-SFT-340k** with high-quality CoT annotations for cold-start SFT. Moreover, we propose **EMA-GRPO**, a new RL method that **balances heterogeneous reward signals across diverse visual tasks**, via simply tracking task-wise moving averages of reward std.2 unmodified linesAll code, models, and data are fully released.## 🏆 PerformanceOur model obtains significant performance gains after training based on Qwen3-VL-Instruct-8B across diverse visual tasks. For examle, OneThinker-8B reaches 70.6% accuracy on MMMU, 64.3% on MathVerse, 66.2% on VideoMMMU, 93.7 on Refcoco-testA, 54.9 J&F on ReasonVOS.<div align="center"><img src="https://github.com/tulerfeng/OneThinker/blob/main/assets/performance.png?raw=true" alt="Descriptive alt text" width="90%"></div>Besides, we also observe beneficial cross-task and cross-modality knowledge transfer, along with promising preliminary zero-shot generalization under unified training. This highlights the effectiveness and generalization ability of our unified training framework across diverse visual tasks.6 unmodified lines<summary>Demo 1 (QA)</summary><div align="center"><img src="https://github.com/tulerfeng/OneThinker/blob/main/assets/math.png?raw=true" width="36%"></div>**Question:**23 unmodified lines<summary>Demo 2 (Tracking)</summary><div align="center"><img src="https://github.com/tulerfeng/OneThinker/blob/main/assets/got_car.gif?raw=true" width="60%"></div>**Question:**13 unmodified lines<summary>Demo 3 (Segmentation)</summary><div align="center"><img src="https://github.com/tulerfeng/OneThinker/blob/main/assets/lalaland.gif?raw=true" width="60%"></div>**Question:**9 unmodified lines</details>## Citations
README.md+10-175