-
Notifications
You must be signed in to change notification settings - Fork 1.2k
change: add mxnet 1.7.0 eia configuration #2173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f041c8d
add mxnet 1.7.0 eia configuration
58a2492
add logic to filter out py2 for mxnet 1.7.0
deaa6ee
change py3 to py36
bdaf19a
change py3 to py36
1dc3c61
python version for latest mxnet eia
3795e6f
change py36 back to py3 to be consistent with mxnet training image
7259523
add function in conftest.py for mxnet_eia_latest_py_version
d0afe51
fix the blank lines
31710fa
reformat mnist_ei.py
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,8 +157,16 @@ def mxnet_training_py_version(mxnet_training_version, request): | |
|
||
|
||
@pytest.fixture(scope="module", params=["py2", "py3"]) | ||
def mxnet_eia_py_version(request): | ||
return request.param | ||
def mxnet_eia_py_version(mxnet_eia_version, request): | ||
if Version(mxnet_eia_version) < Version("1.7.0"): | ||
return request.param | ||
else: | ||
return "py3" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this might need to be py36 as per aws/deep-learning-containers@cab6c4e. |
||
|
||
|
||
@pytest.fixture(scope="module") | ||
def mxnet_eia_latest_py_version(): | ||
return "py3" | ||
|
||
|
||
@pytest.fixture(scope="module", params=["py2", "py3"]) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# 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 | ||
|
||
import argparse | ||
import gzip | ||
import json | ||
import logging | ||
import os | ||
import struct | ||
|
||
import mxnet as mx | ||
import numpy as np | ||
|
||
|
||
def model_fn(model_dir): | ||
import eimx | ||
|
||
def read_data_shapes(path, preferred_batch_size=1): | ||
with open(path, "r") as f: | ||
signatures = json.load(f) | ||
|
||
data_names = [] | ||
data_shapes = [] | ||
|
||
for s in signatures: | ||
name = s["name"] | ||
data_names.append(name) | ||
|
||
shape = s["shape"] | ||
|
||
if preferred_batch_size: | ||
shape[0] = preferred_batch_size | ||
|
||
data_shapes.append((name, shape)) | ||
|
||
return data_names, data_shapes | ||
|
||
shapes_file = os.path.join(model_dir, "model-shapes.json") | ||
data_names, data_shapes = read_data_shapes(shapes_file) | ||
|
||
ctx = mx.cpu() | ||
sym, args, aux = mx.model.load_checkpoint(os.path.join(model_dir, "model"), 0) | ||
sym = sym.optimize_for("EIA") | ||
|
||
mod = mx.mod.Module(symbol=sym, context=ctx, data_names=data_names, label_names=None) | ||
mod.bind(for_training=False, data_shapes=data_shapes) | ||
mod.set_params(args, aux, allow_missing=True) | ||
|
||
return mod |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this might need to be py36 as per aws/deep-learning-containers@cab6c4e.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment. Will update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For MXNet 1.7.0 training image, though the image tag is
py36
, in this file it still specifies thepy_version
aspy3
. We should keep training and inference images the same, otherwise when deploying the endpoint, it errors out because thepy_version
doesn't match. So I'll leave it aspy3
to be consistent with the training image.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upon checking
Are both valid, so I'm okay with having py3. We add py36 in a separate PR if desired.