-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Refactor LocalSageMakerClient #375
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
Codecov Report
@@ Coverage Diff @@
## master #375 +/- ##
==========================================
- Coverage 92.99% 92.96% -0.04%
==========================================
Files 51 52 +1
Lines 3568 3652 +84
==========================================
+ Hits 3318 3395 +77
- Misses 250 257 +7
Continue to review full report at Codecov.
|
local sagemakerclient was not very useful beyond creating a single estimator/endpoint. doing workflows such as training and later creating and endpoint was really awkward. These changes make it both resemble the API a bit more and allow persisting objects across LocalSessions. This is important because most of the time the SDK classes create sessions behind the scenes.
e6fe630
to
e6bcfc0
Compare
this fixes integration tests when we pass custom local sessions.
Codecov Report
@@ Coverage Diff @@
## master #375 +/- ##
==========================================
- Coverage 92.94% 92.83% -0.12%
==========================================
Files 51 52 +1
Lines 3572 3656 +84
==========================================
+ Hits 3320 3394 +74
- Misses 252 262 +10
Continue to review full report at Codecov.
|
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.
no tests for the new entities file?
src/sagemaker/local/entities.py
Outdated
'ModelName': self.model_name, | ||
'CreationTime': self.creation_time, | ||
'ExecutionRoleArn': 'local:arn-does-not-matter', | ||
'ModelArn': 'local:arn-does-not-matter', |
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.
might be better to have these as constants
src/sagemaker/local/entities.py
Outdated
_FAILED = 'Failed' | ||
|
||
def __init__(self, endpoint_name, endpoint_config_name, local_session=None): | ||
from sagemaker.local import LocalSagemakerClient |
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.
could you add a comment explaining why this has to be imported down here? also, I think you could move it to the else block if you wanted to
src/sagemaker/local/local_session.py
Outdated
InputDataConfig (dict): Describes the training dataset and the location where it is stored. | ||
OutputDataConfig (dict): Identifies the location where you want to save the results of model training. | ||
ResourceConfig (dict): Identifies the resources to use for local model traininig. | ||
HyperParameters (dict): Specify these algorithm-specific parameters to influence the quality of the final |
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.
nitpick: s/Specify/Specifies to make it consistent with the other ones
src/sagemaker/local/local_session.py
Outdated
container = _SageMakerContainer(ResourceConfig['InstanceType'], ResourceConfig['InstanceCount'], | ||
AlgorithmSpecification['TrainingImage'], self.sagemaker_session) | ||
train_job = _LocalTrainingJob(container) | ||
train_job.start(InputDataConfig, HyperParameters) |
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.
nitpick: s/train_job/training_job
assert train_container is not None | ||
assert train_container.image == image | ||
assert train_container.instance_count == instance_count | ||
local_sagemaker_client.create_training_job('my-training-job', algo_spec, input_data_config, |
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.
maybe constants for some of these strings as well?
- Fix Hyperparameters being mandatory in local mode - Fix serving container timeout time to match SageMaker
Local sagemakerclient was not very useful beyond creating a single estimator/endpoint. doing workflows such as training and later creating and endpoint was really awkward. These changes make it both resemble the API a bit more and allow persisting objects across LocalSessions. This is important because most of the time the SDK classes create sessions behind the scenes. includes 2 bug fixes: - Fix Hyperparameters being mandatory in local mode - Fix serving container timeout time to match SageMaker
local sagemakerclient was not very useful beyond creating a single
estimator/endpoint. doing workflows such as training and later creating
and endpoint was really awkward.
These changes make it both resemble the API a bit more and allow
persisting objects across LocalSessions. This is important because most
of the time the SDK classes create sessions behind the scenes.
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.