Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aws/sagemaker-chainer-container
Docker container for running Chainer scripts to train and host Chainer models on SageMaker
https://github.com/aws/sagemaker-chainer-container
aws chainer docker sagemaker
Last synced: 19 days ago
JSON representation
Docker container for running Chainer scripts to train and host Chainer models on SageMaker
- Host: GitHub
- URL: https://github.com/aws/sagemaker-chainer-container
- Owner: aws
- License: apache-2.0
- Created: 2018-03-01T17:30:26.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-04-10T08:53:09.000Z (over 1 year ago)
- Last Synced: 2024-10-10T21:31:02.638Z (about 1 month ago)
- Topics: aws, chainer, docker, sagemaker
- Language: Python
- Homepage:
- Size: 17.2 MB
- Stars: 18
- Watchers: 28
- Forks: 26
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
==========================
SageMaker Chainer Containers
==========================SageMaker Chainer Containers is an open source library for making the
Chainer framework run on Amazon SageMaker.This repository also contains Dockerfiles which install this library, Chainer, and dependencies
for building SageMaker Chainer images.For information on running Chainer jobs on SageMaker: `Python
SDK `__.For notebook examples: `SageMaker Notebook
Examples `__.Table of Contents
-----------------#. `Getting Started <#getting-started>`__
#. `Building your Image <#building-your-image>`__
#. `Running the tests <#running-the-tests>`__Getting Started
---------------Prerequisites
~~~~~~~~~~~~~Make sure you have installed all of the following prerequisites on your
development machine:- `Docker `__
For Testing on GPU
^^^^^^^^^^^^^^^^^^- `Nvidia-Docker `__
Recommended
^^^^^^^^^^^- A python environment management tool. (e.g.
`PyEnv `__,
`VirtualEnv `__)Building your image
-------------------`Amazon SageMaker `__
utilizes Docker containers to run all training jobs & inference endpoints.The Docker images are built from the Dockerfiles specified in
`Docker/ `__.The Docker files are grouped based on Chainer version and separated
based on Python version and processor type.The Docker images, used to run training & inference jobs, are built from
both corresponding "base" and "final" Dockerfiles.Base Images
~~~~~~~~~~~The "base" Dockerfile encompass the installation of the framework and all of the dependencies
needed.Tagging scheme is based on --. (e.g. 4.1.0-cpu-py3)
All "final" Dockerfiles build images using base images that use the tagging scheme
above.If you want to build your base docker image, then use:
::
# You need to build the base image from the same directory as the dockerfile
cd sagemaker-chainer-container/docker/base# CPU
docker build -t chainer-base:-cpu- -f Dockerfile.cpu .# GPU
docker build -t chainer-base:-gpu- -f Dockerfile.gpu .::
# Example
# CPU
docker build -t chainer-base:4.1.0-cpu-py3 -f Dockerfile.cpu .# GPU
docker build -t chainer-base:4.1.0-gpu-py3 -f Dockerfile.gpu .Final Images
~~~~~~~~~~~~The "final" Dockerfiles encompass the installation of the SageMaker specific support code.
All "final" Dockerfiles use `base images for building `__.
These "base" images are specified with the naming convention of
chainer-base:--.Before building "final" images:
Build your "base" image. Make sure it is named and tagged in accordance with your "final"
Dockerfile.::
# Create the SageMaker Chainer Container Python package.
cd sagemaker-chainer-container
python setup.py bdist_wheelIf you want to build "final" Docker images, then use:
::
# This build instruction assumes you're building from the repository root directory
# CPU
docker build -t : -f docker//final//Dockerfile.cpu .# GPU
docker build -t : -f docker//final//Dockerfile.gpu .::
# Example
# CPU
docker build -t preprod-chainer:4.1.0-cpu-py3 -f docker/4.1.0/final/py3/Dockerfile.cpu .# GPU
docker build -t preprod-chainer:4.1.0-gpu-py3 -f docker/4.1.0/final/py3/Dockerfile.gpu .Running the tests
-----------------Running the tests requires installation of the SageMaker Chainer Container code and its test
dependencies.::
git clone https://github.com/aws/sagemaker-chainer-container.git
cd sagemaker-chainer-container
pip install -e .[test]Tests are defined in
`test/ `__
and include unit, local integration, and SageMaker integration tests.Unit Tests
~~~~~~~~~~If you want to run unit tests, then use:
::
# All test instructions should be run from the top level directory
pytest test/unit
Local Integration Tests
~~~~~~~~~~~~~~~~~~~~~~~Running local integration tests require `Docker `__ and `AWS
credentials `__,
as the local integration tests make calls to a couple AWS services. The local integration tests and
SageMaker integration tests require configurations specified within their respective
`conftest.py `__.Local integration tests on GPU require `Nvidia-Docker `__.
Before running local integration tests:
#. Build your Docker image.
#. Pass in the correct pytest arguments to run tests against your Docker image.If you want to run local integration tests, then use:
::
# Required arguments for integration tests are found in test/conftest.py
pytest test/integration/local --docker-base-name \
--tag \
--py-version <2_or_3> \
--framework-version \
--processor::
# Example
pytest test/integration/local --docker-base-name preprod-chainer \
--tag 1.0 \
--py-version 3 \
--framework-version 4.1.0 \
--processor cpuSageMaker Integration Tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~SageMaker integration tests require your Docker image to be within an `Amazon ECR repository `__.
The Docker-base-name is your `ECR repository namespace `__.
The instance-type is your specified `Amazon SageMaker Instance Type
`__ that the SageMaker integration test will run on.Before running SageMaker integration tests:
#. Build your Docker image.
#. Push the image to your ECR repository.
#. Pass in the correct pytest arguments to run tests on SageMaker against the image within your ECR repository.If you want to run a SageMaker integration end to end test on `Amazon
SageMaker `__, then use:::
# Required arguments for integration tests are found in test/conftest.py
pytest test/integration/sagemaker --aws-id \
--docker-base-name \
--instance-type \
--tag \::
# Example
pytest test/integration/sagemaker --aws-id 12345678910 \
--docker-base-name preprod-chainer \
--instance-type ml.m4.xlarge \
--tag 1.0Contributing
------------Please read
`CONTRIBUTING.md `__
for details on our code of conduct, and the process for submitting pull
requests to us.License
-------SageMaker Chainer Containers is licensed under the Apache 2.0 License. It is copyright 2018 Amazon
.com, Inc. or its affiliates. All Rights Reserved. The license is available at:
http://aws.amazon.com/apache2.0/