Intern-S2-Preview
Intern-S2-Preview
Intern-S2-Preview는 효율적인 35B 과학 멀티모달 파운데이션 모델이에요. 기존의 파라미터·데이터 스케일링을 넘어, 과학 작업의 난이도·다양성·범위를 높여 모델 능력을 추가로 끌어내는 task scaling을 탐구해요.
출처: 문서
본문
1. Model Introduction
Intern-S2-Preview는 효율적인 35B 과학 멀티모달 파운데이션 모델이에요. 파라미터·데이터 스케일링을 넘어, 과학 작업의 난이도·다양성·범위(task scaling)를 높여 모델 능력을 추가로 끌어내요.
리소스:
- HuggingFace: internLM/Intern-S2-Preview
2. SGLang Installation
SGLang은 여러 설치 방법을 제공해요. 공식 SGLang 설치 가이드를 참조하세요.
소스에서 설치하거나 NVIDIA Docker 이미지를 사용하세요:
# Install from source
uv pip install --prerelease=allow 'git+https://github.com/sgl-project/sglang.git#subdirectory=python'
# Or use Docker for NVIDIA GPUs
docker pull lmsysorg/sglang:latest
실제 Docker 이미지 시작 방법은 Install → Method 3: Using Docker를 참조하세요. 최소 예시(내부 sglang serve ...를 아래 명령 생성기가 만든 것으로 교체):
docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<your-hf-token>" \
--ipc=host \
lmsysorg/sglang:latest \
sglang serve <use args below>
3. Model Deployment
3.1 Basic Configuration
상단의 대화형 Command Generator를 사용해 하드웨어와 parser 구성을 선택하면 배포 명령이 생성돼요. 예시 기본 명령(TP=8, reasoning·tool-call parser 켜짐):
sglang serve \
--model-path internLM/Intern-S2-Preview \
--tp 8 \
--reasoning-parser qwen3 \
--tool-call-parser qwen3_coder \
--mem-fraction-static 0.8 \
--host 0.0.0.0 \
--port 30000
3.2 Configuration Tips
- NVIDIA 배포 명령에는
tp>=2를 사용하세요. - 스트리밍 응답에서 reasoning 콘텐츠를 최종 콘텐츠와 분리하려면
--reasoning-parser qwen3를 사용하세요. - tool-calling 워크로드를 서빙할 때는
--tool-call-parser qwen3_coder를 사용하세요. - MTP를 켜려면
--speculative-algo 'NEXTN'과 함께--mamba-radix-cache-strategy extra_buffer를 추가하세요. - 가중치 로딩이 느리면
--model-loader-extra-config='{"enable_multithread_load": "true", "num_threads": 64}'를 추가하세요.
4. Model Invocation
4.1 Basic Usage
기본 API 사용과 요청 예시는 다음을 참조하세요:
4.2 Advanced Usage
4.2.1 Vision Input
Intern-S2-Preview는 이미지 입력을 지원해요. 다음은 이미지 예시예요:
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:30000/v1",
api_key="EMPTY",
)
response = client.chat.completions.create(
model="internLM/Intern-S2-Preview",
messages=[
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/tests/data/tiger.jpeg"
},
},
{
"type": "text",
"text": "Describe this image in detail.",
},
],
}
],
max_tokens=2048,
stream=True,
)
thinking_started = False
has_thinking = False
has_answer = False
for chunk in response:
if chunk.choices and len(chunk.choices) > 0:
delta = chunk.choices[0].delta
if hasattr(delta, "reasoning_content") and delta.reasoning_content:
if not thinking_started:
print("=============== Thinking =================", flush=True)
thinking_started = True
has_thinking = True
print(delta.reasoning_content, end="", flush=True)
if delta.content:
if has_thinking and not has_answer:
print("\n=============== Content =================", flush=True)
has_answer = True
print(delta.content, end="", flush=True)
print()
4.2.2 Reasoning Parser
스트리밍을 켜면 reasoning 콘텐츠를 최종 답과 분리해 읽을 수 있어요:
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:30000/v1",
api_key="EMPTY",
)
response = client.chat.completions.create(
model="internLM/Intern-S2-Preview",
messages=[
{"role": "user", "content": "Solve this step by step: What is 15% of 240?"}
],
max_tokens=2048,
stream=True,
)
thinking_started = False
has_thinking = False
has_answer = False
for chunk in response:
if chunk.choices and len(chunk.choices) > 0:
delta = chunk.choices[0].delta
if hasattr(delta, "reasoning_content") and delta.reasoning_content:
if not thinking_started:
print("=============== Thinking =================", flush=True)
thinking_started = True
has_thinking = True
print(delta.reasoning_content, end="", flush=True)
if delta.content:
if has_thinking and not has_answer:
print("\n=============== Content =================", flush=True)
has_answer = True
print(delta.content, end="", flush=True)
print()
4.2.3 Tool Calling
--tool-call-parser qwen3_coder를 켜고 서빙한 뒤 OpenAI 호환 tool 요청을 보내세요:
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:30000/v1",
api_key="EMPTY",
)
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name",
}
},
"required": ["location"],
},
},
}
]
response = client.chat.completions.create(
model="internLM/Intern-S2-Preview",
messages=[{"role": "user", "content": "What is the weather in Beijing?"}],
tools=tools,
max_tokens=1024,
)
print(response.choices[0].message)