L
Initializing Studio...
Deploy your fine-tuned models to production with auto-scaling, monitoring, and CI/CD integration.
1# Deploy via CLI2langtrain deploy create \3 --model my-fine-tuned-model \4 --name production-api \5 --region us-east-1 \6 --min-instances 1 \7 --max-instances 1089# Deploy via Python SDK10deployment = client.deployments.create(11 model_id="your-model-id",12 name="production-api",13 config={14 "region": "us-east-1",15 "instance_type": "gpu-medium",16 "min_instances": 1,17 "max_instances": 10,18 "auto_scaling": True19 }20)
1# Generate Dockerfile2langtrain deploy generate-dockerfile --model my-model34# Build and deploy5docker build -t my-model:latest .6docker push your-registry/my-model:latest78# Kubernetes deployment9apiVersion: apps/v110kind: Deployment11metadata:12 name: langtrain-model13spec:14 replicas: 315 selector:16 matchLabels:17 app: langtrain-model18 template:19 metadata:20 labels:21 app: langtrain-model22 spec:23 containers:24 - name: model25 image: your-registry/my-model:latest26 ports:27 - containerPort: 8000
1# Configure load balancer2deployment_config = {3 "load_balancer": {4 "algorithm": "round_robin",5 "health_check": {6 "path": "/health",7 "interval": 30,8 "timeout": 5,9 "healthy_threshold": 2,10 "unhealthy_threshold": 311 },12 "sticky_sessions": False13 },14 "auto_scaling": {15 "metric": "requests_per_second",16 "target": 100,17 "scale_up_cooldown": 300,18 "scale_down_cooldown": 60019 }20}
1# Set up monitoring2client.monitoring.create_alert(3 deployment_id="your-deployment-id",4 metric="response_time_p95",5 threshold=2000, # 2 seconds6 comparison="greater_than",7 notification_channels=["email", "slack"]8)910# Custom metrics11client.monitoring.track_metric(12 deployment_id="your-deployment-id",13 metric_name="business_metric",14 value=42,15 tags={"version": "v1.2", "region": "us-east-1"}16)
1# GitHub Actions workflow2name: Deploy Model3on:4 push:5 branches: [main]67jobs:8 deploy:9 runs-on: ubuntu-latest10 steps:11 - uses: actions/checkout@v312 - name: Deploy to LangTrain13 uses: langtrain/deploy-action@v114 with:15 api-key: ${{ secrets.LANGTRAIN_API_KEY }}16 model-id: ${{ vars.MODEL_ID }}17 deployment-name: production-api