MindSpore 백엔드
MindSpore 백엔드 (Mindspore backend)
이 문서는 SGLang에서 MindSpore 모델을 실행하는 방법을 안내해요. MindSpore는 Ascend NPU에 최적화된 고성능 AI 프레임워크입니다.
출처: 문서
본문
소개 (Introduction)
MindSpore는 Ascend NPU에 최적화된 고성능 AI 프레임워크예요. 이 문서는 사용자가 SGLang에서 MindSpore 모델을 실행하는 방법을 안내합니다.
요구 사항 (Requirements)
MindSpore는 현재 Ascend NPU 장치만 지원해요. 사용자는 먼저 Ascend CANN 소프트웨어 패키지를 설치해야 합니다. CANN 소프트웨어 패키지는 Ascend 공식 웹사이트에서 다운로드할 수 있고, 권장 버전은 8.3.RC2예요.
지원 모델 (Supported Models)
현재 다음 모델들이 지원돼요:
- Qwen3: Dense 및 MoE 모델
- DeepSeek V3/R1
- 더 많은 모델이 곧 추가될 예정...
설치 (Installation)
모델 실행하기 (Run Model)
현재 SGLang-MindSpore는 Qwen3와 DeepSeek V3/R1 모델을 지원해요. 이 문서는 Qwen3-8B를 예시로 사용합니다.
오프라인 추론 (Offline Inference)
오프라인 추론에는 다음 스크립트를 사용하세요:
Initialize the engine with MindSpore backend
llm = sgl.Engine( model_path="/path/to/your/model", # Local model path device="npu", # Use NPU device model_impl="mindspore", # MindSpore implementation attention_backend="ascend", # Attention backend tp_size=1, # Tensor parallelism size dp_size=1 # Data parallelism size )
Generate text
prompts = [ "Hello, my name is", "The capital of France is", "The future of AI is" ]
sampling_params = {"temperature": 0, "top_p": 0.9} outputs = llm.generate(prompts, sampling_params)
for prompt, output in zip(prompts, outputs): print(f"Prompt: {prompt}") print(f"Generated: {output['text']}") print("---")
</CodeGroup>
### 서버 시작하기 (Start server)
MindSpore 백엔드로 서버를 실행해요:
<CodeGroup>
```bash Launch Server theme={null}
# Basic server startup
python3 -m sglang.launch_server \
--model-path /path/to/your/model \
--host 0.0.0.0 \
--device npu \
--model-impl mindspore \
--attention-backend ascend \
--tp-size 1 \
--dp-size 1
여러 노드의 분산 서버라면:
문제 해결 (Troubleshooting)
디버그 모드 (Debug Mode)
log-level 인자로 sglang 디버그 로깅을 활성화하세요.
환경 변수 설정으로 mindspore info와 debug 로깅을 활성화하세요.
장치 명시적으로 선택하기
다음 환경 변수로 사용할 장치를 명시적으로 선택하세요.
일부 통신 환경 문제
특수한 통신 환경에서는 사용자가 일부 환경 변수를 설정해야 해요.
protobuf 의존성 문제
특수한 protobuf 버전 환경에서는 바이너리 버전 불일치를 피하기 위해 일부 환경 변수를 설정해야 해요.
지원 (Support)
MindSpore 관련 문제가 있다면:
- MindSpore 문서를 참고하세요