Image-Text-to-Text
Transformers
Safetensors
internvl_chat
multimodal
vision-language
spatial-reasoning
spatiolm
conversational
Instructions to use xiaomi-research/SpatioLM-Perception-InternVL3.5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use xiaomi-research/SpatioLM-Perception-InternVL3.5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="xiaomi-research/SpatioLM-Perception-InternVL3.5") 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 AutoModel model = AutoModel.from_pretrained("xiaomi-research/SpatioLM-Perception-InternVL3.5", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use xiaomi-research/SpatioLM-Perception-InternVL3.5 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "xiaomi-research/SpatioLM-Perception-InternVL3.5" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xiaomi-research/SpatioLM-Perception-InternVL3.5", "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/xiaomi-research/SpatioLM-Perception-InternVL3.5
- SGLang
How to use xiaomi-research/SpatioLM-Perception-InternVL3.5 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 "xiaomi-research/SpatioLM-Perception-InternVL3.5" \ --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": "xiaomi-research/SpatioLM-Perception-InternVL3.5", "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 "xiaomi-research/SpatioLM-Perception-InternVL3.5" \ --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": "xiaomi-research/SpatioLM-Perception-InternVL3.5", "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 xiaomi-research/SpatioLM-Perception-InternVL3.5 with Docker Model Runner:
docker model run hf.co/xiaomi-research/SpatioLM-Perception-InternVL3.5
Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: image-text-to-text
|
| 5 |
+
base_model: OpenGVLab/InternVL3_5-8B
|
| 6 |
+
tags:
|
| 7 |
+
- multimodal
|
| 8 |
+
- vision-language
|
| 9 |
+
- spatial-reasoning
|
| 10 |
+
- spatiolm
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# SpatioLM-Perception-InternVL3.5
|
| 14 |
+
|
| 15 |
+
This is the official **SpatioLM Perception** checkpoint based on
|
| 16 |
+
**InternVL3.5 (8B)**. It is intended for metric depth and physical spatial perception.
|
| 17 |
+
|
| 18 |
+
SpatioLM adds a plug-and-play spatio-vision module to a frozen vision-language
|
| 19 |
+
model and learns physically coherent representations from pseudo depth and
|
| 20 |
+
camera-ray supervision. No additional 3D input is required at inference time.
|
| 21 |
+
|
| 22 |
+
## Installation
|
| 23 |
+
|
| 24 |
+
```bash
|
| 25 |
+
git clone https://github.com/xiaomi-research/spatio-lm.git
|
| 26 |
+
cd spatio-lm
|
| 27 |
+
pip install -e .
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
## Image inference
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
import torch
|
| 34 |
+
from lmms_eval.models.simple.internvl2 import load_image
|
| 35 |
+
from PIL import Image
|
| 36 |
+
from transformers import AutoTokenizer
|
| 37 |
+
|
| 38 |
+
from spatiolm.models import InternVL3RChatModel
|
| 39 |
+
|
| 40 |
+
checkpoint = "xiaomi-research/SpatioLM-Perception-InternVL3.5"
|
| 41 |
+
image = Image.open("/path/to/image.jpg").convert("RGB")
|
| 42 |
+
|
| 43 |
+
model = InternVL3RChatModel.from_pretrained(
|
| 44 |
+
checkpoint,
|
| 45 |
+
dtype=torch.bfloat16,
|
| 46 |
+
low_cpu_mem_usage=True,
|
| 47 |
+
).eval().cuda()
|
| 48 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 49 |
+
checkpoint,
|
| 50 |
+
trust_remote_code=True,
|
| 51 |
+
use_fast=False,
|
| 52 |
+
)
|
| 53 |
+
pixel_values = load_image(image, input_size=448).to(
|
| 54 |
+
device="cuda",
|
| 55 |
+
dtype=torch.bfloat16,
|
| 56 |
+
)
|
| 57 |
+
answer = model.chat(
|
| 58 |
+
tokenizer,
|
| 59 |
+
pixel_values,
|
| 60 |
+
"Which object is closer to the camera?",
|
| 61 |
+
{"max_new_tokens": 128, "do_sample": False},
|
| 62 |
+
)
|
| 63 |
+
print(answer)
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
For video inference, benchmark evaluation, training details, and the Action
|
| 67 |
+
checkpoint interface, see the
|
| 68 |
+
[SpatioLM repository](https://github.com/xiaomi-research/spatio-lm).
|
| 69 |
+
|
| 70 |
+
## Intended use and limitations
|
| 71 |
+
|
| 72 |
+
- This checkpoint is intended for research on physical spatial intelligence.
|
| 73 |
+
- Outputs can be inaccurate and should not be used as the sole signal in
|
| 74 |
+
safety-critical or high-impact decisions.
|
| 75 |
+
- Performance can vary with image quality, viewpoint, scene domain, prompting,
|
| 76 |
+
and video sampling strategy.
|
| 77 |
+
- The custom SpatioLM model implementation is required; loading with only stock
|
| 78 |
+
Transformers auto classes is not supported.
|
| 79 |
+
|
| 80 |
+
## Citation
|
| 81 |
+
|
| 82 |
+
```bibtex
|
| 83 |
+
@inproceedings{wu2026spatiolm,
|
| 84 |
+
title={SpatioLM: Towards General Physical Spatial Intelligence in Vision-Language Models},
|
| 85 |
+
author={Wu, Jianhua and others},
|
| 86 |
+
booktitle={International Conference on Machine Learning},
|
| 87 |
+
year={2026}
|
| 88 |
+
}
|
| 89 |
+
```
|