Instructions to use internlm/Intern-S2-Preview-397B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/Intern-S2-Preview-397B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="internlm/Intern-S2-Preview-397B", 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)# Load model directly from transformers import AutoModelForImageTextToText model = AutoModelForImageTextToText.from_pretrained("internlm/Intern-S2-Preview-397B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use internlm/Intern-S2-Preview-397B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "internlm/Intern-S2-Preview-397B" # 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-Preview-397B", "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-Preview-397B
- SGLang
How to use internlm/Intern-S2-Preview-397B 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-Preview-397B" \ --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-Preview-397B", "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-Preview-397B" \ --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-Preview-397B", "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-Preview-397B with Docker Model Runner:
docker model run hf.co/internlm/Intern-S2-Preview-397B
Update README.md
Browse files
README.md
CHANGED
|
@@ -474,7 +474,7 @@ If you do not want to self-host, you can use the official Intern API. Register a
|
|
| 474 |
|
| 475 |
#### Connecting Agent Frameworks
|
| 476 |
|
| 477 |
-
The service is OpenAI-compatible, so any agent framework works. You can set the base url to `https://chat.intern-ai.org.cn/api/v1` and the model name to `intern-s2-preview` in the cli or config file.
|
| 478 |
|
| 479 |
You can check the connection with the following command:
|
| 480 |
|
|
@@ -483,7 +483,7 @@ curl https://chat.intern-ai.org.cn/api/v1/chat/completions \
|
|
| 483 |
-H "Content-Type: application/json" \
|
| 484 |
-H "Authorization: Bearer sk-xxxxxxxx" \
|
| 485 |
-d '{
|
| 486 |
-
"model": "intern-s2-preview",
|
| 487 |
"messages": [
|
| 488 |
{"role": "user", "content": "Hello"}
|
| 489 |
],
|
|
@@ -503,8 +503,8 @@ Claude Code can route to the official Intern API by pointing `ANTHROPIC_BASE_URL
|
|
| 503 |
"env": {
|
| 504 |
"ANTHROPIC_BASE_URL": "https://chat.intern-ai.org.cn",
|
| 505 |
"ANTHROPIC_AUTH_TOKEN": "your-api-token",
|
| 506 |
-
"ANTHROPIC_MODEL": "intern-s2-preview",
|
| 507 |
-
"ANTHROPIC_SMALL_FAST_MODEL": "intern-s2-preview"
|
| 508 |
}
|
| 509 |
}
|
| 510 |
```
|
|
|
|
| 474 |
|
| 475 |
#### Connecting Agent Frameworks
|
| 476 |
|
| 477 |
+
The service is OpenAI-compatible, so any agent framework works. You can set the base url to `https://chat.intern-ai.org.cn/api/v1` and the model name to `intern-s2-preview-397b` in the cli or config file.
|
| 478 |
|
| 479 |
You can check the connection with the following command:
|
| 480 |
|
|
|
|
| 483 |
-H "Content-Type: application/json" \
|
| 484 |
-H "Authorization: Bearer sk-xxxxxxxx" \
|
| 485 |
-d '{
|
| 486 |
+
"model": "intern-s2-preview-397b",
|
| 487 |
"messages": [
|
| 488 |
{"role": "user", "content": "Hello"}
|
| 489 |
],
|
|
|
|
| 503 |
"env": {
|
| 504 |
"ANTHROPIC_BASE_URL": "https://chat.intern-ai.org.cn",
|
| 505 |
"ANTHROPIC_AUTH_TOKEN": "your-api-token",
|
| 506 |
+
"ANTHROPIC_MODEL": "intern-s2-preview-397b",
|
| 507 |
+
"ANTHROPIC_SMALL_FAST_MODEL": "intern-s2-preview-397b"
|
| 508 |
}
|
| 509 |
}
|
| 510 |
```
|