Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example.basicapp; | |
import com.amazonaws.services.sagemakerruntime.AmazonSageMakerRuntime; | |
import com.amazonaws.services.sagemakerruntime.AmazonSageMakerRuntimeClientBuilder; | |
import com.amazonaws.services.sagemakerruntime.model.InvokeEndpointRequest; | |
import com.amazonaws.services.sagemakerruntime.model.InvokeEndpointResult; | |
import java.nio.ByteBuffer; | |
public class App |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
MODEL_NAME=half-plus-three-v1 | |
ENDPOINT_CONFIG_NAME=half-plus-three-config-v1 | |
ENDPOINT_NAME=half-plus-three | |
PRODUCTION_VARIANTS="VariantName=Default,ModelName=${MODEL_NAME},"\ | |
"InitialInstanceCount=1,InstanceType=ml.c4.large" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
MODEL_NAME=half-plus-three-v1 | |
# the role named created with | |
# https://gist.github.com/mvsusp/599311cb9f4ee1091065f8206c026962 | |
ROLE_NAME=SageMakerRole | |
# the name of the image created with | |
# https://gist.github.com/mvsusp/07610f9cfecbec13fb2b7c77a2e843c4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This script creates a role named SageMakerRole | |
# that can be used by SageMaker and has Full access to S3. | |
ROLE_NAME=SageMakerRole | |
# WARNING: this policy gives full S3 access to container that | |
# is running in SageMaker. You can change this policy to a more | |
# restrictive one, or create your own policy. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
IMAGE_NAME=sagemaker-tf-serving | |
REGION=$(aws configure get region) | |
ACCOUNT=$(aws sts get-caller-identity --query Account --output text) | |
# If the ECS repository doesn't exist, creates it. | |
aws ecr create-repository --repository-name ${IMAGE_NAME} > /dev/null 2>&1 | |
# ECR requires the image name to be in this format: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
docker build -t sagemaker-byoc-tf-serving . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
events { | |
# determines how many requests can simultaneously be served | |
# https://www.digitalocean.com/community/tutorials/how-to-optimize-nginx-configuration | |
# for more information | |
worker_connections 2048; | |
} | |
http { | |
server { | |
# configures the server to listen to the port 8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using the official tensorflow serving image from docker hub as base image | |
FROM tensorflow/serving | |
# Installing NGINX, used to rever proxy the predictions from SageMaker to TF Serving | |
RUN apt-get update && apt-get install -y --no-install-recommends nginx git | |
# Copy our model folder to the container | |
COPY saved_model_half_plus_three /saved_model_half_plus_three | |
# Copy NGINX configuration to the container |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone --single-branch -b r1.9 https://github.com/tensorflow/serving.git /tmp/serving | |
cp -r \ | |
/tmp/serving/tensorflow_serving/servables/tensorflow/testdata/saved_model_half_plus_three \ | |
saved_model_half_plus_three |
NewerOlder