Amazon SageMaker

Amazon SageMaker is AWS's end-to-end machine learning platform. It provides the tools to label data, build and train models, tune hyperparameters, deploy to managed endpoints, and monitor models in production — all without provisioning or managing the underlying GPU/CPU infrastructure directly.


Key Components:


Common Use Cases:


Example: Deploy a Hugging Face Model to a SageMaker Endpoint


from sagemaker.huggingface import HuggingFaceModel
import sagemaker

role = sagemaker.get_execution_role()

model = HuggingFaceModel(
    model_data="s3://my-bucket/models/distilbert.tar.gz",
    role=role,
    transformers_version="4.37",
    pytorch_version="2.1",
    py_version="py310",
)

predictor = model.deploy(
    initial_instance_count=1,
    instance_type="ml.g5.xlarge",
    endpoint_name="distilbert-sentiment",
)

print(predictor.predict({"inputs": "SageMaker makes model deployment straightforward."}))
  


SageMaker vs. Bedrock:

Bedrock is the managed-API path for consuming foundation models; SageMaker is the full ML platform for teams that need to train, host, and operate their own models. Many production architectures combine both — Bedrock for generic text/embedding tasks and SageMaker for custom models and specialized inference.