Skip to content

Commit 16f5d25

Browse files
authored
Add Chainer 4.1.0 (#278)
1 parent eacb833 commit 16f5d25

File tree

6 files changed

+29
-18
lines changed

6 files changed

+29
-18
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
CHANGELOG
33
=========
44

5+
1.6.0
6+
=====
7+
8+
* feature: Add Chainer 4.1.0 support
9+
* bug-fix: Use chainer_full_version fixture in Chainer integration tests
10+
511
1.5.4
612
=====
713

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ You can install from source by cloning this repository and issuing a pip install
5050

5151
git clone https://github.com/aws/sagemaker-python-sdk.git
5252
python setup.py sdist
53-
pip install dist/sagemaker-1.5.4.tar.gz
53+
pip install dist/sagemaker-1.6.0.tar.gz
5454

5555
Supported Python versions
5656
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -236,7 +236,7 @@ Chainer SageMaker Estimators
236236

237237
With Chainer Estimators, you can train and host Chainer models on Amazon SageMaker.
238238

239-
Supported versions of Chainer: ``4.0.0``
239+
Supported versions of Chainer: ``4.0.0``, ``4.1.0``.
240240

241241
You can visit the Chainer repository at https://github.com/chainer/chainer.
242242

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def read(fname):
2323

2424

2525
setup(name="sagemaker",
26-
version="1.5.4",
26+
version="1.6.0",
2727
description="Open source library for training and deploying models on Amazon SageMaker.",
2828
packages=find_packages('src'),
2929
package_dir={'': 'src'},

src/sagemaker/chainer/defaults.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# language governing permissions and limitations under the License.
1313
from __future__ import absolute_import
1414

15-
CHAINER_VERSION = '4.0.0'
15+
CHAINER_VERSION = '4.1.0'

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def pytorch_version(request):
8686
return request.param
8787

8888

89-
@pytest.fixture(scope='module', params=['4.0', '4.0.0'])
89+
@pytest.fixture(scope='module', params=['4.0', '4.0.0', '4.1', '4.1.0'])
9090
def chainer_version(request):
9191
return request.param
9292

@@ -106,6 +106,6 @@ def pytorch_full_version(request):
106106
return request.param
107107

108108

109-
@pytest.fixture(scope='module', params=['4.0.0'])
109+
@pytest.fixture(scope='module', params=['4.0.0', '4.1.0'])
110110
def chainer_full_version(request):
111111
return request.param

tests/integ/test_chainer_train.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import pytest
1919
import numpy
2020

21+
from sagemaker.chainer.defaults import CHAINER_VERSION
2122
from sagemaker.chainer.estimator import Chainer
2223
from sagemaker.chainer.model import ChainerModel
2324
from sagemaker.utils import sagemaker_timestamp
@@ -26,25 +27,26 @@
2627

2728

2829
@pytest.fixture(scope='module')
29-
def chainer_training_job(sagemaker_session):
30-
return _run_mnist_training_job(sagemaker_session, "ml.c4.xlarge", 1)
30+
def chainer_training_job(sagemaker_session, chainer_full_version):
31+
return _run_mnist_training_job(sagemaker_session, "ml.c4.xlarge", 1, chainer_full_version)
3132

3233

33-
def test_distributed_cpu_training(sagemaker_session):
34-
_run_mnist_training_job(sagemaker_session, "ml.c4.xlarge", 2)
34+
def test_distributed_cpu_training(sagemaker_session, chainer_full_version):
35+
_run_mnist_training_job(sagemaker_session, "ml.c4.xlarge", 2, chainer_full_version)
3536

3637

37-
def test_distributed_gpu_training(sagemaker_session):
38-
_run_mnist_training_job(sagemaker_session, "ml.p2.xlarge", 2)
38+
def test_distributed_gpu_training(sagemaker_session, chainer_full_version):
39+
_run_mnist_training_job(sagemaker_session, "ml.p2.xlarge", 2, chainer_full_version)
3940

4041

41-
def test_training_with_additional_hyperparameters(sagemaker_session):
42+
def test_training_with_additional_hyperparameters(sagemaker_session, chainer_full_version):
4243
with timeout(minutes=15):
4344
script_path = os.path.join(DATA_DIR, 'chainer_mnist', 'mnist.py')
4445
data_path = os.path.join(DATA_DIR, 'chainer_mnist')
4546

4647
chainer = Chainer(entry_point=script_path, role='SageMakerRole',
4748
train_instance_count=1, train_instance_type="ml.c4.xlarge",
49+
framework_version=chainer_full_version,
4850
sagemaker_session=sagemaker_session, hyperparameters={'epochs': 1},
4951
use_mpi=True,
5052
num_processes=2,
@@ -75,8 +77,7 @@ def test_deploy_model(chainer_training_job, sagemaker_session):
7577
desc = sagemaker_session.sagemaker_client.describe_training_job(TrainingJobName=chainer_training_job)
7678
model_data = desc['ModelArtifacts']['S3ModelArtifacts']
7779
script_path = os.path.join(DATA_DIR, 'chainer_mnist', 'mnist.py')
78-
model = ChainerModel(model_data, 'SageMakerRole', entry_point=script_path,
79-
sagemaker_session=sagemaker_session)
80+
model = ChainerModel(model_data, 'SageMakerRole', entry_point=script_path, sagemaker_session=sagemaker_session)
8081
predictor = model.deploy(1, "ml.m4.xlarge", endpoint_name=endpoint_name)
8182
_predict_and_assert(predictor)
8283

@@ -85,7 +86,8 @@ def test_async_fit(sagemaker_session):
8586
endpoint_name = 'test-chainer-attach-deploy-{}'.format(sagemaker_timestamp())
8687

8788
with timeout(minutes=5):
88-
training_job_name = _run_mnist_training_job(sagemaker_session, "ml.c4.xlarge", 1, wait=False)
89+
training_job_name = _run_mnist_training_job(sagemaker_session, "ml.c4.xlarge", 1,
90+
chainer_full_version=CHAINER_VERSION, wait=False)
8991

9092
print("Waiting to re-attach to the training job: %s" % training_job_name)
9193
time.sleep(20)
@@ -97,12 +99,13 @@ def test_async_fit(sagemaker_session):
9799
_predict_and_assert(predictor)
98100

99101

100-
def test_failed_training_job(sagemaker_session):
102+
def test_failed_training_job(sagemaker_session, chainer_full_version):
101103
with timeout(minutes=15):
102104
script_path = os.path.join(DATA_DIR, 'chainer_mnist', 'failure_script.py')
103105
data_path = os.path.join(DATA_DIR, 'chainer_mnist')
104106

105107
chainer = Chainer(entry_point=script_path, role='SageMakerRole',
108+
framework_version=chainer_full_version,
106109
train_instance_count=1, train_instance_type='ml.c4.xlarge',
107110
sagemaker_session=sagemaker_session)
108111

@@ -113,7 +116,8 @@ def test_failed_training_job(sagemaker_session):
113116
chainer.fit(train_input)
114117

115118

116-
def _run_mnist_training_job(sagemaker_session, instance_type, instance_count, wait=True):
119+
def _run_mnist_training_job(sagemaker_session, instance_type, instance_count,
120+
chainer_full_version, wait=True):
117121
with timeout(minutes=15):
118122

119123
script_path = os.path.join(DATA_DIR, 'chainer_mnist', 'mnist.py') if instance_type == 1 else \
@@ -122,6 +126,7 @@ def _run_mnist_training_job(sagemaker_session, instance_type, instance_count, wa
122126
data_path = os.path.join(DATA_DIR, 'chainer_mnist')
123127

124128
chainer = Chainer(entry_point=script_path, role='SageMakerRole',
129+
framework_version=chainer_full_version,
125130
train_instance_count=instance_count, train_instance_type=instance_type,
126131
sagemaker_session=sagemaker_session, hyperparameters={'epochs': 1})
127132

0 commit comments

Comments
 (0)