Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions huggingface/pytorch/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ account_id: &ACCOUNT_ID <set-$ACCOUNT_ID-in-environment>
region: &REGION <set-$REGION-in-environment>
base_framework: &BASE_FRAMEWORK pytorch
framework: &FRAMEWORK !join [ "huggingface_", *BASE_FRAMEWORK]
version: &VERSION 1.6.0
short_version: &SHORT_VERSION 1.6
version: &VERSION 1.7.1
short_version: &SHORT_VERSION 1.7

repository_info:
training_repository: &TRAINING_REPOSITORY
image_type: &TRAINING_IMAGE_TYPE training
root: !join [ "huggingface/", *BASE_FRAMEWORK, "/", *TRAINING_IMAGE_TYPE ]
repository_name: &REPOSITORY_NAME !join ["pr", "-", "huggingface", "-", *BASE_FRAMEWORK, "-", *TRAINING_IMAGE_TYPE]
repository: &REPOSITORY !join [ *ACCOUNT_ID, .dkr.ecr., *REGION, .amazonaws.com/,
*REPOSITORY_NAME ]
repository: &REPOSITORY !join [ *ACCOUNT_ID, .dkr.ecr., *REGION, .amazonaws.com/, *REPOSITORY_NAME ]
inference_repository: &INFERENCE_REPOSITORY
image_type: &INFERENCE_IMAGE_TYPE inference
root: !join [ "huggingface/", *BASE_FRAMEWORK, "/", *INFERENCE_IMAGE_TYPE ]
repository_name: &REPOSITORY_NAME !join ["pr", "-", "huggingface", "-", *BASE_FRAMEWORK, "-", *INFERENCE_IMAGE_TYPE]
repository: &REPOSITORY !join [ *ACCOUNT_ID, .dkr.ecr., *REGION, .amazonaws.com/, *REPOSITORY_NAME ]

images:
BuildHuggingFacePytorchGpuPy37Cu110TrainingDockerImage:
Expand All @@ -26,6 +30,21 @@ images:
transformers_version: &TRANSFORMERS_VERSION 4.6.1
datasets_version: &DATASETS_VERSION 1.6.2
tag: !join [ *VERSION, '-', 'transformers', *TRANSFORMERS_VERSION, '-', *DEVICE_TYPE, '-', *TAG_PYTHON_VERSION, '-',
*CUDA_VERSION, '-', *OS_VERSION ]
*CUDA_VERSION, '-', *OS_VERSION ]
docker_file: !join [ docker/, *SHORT_VERSION, /, *DOCKER_PYTHON_VERSION, /,
*CUDA_VERSION, /Dockerfile., *DEVICE_TYPE ]
*CUDA_VERSION, /Dockerfile., *DEVICE_TYPE ]
BuildHuggingFacePytorchGpuPy37Cu110InferenceDockerImage:
<<: *INFERENCE_REPOSITORY
build: &HUGGINGFACE_PYTORCH_GPU_INFERENCE_PY3 false
image_size_baseline: &IMAGE_SIZE_BASELINE 15000
device_type: &DEVICE_TYPE gpu
python_version: &DOCKER_PYTHON_VERSION py3
tag_python_version: &TAG_PYTHON_VERSION py36
cuda_version: &CUDA_VERSION cu110
os_version: &OS_VERSION ubuntu18.04
transformers_version: &TRANSFORMERS_VERSION 4.6.1
datasets_version: &DATASETS_VERSION 1.6.2
tag: !join [ *VERSION, '-', 'transformers', *TRANSFORMERS_VERSION, '-', *DEVICE_TYPE, '-', *TAG_PYTHON_VERSION, '-',
*CUDA_VERSION, '-', *OS_VERSION ]
docker_file: !join [ docker/, *SHORT_VERSION, /, *DOCKER_PYTHON_VERSION, /,
*CUDA_VERSION, /Dockerfile., *DEVICE_TYPE ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://github.com/aws/deep-learning-containers/blob/master/available_images.md
# refer to the above page to pull latest Pytorch image

# docker image region us-west-2
FROM 763104351884.dkr.ecr.us-west-2.amazonaws.com/pytorch-inference:1.7.1-gpu-py36-cu110-ubuntu18.04
29 changes: 24 additions & 5 deletions huggingface/tensorflow/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ repository_info:
image_type: &TRAINING_IMAGE_TYPE training
root: !join [ "huggingface/", *BASE_FRAMEWORK, "/", *TRAINING_IMAGE_TYPE ]
repository_name: &REPOSITORY_NAME !join ["pr", "-", "huggingface", "-", *BASE_FRAMEWORK, "-", *TRAINING_IMAGE_TYPE]
repository: &REPOSITORY !join [ *ACCOUNT_ID, .dkr.ecr., *REGION, .amazonaws.com/,
*REPOSITORY_NAME ]
repository: &REPOSITORY !join [ *ACCOUNT_ID, .dkr.ecr., *REGION, .amazonaws.com/, *REPOSITORY_NAME ]
inference_repository: &INFERENCE_REPOSITORY
image_type: &INFERENCE_IMAGE_TYPE inference
root: !join [ "huggingface/", *BASE_FRAMEWORK, "/", *INFERENCE_IMAGE_TYPE ]
repository_name: &REPOSITORY_NAME !join ["pr", "-", "huggingface", "-", *BASE_FRAMEWORK, "-", *INFERENCE_IMAGE_TYPE]
repository: &REPOSITORY !join [ *ACCOUNT_ID, .dkr.ecr., *REGION, .amazonaws.com/, *REPOSITORY_NAME ]

images:
BuildHuggingFaceTensorflowGpuPy37Cu110TrainingDockerImage:
Expand All @@ -26,6 +30,21 @@ images:
transformers_version: &TRANSFORMERS_VERSION 4.6.1
datasets_version: &DATASETS_VERSION 1.6.2
tag: !join [ *VERSION, '-', 'transformers', *TRANSFORMERS_VERSION, '-', *DEVICE_TYPE, '-', *TAG_PYTHON_VERSION, '-',
*CUDA_VERSION, '-', *OS_VERSION ]
docker_file: !join [ docker/, *SHORT_VERSION, /, *DOCKER_PYTHON_VERSION, /,
*CUDA_VERSION, /Dockerfile., *DEVICE_TYPE ]
*CUDA_VERSION, '-', *OS_VERSION ]
docker_file: !join [ docker/, *SHORT_VERSION, /, *DOCKER_PYTHON_VERSION, /,
*CUDA_VERSION, /Dockerfile., *DEVICE_TYPE ]
BuildHuggingFaceTensorflowGpuPy37Cu110InferenceDockerImage:
<<: *INFERENCE_REPOSITORY
build: &HUGGINGFACE_TENSORFLOW_GPU_INFERENCE_PY3 false
image_size_baseline: &IMAGE_SIZE_BASELINE 8489
device_type: &DEVICE_TYPE gpu
python_version: &DOCKER_PYTHON_VERSION py3
tag_python_version: &TAG_PYTHON_VERSION py37
cuda_version: &CUDA_VERSION cu110
os_version: &OS_VERSION ubuntu18.04
transformers_version: &TRANSFORMERS_VERSION 4.6.1
datasets_version: &DATASETS_VERSION 1.6.2
tag: !join [ *VERSION, '-', 'transformers', *TRANSFORMERS_VERSION, '-', *DEVICE_TYPE, '-', *TAG_PYTHON_VERSION, '-',
*CUDA_VERSION, '-', *OS_VERSION ]
docker_file: !join [ docker/, *SHORT_VERSION, /, *DOCKER_PYTHON_VERSION, /,
*CUDA_VERSION, /Dockerfile., *DEVICE_TYPE ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://github.com/aws/deep-learning-containers/blob/master/available_images.md
# refer to the above page to pull latest Tensorflow image

# docker image region us-west-2
FROM 763104351884.dkr.ecr.us-west-2.amazonaws.com/tensorflow-inference:2.4.1-gpu-py37-cu110-ubuntu18.04
2 changes: 1 addition & 1 deletion src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os

# Environment settings
FRAMEWORKS = {"mxnet", "tensorflow", "pytorch", "hugginface_tensorflow", "huggingface_pytorch"}
FRAMEWORKS = {"mxnet", "tensorflow", "pytorch", "huggingface_tensorflow", "huggingface_pytorch"}
DEVICE_TYPES = {"cpu", "gpu", "eia", "inf"}
IMAGE_TYPES = {"training", "inference"}
PYTHON_VERSIONS = {"py2", "py3", "py36"}
Expand Down
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import pytest


def dummy_test():
pass
4 changes: 2 additions & 2 deletions test/dlc_tests/sanity/test_telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def _run_instance_role_disabled(image_uri, ec2_client, ec2_instance, ec2_connect
# Disable access to EC2 instance metadata
ec2_connection.run(f"sudo route add -host 169.254.169.254 reject")

if framework == "tensorflow" and job_type == "inference":
if "tensorflow" in framework and job_type == "inference":
env_vars_list = ecs_utils.get_ecs_tensorflow_environment_variables(processor, "saved_model_half_plus_two")
env_vars = " ".join([f"-e {entry['name']}={entry['value']}" for entry in env_vars_list])
ec2_connection.run(f"{docker_cmd} run {env_vars} --name {container_name} -id {image_uri}")
Expand Down Expand Up @@ -126,7 +126,7 @@ def _run_tag_success(image_uri, ec2_client, ec2_instance, ec2_connection):
if expected_tag_key in preexisting_ec2_instance_tags:
ec2_client.remove_tags(Resources=[ec2_instance_id], Tags=[{"Key": expected_tag_key}])

if framework == "tensorflow" and job_type == "inference":
if "tensorflow" in framework and job_type == "inference":
env_vars_list = ecs_utils.get_ecs_tensorflow_environment_variables(processor, "saved_model_half_plus_two")
env_vars = " ".join([f"-e {entry['name']}={entry['value']}" for entry in env_vars_list])
ec2_connection.run(f"{docker_cmd} run {env_vars} --name {container_name} -id {image_uri}")
Expand Down
13 changes: 13 additions & 0 deletions test/sagemaker_tests/huggingface_pytorch/inference/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2019-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
from __future__ import absolute_import
Loading