-
Notifications
You must be signed in to change notification settings - Fork 1.2k
local mode: support output_path #449
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
605d48d
to
8f8cfc6
Compare
Can be either file:// or s3:// - This also changes the default behavior of local mode to use the SDK provided default S3 bucket if nothing is passed. This makes it easier for customers to create models in SageMaker too since their Model Artifacts will already be a tarfile in S3.
8f8cfc6
to
95ad797
Compare
Codecov Report
@@ Coverage Diff @@
## master #449 +/- ##
==========================================
- Coverage 93.75% 93.68% -0.08%
==========================================
Files 55 55
Lines 4034 4051 +17
==========================================
+ Hits 3782 3795 +13
- Misses 252 256 +4
Continue to review full report at Codecov.
|
@@ -104,6 +104,9 @@ def __init__(self, role, train_instance_count, train_instance_type, | |||
|
|||
self.base_job_name = base_job_name | |||
self._current_job_name = None | |||
if (not self.sagemaker_session.local_mode | |||
and output_path and output_path.startswith('file://')): | |||
raise RuntimeError('file:// output paths are only supported in Local Mode') |
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.
👌
model_files = [os.path.join(model_artifacts, name) for name in os.listdir(model_artifacts)] | ||
output_files = [os.path.join(output_artifacts, name) for name in os.listdir(output_artifacts)] | ||
sagemaker.utils.create_tar_file(model_files, os.path.join(compressed_artifacts, 'model.tar.gz')) | ||
sagemaker.utils.create_tar_file(output_files, os.path.join(compressed_artifacts, 'output.tar.gz')) |
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.
Should that be a function? (all 5 lines)
that seems a bit repetitive.
|
||
return s3_model_artifacts | ||
return os.path.join(output_data, 'model.tar.gz') |
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.
Since we moved both files should we return both (model and output) too??
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.
Not really, SageMaker just returns the S3ModelArtifacts - if you want to look at output.tar.gz you basically have to do a replace in the string. This gets sent directly to the local client describeTrainingJob()
Can be either file:// or s3:// - This also changes the default
behavior of local mode to use the SDK provided default S3 bucket
if nothing is passed. This makes it easier for customers to create
models in SageMaker too since their Model Artifacts will already be
a tarfile in S3.
Issue #, if available:
Description of changes:
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.