πŸŽ‰ 75% of content is free forever β€” Unlock Premium from $10/mo β†’
CW
Search courses…
πŸ’Ό Servicesℹ️ Aboutβœ‰οΈ ContactView Pricing Plansfrom $10

AI Cloud Platforms

🟒 Free Lesson

Advertisement

AI Cloud Platforms

Cloud AI Platforms ComparisonAWS (SageMaker)GCP (Vertex AI)Azure (AI Services)AWS AI Servicesβ€’ SageMaker (Training/Deploy)β€’ Bedrock (Foundation Models)β€’ Rekognition (Vision)β€’ Comprehend (NLP)β€’ Polly (Text-to-Speech)β€’ Transcribe (Speech-to-Text)GCP AI Servicesβ€’ Vertex AI Platformβ€’ PaLM APIβ€’ Vision AIβ€’ Natural Language APIβ€’ Text-to-Speechβ€’ Translation APIAzure AI Servicesβ€’ Azure OpenAI Serviceβ€’ Machine Learning Studioβ€’ Computer Visionβ€’ Language Understandingβ€’ Speech Servicesβ€’ Document Intelligence

AWS SageMaker

import boto3
import sagemaker
from sagemaker.huggingface import HuggingFaceModel

class AWSAIPlatform:
    def __init__(self, role_arn: str):
        self.role = role_arn
        self.session = sagemaker.Session()
        self.sm_client = boto3.client("sagemaker")
    
    def deploy_huggingface_model(self, model_name: str, instance_type: str = "ml.g4dn.xlarge"):
        huggingface_model = HuggingFaceModel(
            model_data="s3://my-bucket/model.tar.gz",
            role=self.role,
            transformers_version="4.26",
            pytorch_version="1.13",
            py_version="py39"
        )
        
        predictor = huggingface_model.deploy(
            initial_instance_count=1,
            instance_type=instance_type,
            endpoint_name=model_name
        )
        
        return predictor
    
    def create_endpoint_config(self, model_name: str, instance_type: str) -> str:
        response = self.sm_client.create_endpoint_config(
            EndpointConfigName=f"{model_name}-config",
            ProductionVariants=[
                {
                    "VariantName": "primary",
                    "ModelName": model_name,
                    "InstanceType": instance_type,
                    "InitialInstanceCount": 1,
                    "InitialVariantWeight": 1.0
                }
            ]
        )
        return response["EndpointConfigArn"]

aws = AWSAIPlatform(role_arn="arn:aws:iam::role/SageMakerRole")
predictor = aws.deploy_huggingface_model("my-model")

GCP Vertex AI

from google.cloud import aiplatform
from google.cloud.aiplatform import Model, Endpoint

class GCPAIPlatform:
    def __init__(self, project_id: str, region: str):
        self.project_id = project_id
        self.region = region
        aiplatform.init(project=project_id, location=region)
    
    def deploy_model(self, model_id: str, machine_type: str = "n1-standard-4"):
        model = Model(model_name=model_id)
        
        endpoint = model.deploy(
            deployed_model_display_name="my-endpoint",
            machine_type=machine_type,
            min_replica_count=1,
            max_replica_count=3
        )
        
        return endpoint
    
    def predict(self, endpoint: Endpoint, instances: list):
        predictions = endpoint.predict(instances=instances)
        return predictions.predictions

gcp = GCPAIPlatform(project_id="my-project", region="us-central1")
endpoint = gcp.deploy_model("models/my-model")
predictions = gcp.predict(endpoint, [{"text": "Hello world"}])

Azure OpenAI

from azure.ai.openai import OpenAIClient, AzureOpenAI
from azure.identity import DefaultAzureCredential

class AzureAIPlatform:
    def __init__(self, endpoint: str, api_key: str):
        self.client = AzureOpenAI(
            api_key=api_key,
            azure_endpoint=endpoint,
            api_version="2024-02-15-preview"
        )
    
    def chat_completion(self, messages: list, model: str = "gpt-4"):
        response = self.client.chat.completions.create(
            model=model,
            messages=messages,
            temperature=0.7,
            max_tokens=800
        )
        
        return response.choices[0].message.content
    
    def generate_embeddings(self, texts: list, model: str = "text-embedding-ada-002"):
        embeddings = self.client.embeddings.create(
            model=model,
            input=texts
        )
        
        return [e.embedding for e in embeddings.data]

azure = AzureAIPlatform(
    endpoint="https://myresource.openai.azure.com/",
    api_key="my-api-key"
)
response = azure.chat_completion([{"role": "user", "content": "Hello"}])
embeddings = azure.generate_embeddings(["text1", "text2"])

Platform Comparison

FeatureAWSGCPAzure
Foundation ModelsBedrockPaLM APIOpenAI
TrainingSageMakerVertex AIML Studio
VisionRekognitionVision AIComputer Vision
NLPComprehendNL APILanguage API
SpeechPolly/TranscribeSpeech-to-TextSpeech Services
PricingPay-per-usePay-per-usePay-per-use

Best Practices

  • Compare pricing across platforms for your workload
  • Use managed services to reduce operational overhead
  • Implement multi-cloud strategies for resilience
  • Leverage spot instances for training cost savings
  • Monitor and optimize GPU utilization
  • Use appropriate instance types for inference vs training
⭐

Premium Content

AI Cloud Platforms

Unlock this lesson and 900+ advanced tutorials with a Premium plan.

🎯End-to-end Projects
πŸ’ΌInterview Prep
πŸ“œCertificates
🀝Community Access

Already a member? Log in

Need Expert Generative AI Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement