Instructions to use internlm/Intern-S2-Mobius with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/Intern-S2-Mobius with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="internlm/Intern-S2-Mobius", trust_remote_code=True) 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 AutoModelForImageTextToText model = AutoModelForImageTextToText.from_pretrained("internlm/Intern-S2-Mobius", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use internlm/Intern-S2-Mobius with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "internlm/Intern-S2-Mobius" # 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/Intern-S2-Mobius", "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/Intern-S2-Mobius
- SGLang
How to use internlm/Intern-S2-Mobius 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/Intern-S2-Mobius" \ --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/Intern-S2-Mobius", "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/Intern-S2-Mobius" \ --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/Intern-S2-Mobius", "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/Intern-S2-Mobius with Docker Model Runner:
docker model run hf.co/internlm/Intern-S2-Mobius
Delete deployment_guide.md
Browse files- deployment_guide.md +0 -113
deployment_guide.md
DELETED
|
@@ -1,113 +0,0 @@
|
|
| 1 |
-
# Intern-S2-Mobius Deployment Guide
|
| 2 |
-
|
| 3 |
-
The Intern-S2-Mobius release is a 35B model stored in bfloat16 weight format. This guide provides deployment examples for the following configurations:
|
| 4 |
-
|
| 5 |
-
- MTP speculative decoding (Recommended)
|
| 6 |
-
- Basic serving without MTP
|
| 7 |
-
|
| 8 |
-
> NOTE: The commands below are reference configurations. Inference frameworks are under active development, so use the latest framework documentation and your local validation results when tuning production deployments.
|
| 9 |
-
|
| 10 |
-
## LMDeploy
|
| 11 |
-
|
| 12 |
-
Use the latest LMDeploy with Intern-S2-Mobius support. The examples below use single-GPU serving.
|
| 13 |
-
|
| 14 |
-
- Serving With MTP (Recommended)
|
| 15 |
-
|
| 16 |
-
```bash
|
| 17 |
-
lmdeploy serve api_server \
|
| 18 |
-
internlm/Intern-S2-Mobius \
|
| 19 |
-
--trust-remote-code \
|
| 20 |
-
--backend pytorch \
|
| 21 |
-
--tp 1 \
|
| 22 |
-
--speculative-algorithm qwen3_5_mtp \
|
| 23 |
-
--speculative-num-draft-tokens 4 \
|
| 24 |
-
--dtype bfloat16 \
|
| 25 |
-
--max-batch-size 64
|
| 26 |
-
```
|
| 27 |
-
|
| 28 |
-
- Basic Serving Without MTP
|
| 29 |
-
|
| 30 |
-
```bash
|
| 31 |
-
lmdeploy serve api_server \
|
| 32 |
-
internlm/Intern-S2-Mobius \
|
| 33 |
-
--trust-remote-code \
|
| 34 |
-
--backend pytorch \
|
| 35 |
-
--dtype bfloat16 \
|
| 36 |
-
--tp 1
|
| 37 |
-
```
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
## Transformers
|
| 41 |
-
|
| 42 |
-
Use a recent Transformers version with remote-code loading enabled.
|
| 43 |
-
|
| 44 |
-
- Basic Inference
|
| 45 |
-
|
| 46 |
-
```python
|
| 47 |
-
import torch
|
| 48 |
-
from transformers import AutoModelForImageTextToText, AutoTokenizer
|
| 49 |
-
|
| 50 |
-
model_path = "internlm/Intern-S2-Mobius"
|
| 51 |
-
|
| 52 |
-
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 53 |
-
model = AutoModelForImageTextToText.from_pretrained(
|
| 54 |
-
model_path,
|
| 55 |
-
trust_remote_code=True,
|
| 56 |
-
torch_dtype=torch.bfloat16,
|
| 57 |
-
device_map="auto",
|
| 58 |
-
).eval()
|
| 59 |
-
|
| 60 |
-
messages = [
|
| 61 |
-
{"role": "user", "content": "Give me a short introduction to Intern-S2-Mobius."}
|
| 62 |
-
]
|
| 63 |
-
|
| 64 |
-
text = tokenizer.apply_chat_template(
|
| 65 |
-
messages,
|
| 66 |
-
tokenize=False,
|
| 67 |
-
add_generation_prompt=True,
|
| 68 |
-
)
|
| 69 |
-
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 70 |
-
|
| 71 |
-
with torch.no_grad():
|
| 72 |
-
output_ids = model.generate(
|
| 73 |
-
**inputs,
|
| 74 |
-
max_new_tokens=512,
|
| 75 |
-
do_sample=True,
|
| 76 |
-
temperature=0.8,
|
| 77 |
-
top_p=1,
|
| 78 |
-
)
|
| 79 |
-
|
| 80 |
-
response_ids = output_ids[0][inputs["input_ids"].shape[-1]:]
|
| 81 |
-
print(tokenizer.decode(response_ids, skip_special_tokens=True))
|
| 82 |
-
```
|
| 83 |
-
|
| 84 |
-
## vLLM
|
| 85 |
-
|
| 86 |
-
Use the latest vLLM Docker image or source build with Intern-S2-Mobius support.
|
| 87 |
-
|
| 88 |
-
- Serving With MTP (Recommended)
|
| 89 |
-
|
| 90 |
-
```bash
|
| 91 |
-
vllm serve \
|
| 92 |
-
internlm/Intern-S2-Mobius \
|
| 93 |
-
--trust-remote-code \
|
| 94 |
-
--tensor-parallel-size 2 \
|
| 95 |
-
--reasoning-parser qwen3 \
|
| 96 |
-
--enable-auto-tool-choice \
|
| 97 |
-
--tool-call-parser qwen3_coder \
|
| 98 |
-
--spec-method mtp \
|
| 99 |
-
--spec-tokens 4
|
| 100 |
-
```
|
| 101 |
-
|
| 102 |
-
- Basic Serving Without MTP
|
| 103 |
-
|
| 104 |
-
```bash
|
| 105 |
-
vllm serve \
|
| 106 |
-
internlm/Intern-S2-Mobius \
|
| 107 |
-
--trust-remote-code \
|
| 108 |
-
--tensor-parallel-size 2 \
|
| 109 |
-
--reasoning-parser qwen3 \
|
| 110 |
-
--enable-auto-tool-choice \
|
| 111 |
-
--tool-call-parser qwen3_coder
|
| 112 |
-
```
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|