-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Component] Add Managed Spot Training Support for SageMaker #2219
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
Hi @RedbackThomson. Thanks for your PR. I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@googlebot I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
/assign @Jeffwan |
Still need to upload and edit the new container into the configuration. Not ready to merge yet. |
@RedbackThomson Could you make sure the interface changes are included in |
default: '86400' | ||
- name: checkpoint_config | ||
description: 'Dictionary of information about the output location for managed spot training checkpoint data.' | ||
default: '{}' |
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.
JFYI: The recent SDK (0.1.29+) supports the JsonObject
type. Constant list arguments passed to type: JsonObject
inputs will be serialized as JSON.
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.
Does this update support nicer/easier input in the UI for JSON fields?
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 yet. For now it only works for constant lists passed to components. The auto-conversion does not work in UX or when passing arguments to pipeline during the submission.
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.
So this will only work for this case:
aws_sagemaker_trainop(..., checkpoint_config={'a' = 1, 'b' = 1},...)
Previously this would have just resulted in some wrong string (produced by str()
) being passed. Now it would be json.dumps
-serialized string.
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 is a great addition. Is there any way to suppress the warning that dsl-compile
throws when it infers the JsonObject type?
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.
Is there any way to suppress the warning that
dsl-compile
throws when it infers the JsonObject type?
The warning is shown every time a non-string argument is passed to an untyped input.
The easiest way to make it go away is to add the type to the input. Then there would be no inference.
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.
The easiest way to make it go away is to add the type to the input.
Through explicit cast?
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.
Through explicit cast?
No. Just add the type
attribute to the input annotation:
- name: checkpoint_config
type: JsonObject
description: 'Dictionary of information about the output location for managed spot training checkpoint data.'
default: '{}'
/hold |
@Jeffwan While we wait for a more permanent container location, I wanted to push this (and another feature through). I've built this container onto my own personal repository. |
/hold cancel |
/ok-to-test |
I hope to create a separate PR for |
@@ -72,6 +75,9 @@ def mnist_classification(region='us-west-2', | |||
"CompressionType": "None", \ | |||
"RecordWrapperType": "None", \ | |||
"InputMode": "File"}]', | |||
train_spot_instance='False', |
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.
Ok. I see the changes on the example side.
### Start spot instance support | ||
parser.add_argument('--spot_instance', type=_utils.str_to_bool, required=False, help='Use managed spot training.', default=False) | ||
parser.add_argument('--max_wait_time', type=_utils.str_to_int, required=False, help='The maximum time in seconds you are willing to wait for a managed spot training job to complete.', default=86400) | ||
parser.add_argument('--checkpoint_config', type=_utils.str_to_json_dict, required=False, help='Dictionary of information about the output location for managed spot training checkpoint data.', default='{}') |
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 am curious checkpoint_config
is just for spot training? isn't it a generic 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.
Correct. The script will only create a checkpoint if it is interrupted by spot instance downtime. Otherwise, it will run from start to finish.
/lgtm Wait for one day to see other reviewers have follow up comments. @Ark-kun |
Is this ready to merge? |
/approve |
/approve cancel |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Jeffwan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Adds the ability to enable managed spot training as a configuration option for the Sagemaker component.
Added unit tests for the new feature as can be found in the
tests/
folder in root.This change is