-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add support for additional libraries in the Estimator #498
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
Conversation
|
||
def test_source_dirs(sagemaker_session, tmpdir): | ||
source_dir = os.path.join(DATA_DIR, 'pytorch_source_dirs') | ||
lib = os.path.join(str(tmpdir), 'alexa.py') |
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.
any reason not to put it in a separate directory?
i think it would be closer to a real life use case.
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.
source dir is under test/data and alexa.py is under /tmp. We about thought about the same use case =)
tests/integ/test_source_dirs.py
Outdated
|
||
predict_response = predictor.predict([24]) | ||
|
||
assert predict_response == [24] |
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.
why not make to return 42?
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.
Great.
src/sagemaker/chainer/README.rst
Outdated
@@ -149,6 +149,23 @@ The following are optional arguments. When you create a ``Chainer`` object, you | |||
other training source code dependencies including the entry point | |||
file. Structure within this directory will be preserved when training | |||
on SageMaker. | |||
- ``lib_dirs (list[str])`` A list of paths to directories (absolute or relative) with |
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.
We may want to call this libs as the entries do not need to be directories.
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.
sure
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.
Renaming it to dependencies.
src/sagemaker/chainer/README.rst
Outdated
instead. Example: | ||
|
||
The following call | ||
>>> Estimator(entry_point='train.py', lib_dirs=['my/libs/common', 'virtual-env']) |
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.
This should be Chainer()
not Estimator()
Applies to the other ones as well.
tests/integ/test_source_dirs.py
Outdated
from tests.integ import DATA_DIR, PYTHON_VERSION | ||
|
||
|
||
def test_source_dirs(sagemaker_session, tmpdir, sagemaker_local_session): |
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.
Can you remove sagemaker_session?
Description of changes:
Introduces the following argument in the Estimator and Model classes.
**dependencies** (list[str])
A list of paths to directories (absolute or relative) withany additional libraries that will be exported to the container (default: []).
The library folders will be copied to SageMaker in the same folder where the entrypoint is copied.
If the
source_dir
points to S3, code will be uploaded and the S3 location will be usedinstead. Example:
Merge Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.