Image-Text-to-Text
Transformers
Safetensors
qwen2_5_vl
multimodal-llm
multimodal-reasoning
math-reasoning
conversational
Eval Results (legacy)
text-generation-inference
Instructions to use MMR1/MMR1-7B-SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MMR1/MMR1-7B-SFT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="MMR1/MMR1-7B-SFT") 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, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("MMR1/MMR1-7B-SFT") model = AutoModelForImageTextToText.from_pretrained("MMR1/MMR1-7B-SFT") 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
- vLLM
How to use MMR1/MMR1-7B-SFT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MMR1/MMR1-7B-SFT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MMR1/MMR1-7B-SFT", "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/MMR1/MMR1-7B-SFT
- SGLang
How to use MMR1/MMR1-7B-SFT 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 "MMR1/MMR1-7B-SFT" \ --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": "MMR1/MMR1-7B-SFT", "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 "MMR1/MMR1-7B-SFT" \ --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": "MMR1/MMR1-7B-SFT", "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 MMR1/MMR1-7B-SFT with Docker Model Runner:
docker model run hf.co/MMR1/MMR1-7B-SFT
Improve model card: Add comprehensive metadata, GitHub link, and Transformers usage
#1
by nielsr HF Staff - opened
This PR significantly improves the model card for the MMR1 model, presented in MMR1: Enhancing Multimodal Reasoning with Variance-Aware Sampling and Open Resources.
Key improvements include:
- Metadata: Addition of
license: apache-2.0,pipeline_tag: image-text-to-text,library_name: transformers, and relevanttags(qwen2_5_vl,multimodal-llm,multimodal-reasoning,math-reasoning). - Contextual Metadata: Inclusion of
datasets(MMR1/MMR1-SFT,MMR1/MMR1-RL) andbase_model(Qwen/Qwen2.5-VL-7B-Instruct) for better lineage and discoverability. - Performance Metrics: Addition of
model-indexwith an average performance score for theMMR1-7B-RLvariant on mathematics-related multimodal reasoning benchmarks. - Content Enrichment: Integration of the paper abstract, a direct link to the GitHub repository, and key sections from the GitHub README (Introduction, Methodology, Open Resources, Evaluation, Analysis, Qualitative Demo, Acknowledgement, Citation, and License) for a more informative model overview. Relevant images from the GitHub repository are also included.
- Usage Example: Addition of a clear "Quick Start (Inference)" code snippet demonstrating how to use the model with the
transformerslibrary, which directly supports thelibrary_namemetadata and enables the automated "How to use" widget. The example is designed for image-text input, aligning with the model's capabilities. - Clean-up: Removal of internal "File information" from the model card.
This enhances the model's discoverability, usability, and documentation for researchers and users on the Hugging Face Hub.
Sicong changed pull request status to merged