You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/using_tf.rst
+30-3
Original file line number
Diff line number
Diff line change
@@ -133,6 +133,34 @@ In your training script the channels will be stored in environment variables ``S
133
133
``output_path``.
134
134
135
135
136
+
Use third-party libraries
137
+
-------------------------
138
+
139
+
If there are other packages you want to use with your script, you can use a ``requirements.txt`` to install other dependencies at runtime.
140
+
141
+
For training, support for installing packages using ``requirements.txt`` varies by TensorFlow version as follows:
142
+
143
+
- For TensorFlow 1.11 or newer using Script Mode without Horovod, TensorFlow 1.15.2 with Python 3.7 or newer, and TensorFlow 2.2 or newer:
144
+
- Include a ``requirements.txt`` file in the same directory as your training script.
145
+
- You must specify this directory using the ``source_dir`` argument when creating a TensorFlow estimator.
146
+
- For older versions of TensorFlow using Script Mode with Horovod:
147
+
- Write a shell script for your entry point that first calls ``pip install -r requirements.txt``, then runs your training script.
148
+
- For an example of using shell scripts, see `this example notebook <https://github.com/awslabs/amazon-sagemaker-examples/blob/master/sagemaker-python-sdk/tensorflow_script_mode_using_shell_commands/tensorflow_script_mode_using_shell_commands.ipynb>`__.
149
+
- For older versions of TensorFlow using Legacy Mode:
150
+
- Specify the path to your ``requirements.txt`` file using the ``requirements_file`` argument.
151
+
152
+
For serving, support for installing packages using ``requirements.txt`` varies by TensorFlow version as follows:
153
+
154
+
- For TensorFlow 1.11 or newer:
155
+
- Include a ``requirements.txt`` file in the ``code`` directory.
156
+
- For older versions of TensorFlow:
157
+
- Specify the path to your ``requirements.txt`` file using the ``SAGEMAKER_REQUIREMENTS`` environment variable.
158
+
159
+
A ``requirements.txt`` file is a text file that contains a list of items that are installed by using ``pip install``.
160
+
You can also specify the version of an item to install.
161
+
For information about the format of a ``requirements.txt`` file, see `Requirements Files <https://pip.pypa.io/en/stable/user_guide/#requirements-files>`__ in the pip documentation.
162
+
163
+
136
164
Create an Estimator
137
165
===================
138
166
@@ -215,7 +243,7 @@ Calling ``fit`` starts a SageMaker training job. The training job will execute t
215
243
- starts asynchronous training
216
244
217
245
If the ``wait=False`` flag is passed to ``fit``, then it returns immediately. The training job continues running
218
-
asynchronously. Later, a Tensorflow estimator can be obtained by attaching to the existing training job.
246
+
asynchronously. Later, a TensorFlow estimator can be obtained by attaching to the existing training job.
219
247
If the training job is not finished, it starts showing the standard output of training and wait until it completes.
220
248
After attaching, the estimator can be deployed as usual.
221
249
@@ -882,8 +910,7 @@ in the following code:
882
910
You can also bring in external dependencies to help with your data
883
911
processing. There are 2 ways to do this:
884
912
885
-
1. If you included ``requirements.txt`` in your ``source_dir`` or in
886
-
your dependencies, the container installs the Python dependencies at runtime using ``pip install -r``:
913
+
1. If your model archive contains ``code/requirements.txt``, the container will install the Python dependencies at runtime using ``pip install -r``.
0 commit comments