Skip to content

Instantly share code, notes, and snippets.

@JulianaFontolan
JulianaFontolan / estimator.py
Last active July 26, 2023 20:18
CallEstimator
# Call the estimator with the main parameters
from sagemaker.estimator import Estimator
estimator = Estimator(
image_uri=ecr_image,
role=role,
instance_count=1,
instance_type="ml.c4.xlarge",
output_path=out_path
import sagemaker
import json
from sagemaker import get_execution_role
import boto3
# Role to have access of reading and write inside S3
role = get_execution_role()
# Path files
train_path='s3://topicmodeling/train/base_treino.csv'
%%sh
# Login in ECR
aws ecr get-login-password --region xxxxx | docker login --username AWS --password-stdin xxxxxx.dkr.ecr.xxxxx.amazonaws.com
@JulianaFontolan
JulianaFontolan / Dockerfile
Last active November 30, 2024 06:32
Deploying your own artificial intelligence model with Amazon Sagemaker
%%writefile Dockerfile
FROM python:3.7-buster
# Set a docker label to advertise multi-model support on the container
LABEL com.amazonaws.sagemaker.capabilities.multi-models=false
# Set a docker label to enable container to use SAGEMAKER_BIND_TO_PORT environment variable if present
LABEL com.amazonaws.sagemaker.capabilities.accept-bind-to-port=true
RUN apt-get update -y && apt-get -y install --no-install-recommends default-jdk
RUN rm -rf /var/lib/apt/lists/*