-
Notifications
You must be signed in to change notification settings - Fork 162
Add Script Mode example #83
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
"source": [ | ||
"# Using the Script Mode to train any TensorFlow script from GitHub in SageMaker\n", | ||
"\n", | ||
"In this tutorial, we will show how is simple to train a TensorFlow script in SageMaker using the new Script Mode Tensorflow Container.\n", |
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.
how simple it is
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 show"
present tense, when possible, is easier to read and translate
"\n", | ||
"In this tutorial, we will show how is simple to train a TensorFlow script in SageMaker using the new Script Mode Tensorflow Container.\n", | ||
"\n", | ||
"The example the we choosed is [Multi-layer Recurrent Neural Networks (LSTM, RNN) for character-level language models in Python using Tensorflow](https://github.com/sherjilozair/char-rnn-tensorflow) but this same technique can be use to other scripts/repos including [TensorFlow Model Zoo](https://github.com/tensorflow/models) and [TensorFlow benchmark scripts](https://github.com/tensorflow/benchmarks/tree/master/scripts/tf_cnn_benchmarks).\n" |
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.
s/choosed/chose
"source": [ | ||
"## How does it work\n", | ||
"\n", | ||
"The cell above downloaded a Python 3 CPU container locally and used it to simulate SageMaker training. When training starts, the script mode will invoke the following command inside the container:\n", |
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.
When training starts, the container will invoke the 'train.py' script as shown bellow:
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 have more edits to suggest, but it would be easier for me to do a full edit in Jupyter, and submit that as a PR.
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'd like to submit an edit of the notebook as a PR
"source": [ | ||
"# Using the Script Mode to train any TensorFlow script from GitHub in SageMaker\n", | ||
"\n", | ||
"In this tutorial, we will show how is simple to train a TensorFlow script in SageMaker using the new Script Mode Tensorflow Container.\n", |
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 show"
present tense, when possible, is easier to read and translate
"source": [ | ||
"## How does it work\n", | ||
"\n", | ||
"The cell above downloaded a Python 3 CPU container locally and used it to simulate SageMaker training. When training starts, the script mode will invoke the following command inside the container:\n", |
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 have more edits to suggest, but it would be easier for me to do a full edit in Jupyter, and submit that as a PR.
"from sagemaker.estimator import Framework\n", | ||
"from sagemaker.tensorflow import TensorFlow\n", | ||
"\n", | ||
"class ScriptModeTensorFlow(Framework):\n", |
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.
Current design is to add a flag to the existing TensorFlow estimator, script_mode=true. I talked to yuan briefly last week, we are going to deprioritize the sdk change until we get some feedbacks from the beta customers.
Beta users can use the current TensorFlow estimator with the script-mode containers. They just have to specify the entire image uri and ignore the extra arguments we passed in as hyperparamters, eg, training_steps and eval_steps. I think we can explain all of that here.
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 script in this example breaks with the TF estimator because the additional hyperparameters, which is why I had to create the estimator.
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 see. I think Nadia's idea of use scriptmode with py3 might work. This is fine as is and we can modify this notebook once we made the changes to the sdk.
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"inputs = sagemaker_session.upload_data(path='sherlock', bucket=bucket, key_prefix='datasets/sherlock')" |
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 testing with localmode, we can point it out that the users can use the training data on disk.
* Add Script Mode example
* Add Script Mode example
Description of changes:
Example on how to use the Script Mode container.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.