Azure ML Studio: ACI for Simple Deployment (Hindi Guide)

इस ब्लॉग में आप सीखेंगे कि Azure ML Studio में ACI (Azure Container Instance) का उपयोग करके ML models को simple और quick तरीके से कैसे deploy किया जाता है।

🚀 Azure ML Studio: ACI for Simple Deployment (Complete Guide in Hindi)

जब हम ML models को train कर लेते हैं तो अगला step होता है deployment ताकि end-users उन्हें API या applications के जरिए use कर सकें। Azure ML Studio में कई deployment options available हैं, लेकिन Azure Container Instances (ACI) सबसे आसान और quick तरीका है। इस ब्लॉग में हम detail में समझेंगे कि ACI क्या है, क्यों इस्तेमाल किया जाता है और कैसे step-by-step model को ACI में deploy किया जाता है।

🔹 ACI (Azure Container Instance) क्या है?

ACI एक lightweight, serverless container service है जो आपको containerized applications को run करने देता है बिना complex infrastructure manage किए। Azure ML Studio में ACI primarily development, testing और small-scale inference scenarios के लिए use होता है।

  • ⚡ Simple और fast deployment
  • 🛠️ Infrastructure management की जरूरत नहीं
  • 💰 Cost-effective (pay-as-you-go model)
  • 🌍 Public REST API endpoint auto generate होता है

💡 कब use करें ACI?

  • जब आप demo या prototype show करना चाहते हैं
  • जब dataset और traffic small scale हो
  • जब आपको low-latency, temporary endpoint चाहिए
  • जब आपको जल्दी model test करना हो बिना production setup के

🛠️ ACI Deployment Process (Step-by-Step)

Azure ML Studio में ACI पर model deploy करने के लिए ये steps follow करें:

  1. Workspace में trained model register करें
  2. Scoring script (score.py) और environment define करें
  3. Inference configuration बनाएँ
  4. ACI deployment configuration तैयार करें
  5. Model को deploy करें और REST endpoint test करें

📜 Example: ACI Deployment using Python SDK

from azureml.core import Workspace, Model, Environment, InferenceConfig
from azureml.core.webservice import AciWebservice

# Load workspace
ws = Workspace.from_config()

# Load registered model
model = Model(ws, name="my-model")

# Define environment
env = Environment.get(ws, name="AzureML-sklearn-0.24-ubuntu18.04-py37-cpu")

# Inference config
inference_config = InferenceConfig(entry_script="score.py", environment=env)

# ACI config
aci_config = AciWebservice.deploy_configuration(cpu_cores=1, memory_gb=1)

# Deploy
service = Model.deploy(
    ws,
    name="aci-deployment-demo",
    models=[model],
    inference_config=inference_config,
    deployment_config=aci_config
)

service.wait_for_deployment(show_output=True)
print("Endpoint:", service.scoring_uri)
    

🖋️ Sample Score Script (score.py)

import joblib
import json
import numpy as np

def init():
    global model
    model = joblib.load("model.pkl")

def run(data):
    try:
        input_data = np.array(json.loads(data)["data"])
        result = model.predict(input_data)
        return json.dumps({"prediction": result.tolist()})
    except Exception as e:
        return str(e)
    

📊 ACI vs AKS (Quick Comparison)

Criteria ACI AKS
Scalability Low (single instance) High (multi-node cluster)
Use Case Testing, prototyping Production workloads
Cost Cheap (pay-per-use) More expensive
Setup Easy Complex

✅ Best Practices for ACI Deployment

  • Always use registered model for deployment
  • Test scoring script locally before deploying
  • Enable logging to debug issues
  • Use ACI only for small workloads, production के लिए AKS choose करें
  • Endpoint security के लिए authentication enable करें

⚡ Real-World Example

एक healthcare startup ने patient risk prediction model develop किया। उन्होंने जल्दी demo देने के लिए model को ACI deployment किया। Doctors ने web UI से real-time inputs देकर predictions देखीं। Production rollout के लिए बाद में AKS shift किया गया। इस तरह ACI ने तेज़ iteration और stakeholder feedback में मदद की।

🏆 निष्कर्ष

ACI एक simple और fast deployment option है Azure ML Studio में। यह prototyping, demos और small workloads के लिए perfect है। लेकिन production workloads के लिए AKS बेहतर option होता है। अगर आप ML models को जल्दी expose करना चाहते हैं बिना complex infra setup किए, तो ACI आपके लिए ideal solution है।