Skip to content

Commit 97bbc39

Browse files
iquinterolaurenyu
authored andcommitted
Add support for Chainer 5.0 (#491)
1 parent 835d1af commit 97bbc39

File tree

6 files changed

+44
-40
lines changed

6 files changed

+44
-40
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CHANGELOG
1212
* doc-fix: Add estimator base classes to API docs
1313
* feature: HyperparameterTuner: add support for Automatic Model Tuning's Warm Start Jobs
1414
* feature: HyperparameterTuner: Make input channels optional
15+
* feature: Add support for Chainer 5.0
1516

1617
1.14.2
1718
======

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ Chainer SageMaker Estimators
358358
359359
By using Chainer SageMaker ``Estimators``, you can train and host Chainer models on Amazon SageMaker.
360360
361-
Supported versions of Chainer: ``4.0.0``, ``4.1.0``.
361+
Supported versions of Chainer: ``4.0.0``, ``4.1.0``, ``5.0.0``.
362362
363363
We recommend that you use the latest supported version, because that's where we focus most of our development efforts.
364364

src/sagemaker/chainer/README.rst

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Chainer SageMaker Estimators and Models
44

55
With Chainer Estimators, you can train and host Chainer models on Amazon SageMaker.
66

7-
Supported versions of Chainer: ``4.0.0``, ``4.1.0``
7+
Supported versions of Chainer: ``4.0.0``, ``4.1.0``, ``5.0.0``
88

99
You can visit the Chainer repository at https://github.com/chainer/chainer.
1010

@@ -32,7 +32,7 @@ Suppose that you already have an Chainer training script called
3232
role='SageMakerRole',
3333
train_instance_type='ml.p3.2xlarge',
3434
train_instance_count=1,
35-
framework_version='4.1.0')
35+
framework_version='5.0.0')
3636
chainer_estimator.fit('s3://bucket/path/to/training/data')
3737
3838
Where the S3 URL is a path to your training data, within Amazon S3. The constructor keyword arguments define how
@@ -111,7 +111,7 @@ directories ('train' and 'test').
111111
chainer_estimator = Chainer('chainer-train.py',
112112
train_instance_type='ml.p3.2xlarge',
113113
train_instance_count=1,
114-
framework_version='4.1.0',
114+
framework_version='5.0.0',
115115
hyperparameters = {'epochs': 20, 'batch-size': 64, 'learning-rate': 0.1})
116116
chainer_estimator.fit({'train': 's3://my-data-bucket/path/to/my/training/data',
117117
'test': 's3://my-data-bucket/path/to/my/test/data'})
@@ -285,7 +285,7 @@ operation.
285285
chainer_estimator = Chainer(entry_point='train_and_deploy.py',
286286
train_instance_type='ml.p3.2xlarge',
287287
train_instance_count=1,
288-
framework_version='4.1.0')
288+
framework_version='5.0.0')
289289
chainer_estimator.fit('s3://my_bucket/my_training_data/')
290290
291291
# Deploy my estimator to a SageMaker Endpoint and get a Predictor
@@ -631,38 +631,38 @@ This Python version applies to both the Training Job, created by fit, and the En
631631

632632
The Chainer Docker images have the following dependencies installed:
633633

634-
+-----------------------------+-------------+
635-
| Dependencies | chainer 4.0 |
636-
+-----------------------------+-------------+
637-
| chainer | 4.0.0 |
638-
+-----------------------------+-------------+
639-
| chainercv | 0.9.0 |
640-
+-----------------------------+-------------+
641-
| chainermn | 1.2.0 |
642-
+-----------------------------+-------------+
643-
| CUDA (GPU image only) | 9.0 |
644-
+-----------------------------+-------------+
645-
| cupy | 4.0.0 |
646-
+-----------------------------+-------------+
647-
| matplotlib | 2.2.0 |
648-
+-----------------------------+-------------+
649-
| mpi4py | 3.0.0 |
650-
+-----------------------------+-------------+
651-
| numpy | 1.14.3 |
652-
+-----------------------------+-------------+
653-
| opencv-python | 3.4.0.12 |
654-
+-----------------------------+-------------+
655-
| Pillow | 5.1.0 |
656-
+-----------------------------+-------------+
657-
| Python | 2.7 or 3.5 |
658-
+-----------------------------+-------------+
634+
+-----------------------------+-------------+-------------+-------------+
635+
| Dependencies | chainer 4.0 | chainer 4.1 | chainer 5.0 |
636+
+-----------------------------+-------------+-------------+-------------+
637+
| chainer | 4.0.0 | 4.1.0 | 5.0.0 |
638+
+-----------------------------+-------------+-------------+-------------+
639+
| chainercv | 0.9.0 | 0.10.0 | 0.10.0 |
640+
+-----------------------------+-------------+-------------+-------------+
641+
| chainermn | 1.2.0 | 1.3.0 | N/A |
642+
+-----------------------------+-------------+-------------+-------------+
643+
| CUDA (GPU image only) | 9.0 | 9.0 | 9.0 |
644+
+-----------------------------+-------------+-------------+-------------+
645+
| cupy | 4.0.0 | 4.1.0 | 5.0.0 |
646+
+-----------------------------+-------------+-------------+-------------+
647+
| matplotlib | 2.2.0 | 2.2.0 | 2.2.0 |
648+
+-----------------------------+-------------+-------------+-------------+
649+
| mpi4py | 3.0.0 | 3.0.0 | 3.0.0 |
650+
+-----------------------------+-------------+-------------+-------------+
651+
| numpy | 1.14.3 | 1.15.3 | 1.15.4 |
652+
+-----------------------------+-------------+-------------+-------------+
653+
| opencv-python | 3.4.0.12 | 3.4.0.12 | 3.4.0.12 |
654+
+-----------------------------+-------------+-------------+-------------+
655+
| Pillow | 5.1.0 | 5.3.0 | 5.3.0 |
656+
+-----------------------------+-------------+-------------+-------------+
657+
| Python | 2.7 or 3.5 | 2.7 or 3.5 | 2.7 or 3.5 |
658+
+-----------------------------+-------------+-------------+-------------+
659659

660660
The Docker images extend Ubuntu 16.04.
661661

662-
You can select version of Chainer by passing a framework_version keyword arg to the Chainer Estimator constructor.
663-
Currently supported versions are listed in the above table. You can also set framework_version to only specify major and
664-
minor version, which will cause your training script to be run on the latest supported patch version of that minor
665-
version.
662+
You must select a version of Chainer by passing a ``framework_version`` keyword arg to the Chainer Estimator
663+
constructor. Currently supported versions are listed in the above table. You can also set framework_version to only
664+
specify major and minor version, which will cause your training script to be run on the latest supported patch
665+
version of that minor version.
666666

667667
Alternatively, you can build your own image by following the instructions in the SageMaker Chainer containers
668668
repository, and passing ``image_name`` to the Chainer Estimator constructor.

src/sagemaker/chainer/estimator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class Chainer(Framework):
3535
_process_slots_per_host = "sagemaker_process_slots_per_host"
3636
_additional_mpi_options = "sagemaker_additional_mpi_options"
3737

38+
LATEST_VERSION = '5.0.0'
39+
3840
def __init__(self, entry_point, use_mpi=None, num_processes=None, process_slots_per_host=None,
3941
additional_mpi_options=None, source_dir=None, hyperparameters=None, py_version='py3',
4042
framework_version=None, image_name=None, **kwargs):
@@ -82,7 +84,7 @@ def __init__(self, entry_point, use_mpi=None, num_processes=None, process_slots_
8284
**kwargs: Additional kwargs passed to the :class:`~sagemaker.estimator.Framework` constructor.
8385
"""
8486
if framework_version is None:
85-
logger.warning(empty_framework_version_warning(CHAINER_VERSION, CHAINER_VERSION))
87+
logger.warning(empty_framework_version_warning(CHAINER_VERSION, self.LATEST_VERSION))
8688
self.framework_version = framework_version or CHAINER_VERSION
8789

8890
super(Chainer, self).__init__(entry_point, source_dir, hyperparameters,

tests/conftest.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020

2121
from sagemaker import Session
2222
from sagemaker.local import LocalSession
23-
from sagemaker.chainer.defaults import CHAINER_VERSION
23+
from sagemaker.chainer import Chainer
24+
from sagemaker.mxnet import MXNet
2425
from sagemaker.pytorch.defaults import PYTORCH_VERSION
2526
from sagemaker.tensorflow.defaults import TF_VERSION
2627

@@ -33,8 +34,8 @@ def pytest_addoption(parser):
3334
parser.addoption('--sagemaker-runtime-config', action='store', default=None)
3435
parser.addoption('--boto-config', action='store', default=None)
3536
parser.addoption('--tf-full-version', action='store', default=TF_VERSION)
36-
parser.addoption('--mxnet-full-version', action='store', default='1.3.0')
37-
parser.addoption('--chainer-full-version', action='store', default=CHAINER_VERSION)
37+
parser.addoption('--mxnet-full-version', action='store', default=MXNet.LATEST_VERSION)
38+
parser.addoption('--chainer-full-version', action='store', default=Chainer.LATEST_VERSION)
3839
parser.addoption('--pytorch-full-version', action='store', default=PYTORCH_VERSION)
3940

4041

@@ -96,7 +97,7 @@ def pytorch_version(request):
9697
return request.param
9798

9899

99-
@pytest.fixture(scope='module', params=['4.0', '4.0.0', '4.1', '4.1.0'])
100+
@pytest.fixture(scope='module', params=['4.0', '4.0.0', '4.1', '4.1.0', '5.0', '5.0.0'])
100101
def chainer_version(request):
101102
return request.param
102103

tests/unit/test_chainer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,4 +468,4 @@ def test_empty_framework_version(warning, sagemaker_session):
468468
framework_version=None)
469469

470470
assert estimator.framework_version == defaults.CHAINER_VERSION
471-
warning.assert_called_with(defaults.CHAINER_VERSION, defaults.CHAINER_VERSION)
471+
warning.assert_called_with(defaults.CHAINER_VERSION, Chainer.LATEST_VERSION)

0 commit comments

Comments
 (0)