Chapter 49

মডেল ডিপ্লয়মেন্ট

Model Deployment
🚀 Notebook থেকে Production
Model train করা শেষ — এবার সেটাকে real user-এর কাছে পৌঁছানো। Deployment মানে শুধু API নয় — packaging, scaling, monitoring, versioning সবকিছু।

Deployment Patterns

  • REST API: FastAPI/Flask — synchronous request/response।
  • Batch: ঘণ্টায় একবার score generate (cron/Airflow)।
  • Streaming: Kafka → real-time inference।
  • Edge: mobile/IoT device-এ on-device (TFLite, CoreML)।
  • Serverless: AWS Lambda, Modal, Replicate।

Model Format

  • .pt / .pth — PyTorch native।
  • SavedModel — TensorFlow।
  • ONNX — framework-agnostic।
  • TensorRT, OpenVINO — hardware-optimized।
  • GGUF, safetensors — LLM weights।

Serving Frameworks

  • TorchServe / TF Serving: production-grade।
  • Triton Inference Server: NVIDIA — multi-framework, dynamic batching।
  • vLLM / TGI: LLM serving — PagedAttention, continuous batching।
  • BentoML, Ray Serve: Python-first orchestration।

Cloud Platforms

# Popular options
- AWS SageMaker / Bedrock
- GCP Vertex AI
- Azure ML
- HuggingFace Inference Endpoints
- Replicate, Modal, RunPod (GPU-first)

Deployment Checklist

  • Model versioning (MLflow / DVC)।
  • Input validation + schema।
  • Health/readiness endpoints।
  • Logging, metrics, tracing।
  • Autoscaling rules (CPU/GPU/QPS)।
  • Rollback strategy (blue-green/canary)।
💡 শুরু করুন ছোট
FastAPI + Docker + একটি cloud VM — এটাই 80% project-এ যথেষ্ট। Triton/vLLM তখনই যখন scale বা latency দাবি করে।

সারসংক্ষেপ

✨ এই অধ্যায়ে যা শিখলাম
  • Deployment pattern — REST, batch, stream, edge।
  • Model format ও serving framework-এর landscape।
  • Production checklist — version, monitor, scale, rollback।