Image-Text-to-Text
Transformers
Safetensors
English
qwen2_5_vl
multimodal
spatial
sptial understanding
self-supervised learning
conversational
text-generation-inference
Instructions to use internlm/Spatial-SSRL-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/Spatial-SSRL-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="internlm/Spatial-SSRL-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, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("internlm/Spatial-SSRL-7B") model = AutoModelForImageTextToText.from_pretrained("internlm/Spatial-SSRL-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
- vLLM
How to use internlm/Spatial-SSRL-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "internlm/Spatial-SSRL-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": "internlm/Spatial-SSRL-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/internlm/Spatial-SSRL-7B
- SGLang
How to use internlm/Spatial-SSRL-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 "internlm/Spatial-SSRL-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": "internlm/Spatial-SSRL-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 "internlm/Spatial-SSRL-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": "internlm/Spatial-SSRL-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 internlm/Spatial-SSRL-7B with Docker Model Runner:
docker model run hf.co/internlm/Spatial-SSRL-7B
Update README.md
Browse files
README.md
CHANGED
|
@@ -56,7 +56,7 @@ We train Qwen2.5-VL-3B and Qwen2.5-VL-7B with our Spatial-SSRL paradigm and the
|
|
| 56 |
<img src="assets/exp_result.png" alt="Pipeline" width="100%">
|
| 57 |
</p>
|
| 58 |
|
| 59 |
-
##
|
| 60 |
<!--To directly experience <strong>Spatial-SSRL-7B</strong>, you can try it out on huggingface (link)! -->
|
| 61 |
Here we provide a code snippet for you to start a simple trial of <strong>Spatial-SSRL-7B</strong> on your own device. You can download the model from 🤗<a href="https://huggingface.co/internlm/Spatial-SSRL-7B">Spatial-SSRL-7B Model</a > before your trial!
|
| 62 |
</p>
|
|
@@ -111,27 +111,12 @@ output_text = processor.batch_decode(
|
|
| 111 |
print("Model Response:", output_text)
|
| 112 |
```
|
| 113 |
|
| 114 |
-
## 🛠️ Evaluation
|
| 115 |
-
Prepare your environment:
|
| 116 |
-
```bash
|
| 117 |
-
git clone https://github.com/InternLM/Spatial-SSRL.git
|
| 118 |
-
conda create -n spatialssrl python==3.10
|
| 119 |
-
conda activate spatialssrl
|
| 120 |
-
cd Spatial-SSRL/evaluation
|
| 121 |
-
pip install -r requirements.txt
|
| 122 |
-
|
| 123 |
-
```
|
| 124 |
-
Start your evaluation by referring to the tutorials in <a href="https://github.com/InternLM/Spatial-SSRL/blob/main/evaluation/Eval.md">Eval.md</a >
|
| 125 |
-
|
| 126 |
-
## 👨💻 Todo
|
| 127 |
-
- [ ] Release the training code.
|
| 128 |
-
|
| 129 |
## Cases
|
| 130 |
<p style="text-align: center;">
|
| 131 |
-
<img src="
|
| 132 |
</p>
|
| 133 |
<p style="text-align: center;">
|
| 134 |
-
<img src="
|
| 135 |
</p>
|
| 136 |
|
| 137 |
## ✒️Citation
|
|
|
|
| 56 |
<img src="assets/exp_result.png" alt="Pipeline" width="100%">
|
| 57 |
</p>
|
| 58 |
|
| 59 |
+
## 🛠️ Usage
|
| 60 |
<!--To directly experience <strong>Spatial-SSRL-7B</strong>, you can try it out on huggingface (link)! -->
|
| 61 |
Here we provide a code snippet for you to start a simple trial of <strong>Spatial-SSRL-7B</strong> on your own device. You can download the model from 🤗<a href="https://huggingface.co/internlm/Spatial-SSRL-7B">Spatial-SSRL-7B Model</a > before your trial!
|
| 62 |
</p>
|
|
|
|
| 111 |
print("Model Response:", output_text)
|
| 112 |
```
|
| 113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
## Cases
|
| 115 |
<p style="text-align: center;">
|
| 116 |
+
<img src="assets/case1.jpg" alt="Teaser" width="100%">
|
| 117 |
</p>
|
| 118 |
<p style="text-align: center;">
|
| 119 |
+
<img src="assets/case2.jpg" alt="Teaser" width="100%">
|
| 120 |
</p>
|
| 121 |
|
| 122 |
## ✒️Citation
|