.pth 에서 HTTP endpoint 까지
operational 정교함 증가 순서로 세 serving 맛:
- FastAPI + uvicorn — 너 자신 server 짜기. max 유연성, min 인프라. prototype, internal tool, 작은 production 에 great.
- TorchServe — managed inference server (AWS + Meta). built-in batching, model versioning, metric, multi-model serving. 'production 에 많은 model' 의 옳은 선택.
- vLLM / TGI / SGLang — LLM-specific serving. continuous batching, PagedAttention, optimized kernel. 언어 model serving 의 옳은 선택.
모든 serving setup 이 필요한 기본
- startup 에 model 한 번 로드, request 별 X.
model.eval()설정 + 매 request 에torch.inference_mode()사용.- latency budget 허락 시 request batch — 훨씬 더 나은 throughput.
- request 안 CPU-GPU sync 회피 — buffer pre-allocate, non_blocking transfer 사용.
- health endpoint 가 orchestrator 에게 service 살아있는지 알려줌.
- metric endpoint (latency, throughput, error rate, GPU 활용도).