Image-Text-to-Text
Transformers
Safetensors
intern_s2_preview
conversational
custom_code
Eval Results
Instructions to use internlm/Intern-S2-Preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/Intern-S2-Preview 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", 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", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use internlm/Intern-S2-Preview 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" # 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", "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
- SGLang
How to use internlm/Intern-S2-Preview 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" \ --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", "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" \ --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", "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 with Docker Model Runner:
docker model run hf.co/internlm/Intern-S2-Preview
[Feature] Update time series weight (#3)
Browse files- [Feature] Update time series weight (f66c5599e66208851d98cd5c4b640d0505d22c23)
- Upload README.md (87ce0b4e4695253896d3e7f7c64e5e35932b8290)
- [Fix] Remove old weight (be1dc7e32f14e7ee6d476c3b4f0085fd9fa702cb)
- Upload README.md (a3963c0c3ee1af7a7852296ea1775d7a190eaa27)
- Upload 0092638_seism.npy (1b11386658e751517d78ad731ea6592791a859ac)
Co-authored-by: yehaochen <yehaochen@users.noreply.huggingface.co>
- 0092638_seism.npy +3 -0
- README.md +130 -0
- model-00001-of-00022.safetensors β model-00001-of-00023.safetensors +0 -0
- model-00002-of-00022.safetensors β model-00002-of-00023.safetensors +0 -0
- model-00003-of-00022.safetensors β model-00003-of-00023.safetensors +0 -0
- model-00004-of-00022.safetensors β model-00004-of-00023.safetensors +0 -0
- model-00005-of-00022.safetensors β model-00005-of-00023.safetensors +0 -0
- model-00006-of-00022.safetensors β model-00006-of-00023.safetensors +0 -0
- model-00007-of-00022.safetensors β model-00007-of-00023.safetensors +0 -0
- model-00008-of-00022.safetensors β model-00008-of-00023.safetensors +0 -0
- model-00009-of-00022.safetensors β model-00009-of-00023.safetensors +0 -0
- model-00010-of-00022.safetensors β model-00010-of-00023.safetensors +0 -0
- model-00011-of-00022.safetensors β model-00011-of-00023.safetensors +0 -0
- model-00012-of-00022.safetensors β model-00012-of-00023.safetensors +0 -0
- model-00013-of-00022.safetensors β model-00013-of-00023.safetensors +0 -0
- model-00014-of-00022.safetensors β model-00014-of-00023.safetensors +0 -0
- model-00015-of-00022.safetensors β model-00015-of-00023.safetensors +0 -0
- model-00016-of-00022.safetensors β model-00016-of-00023.safetensors +0 -0
- model-00017-of-00022.safetensors β model-00017-of-00023.safetensors +0 -0
- model-00018-of-00022.safetensors β model-00018-of-00023.safetensors +0 -0
- model-00019-of-00022.safetensors β model-00019-of-00023.safetensors +0 -0
- model-00020-of-00022.safetensors β model-00020-of-00023.safetensors +0 -0
- model-00021-of-00022.safetensors β model-00021-of-00023.safetensors +0 -0
- model-00022-of-00022.safetensors β model-00022-of-00023.safetensors +0 -0
- model-00023-of-00023.safetensors +3 -0
- model.safetensors.index.json +0 -0
0092638_seism.npy
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c2b94653c6964b630038897a27cb6d276ff866d9ecd1f6419358b9407f0df62e
|
| 3 |
+
size 72128
|
README.md
CHANGED
|
@@ -36,6 +36,8 @@ By extending professional scientific tasks into a full-chain training pipeline f
|
|
| 36 |
|
| 37 |
- **Efficient RL reasoning with MTP and CoT compression.** During RL, Intern-S2-Preview adopts shared-weight MTP with KL loss to reduce the mismatch between training and inference behavior, substantially improving MTP accept rate and token generation speed. It also introduces CoT compression techniques to shorten responses while preserving strong reasoning capability, achieving improvements in both performance and efficiency.
|
| 38 |
|
|
|
|
|
|
|
| 39 |
<figure>
|
| 40 |
<img src="./figs/efficiency.jpg" alt="efficient RL reasoning with MTP and CoT compression">
|
| 41 |
<figcaption>Fig1: Reasoning Efficiency on Complex Math Benchmarks. Accuracy vs. Average Response Length. Intern-S2-Preview (red star) significantly outperforms trillion-scale Intern-S1-Pro (red circle), and achieving higher accuracy with better token efficiency among medium-size models.</figcaption>
|
|
@@ -290,6 +292,134 @@ print(json.dumps(response.model_dump(), indent=2, ensure_ascii=False))
|
|
| 290 |
> Note: We do not recommend disabling thinking mode for agentic tasks.
|
| 291 |
|
| 292 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
## Agent Integration
|
| 294 |
|
| 295 |
Intern-S2-Preview can be plugged into agent frameworks in two ways: connecting to a **self-hosted deployment**, or calling the **official InternLM API**. Below we cover both, with examples for agent frameworks (OpenClaw, Hermes, etc.) and for Claude Code.
|
|
|
|
| 36 |
|
| 37 |
- **Efficient RL reasoning with MTP and CoT compression.** During RL, Intern-S2-Preview adopts shared-weight MTP with KL loss to reduce the mismatch between training and inference behavior, substantially improving MTP accept rate and token generation speed. It also introduces CoT compression techniques to shorten responses while preserving strong reasoning capability, achieving improvements in both performance and efficiency.
|
| 38 |
|
| 39 |
+
- **Upgraded time-series Modeling** for better physical signal representation; supports long, heterogeneous time-series (10^0β10^6 points).
|
| 40 |
+
|
| 41 |
<figure>
|
| 42 |
<img src="./figs/efficiency.jpg" alt="efficient RL reasoning with MTP and CoT compression">
|
| 43 |
<figcaption>Fig1: Reasoning Efficiency on Complex Math Benchmarks. Accuracy vs. Average Response Length. Intern-S2-Preview (red star) significantly outperforms trillion-scale Intern-S1-Pro (red circle), and achieving higher accuracy with better token efficiency among medium-size models.</figcaption>
|
|
|
|
| 292 |
> Note: We do not recommend disabling thinking mode for agentic tasks.
|
| 293 |
|
| 294 |
|
| 295 |
+
### Time Series Demo
|
| 296 |
+
|
| 297 |
+
Time series inference is currently only supported in LMDeploy. To get started, download and deploy Intern-S2-Preview with LMDeploy by following the [Model Deployment Guide](./deployment_guide.md).
|
| 298 |
+
Below is an example of detecting earthquake events from a time series signal file. Additional data types and functionalities are also supported.
|
| 299 |
+
|
| 300 |
+
**Please note**: this demo is slightly different from the one in [Intern-S1-Pro](https://huggingface.co/internlm/Intern-S1-Pro#time-series-demo). The main difference is that in the messages content, you need to provide time_series_url first, followed by the text prompt. Please adapt your implementation based on this demo.
|
| 301 |
+
|
| 302 |
+
```
|
| 303 |
+
from openai import OpenAI
|
| 304 |
+
from lmdeploy.vl.utils import encode_time_series_base64
|
| 305 |
+
|
| 306 |
+
openai_api_key = "EMPTY"
|
| 307 |
+
openai_api_base = "http://0.0.0.0:8000/v1"
|
| 308 |
+
client = OpenAI(
|
| 309 |
+
api_key=openai_api_key,
|
| 310 |
+
base_url=openai_api_base,
|
| 311 |
+
)
|
| 312 |
+
model_name = client.models.list().data[0].id
|
| 313 |
+
|
| 314 |
+
|
| 315 |
+
def send_base64(file_path: str, sampling_rate: int = 100):
|
| 316 |
+
"""base64-encoded time-series data."""
|
| 317 |
+
|
| 318 |
+
# encode_time_series_base64 accepts local file paths and http urls,
|
| 319 |
+
# encoding time-series data (.npy, .csv, .wav, .mp3, .flac, etc.) into base64 strings.
|
| 320 |
+
base64_ts = encode_time_series_base64(file_path)
|
| 321 |
+
|
| 322 |
+
messages = [
|
| 323 |
+
{
|
| 324 |
+
"role": "user",
|
| 325 |
+
"content": [
|
| 326 |
+
{
|
| 327 |
+
"type": "time_series_url",
|
| 328 |
+
"time_series_url": {
|
| 329 |
+
"url": f"data:time_series/npy;base64,{base64_ts}",
|
| 330 |
+
"sampling_rate": sampling_rate
|
| 331 |
+
},
|
| 332 |
+
},
|
| 333 |
+
{
|
| 334 |
+
"type": "text",
|
| 335 |
+
"text": "Please determine whether an Earthquake event has occurred in the provided time-series data. If so, please specify the starting time point indices of the P-wave and S-wave in the event."
|
| 336 |
+
},
|
| 337 |
+
],
|
| 338 |
+
}
|
| 339 |
+
]
|
| 340 |
+
|
| 341 |
+
return client.chat.completions.create(
|
| 342 |
+
model=model_name,
|
| 343 |
+
messages=messages,
|
| 344 |
+
temperature=0,
|
| 345 |
+
max_tokens=200,
|
| 346 |
+
extra_body={
|
| 347 |
+
"chat_template_kwargs": {"enable_thinking": False}
|
| 348 |
+
}
|
| 349 |
+
)
|
| 350 |
+
|
| 351 |
+
|
| 352 |
+
def send_http_url(url: str, sampling_rate: int = 100):
|
| 353 |
+
"""http(s) url pointing to the time-series data."""
|
| 354 |
+
messages = [
|
| 355 |
+
{
|
| 356 |
+
"role": "user",
|
| 357 |
+
"content": [
|
| 358 |
+
{
|
| 359 |
+
"type": "time_series_url",
|
| 360 |
+
"time_series_url": {
|
| 361 |
+
"url": url,
|
| 362 |
+
"sampling_rate": sampling_rate
|
| 363 |
+
},
|
| 364 |
+
},
|
| 365 |
+
{
|
| 366 |
+
"type": "text",
|
| 367 |
+
"text": "Please determine whether an Earthquake event has occurred in the provided time-series data. If so, please specify the starting time point indices of the P-wave and S-wave in the event."
|
| 368 |
+
},
|
| 369 |
+
],
|
| 370 |
+
}
|
| 371 |
+
]
|
| 372 |
+
|
| 373 |
+
return client.chat.completions.create(
|
| 374 |
+
model=model_name,
|
| 375 |
+
messages=messages,
|
| 376 |
+
temperature=0,
|
| 377 |
+
max_tokens=200,
|
| 378 |
+
extra_body={
|
| 379 |
+
"chat_template_kwargs": {"enable_thinking": False}
|
| 380 |
+
}
|
| 381 |
+
)
|
| 382 |
+
|
| 383 |
+
|
| 384 |
+
def send_file_url(file_path: str, sampling_rate: int = 100):
|
| 385 |
+
"""file url pointing to the time-series data."""
|
| 386 |
+
messages = [
|
| 387 |
+
{
|
| 388 |
+
"role": "user",
|
| 389 |
+
"content": [
|
| 390 |
+
{
|
| 391 |
+
"type": "time_series_url",
|
| 392 |
+
"time_series_url": {
|
| 393 |
+
"url": f"file://{file_path}",
|
| 394 |
+
"sampling_rate": sampling_rate
|
| 395 |
+
},
|
| 396 |
+
},
|
| 397 |
+
{
|
| 398 |
+
"type": "text",
|
| 399 |
+
"text": "Please determine whether an Earthquake event has occurred in the provided time-series data. If so, please specify the starting time point indices of the P-wave and S-wave in the event."
|
| 400 |
+
},
|
| 401 |
+
],
|
| 402 |
+
}
|
| 403 |
+
]
|
| 404 |
+
|
| 405 |
+
return client.chat.completions.create(
|
| 406 |
+
model=model_name,
|
| 407 |
+
messages=messages,
|
| 408 |
+
temperature=0,
|
| 409 |
+
max_tokens=200,
|
| 410 |
+
extra_body={
|
| 411 |
+
"chat_template_kwargs": {"enable_thinking": False}
|
| 412 |
+
}
|
| 413 |
+
)
|
| 414 |
+
|
| 415 |
+
response = send_base64("./0092638_seism.npy")
|
| 416 |
+
# response = send_http_url("https://huggingface.co/internlm/Intern-S1-Pro/raw/main/0092638_seism.npy")
|
| 417 |
+
# response = send_file_url("./0092638_seism.npy")
|
| 418 |
+
|
| 419 |
+
print(response.choices[0].message)
|
| 420 |
+
|
| 421 |
+
```
|
| 422 |
+
|
| 423 |
## Agent Integration
|
| 424 |
|
| 425 |
Intern-S2-Preview can be plugged into agent frameworks in two ways: connecting to a **self-hosted deployment**, or calling the **official InternLM API**. Below we cover both, with examples for agent frameworks (OpenClaw, Hermes, etc.) and for Claude Code.
|
model-00001-of-00022.safetensors β model-00001-of-00023.safetensors
RENAMED
|
File without changes
|
model-00002-of-00022.safetensors β model-00002-of-00023.safetensors
RENAMED
|
File without changes
|
model-00003-of-00022.safetensors β model-00003-of-00023.safetensors
RENAMED
|
File without changes
|
model-00004-of-00022.safetensors β model-00004-of-00023.safetensors
RENAMED
|
File without changes
|
model-00005-of-00022.safetensors β model-00005-of-00023.safetensors
RENAMED
|
File without changes
|
model-00006-of-00022.safetensors β model-00006-of-00023.safetensors
RENAMED
|
File without changes
|
model-00007-of-00022.safetensors β model-00007-of-00023.safetensors
RENAMED
|
File without changes
|
model-00008-of-00022.safetensors β model-00008-of-00023.safetensors
RENAMED
|
File without changes
|
model-00009-of-00022.safetensors β model-00009-of-00023.safetensors
RENAMED
|
File without changes
|
model-00010-of-00022.safetensors β model-00010-of-00023.safetensors
RENAMED
|
File without changes
|
model-00011-of-00022.safetensors β model-00011-of-00023.safetensors
RENAMED
|
File without changes
|
model-00012-of-00022.safetensors β model-00012-of-00023.safetensors
RENAMED
|
File without changes
|
model-00013-of-00022.safetensors β model-00013-of-00023.safetensors
RENAMED
|
File without changes
|
model-00014-of-00022.safetensors β model-00014-of-00023.safetensors
RENAMED
|
File without changes
|
model-00015-of-00022.safetensors β model-00015-of-00023.safetensors
RENAMED
|
File without changes
|
model-00016-of-00022.safetensors β model-00016-of-00023.safetensors
RENAMED
|
File without changes
|
model-00017-of-00022.safetensors β model-00017-of-00023.safetensors
RENAMED
|
File without changes
|
model-00018-of-00022.safetensors β model-00018-of-00023.safetensors
RENAMED
|
File without changes
|
model-00019-of-00022.safetensors β model-00019-of-00023.safetensors
RENAMED
|
File without changes
|
model-00020-of-00022.safetensors β model-00020-of-00023.safetensors
RENAMED
|
File without changes
|
model-00021-of-00022.safetensors β model-00021-of-00023.safetensors
RENAMED
|
File without changes
|
model-00022-of-00022.safetensors β model-00022-of-00023.safetensors
RENAMED
|
File without changes
|
model-00023-of-00023.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ba1b2ece7654c0af7d58eccf467b5fc2f4d5627a047731935a64727bf6e421c9
|
| 3 |
+
size 272854528
|
model.safetensors.index.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|