Skip to content

Commit 335fd60

Browse files
billdoorslaurenyu
authored andcommitted
doc: add version requirement for using "requirement.txt" when serving a PyTorch model (#1221)
Add PyTorch version requirement to allow installing packages during serving. Please check: aws/sagemaker-pytorch-inference-toolkit#28 for more information.
1 parent d229105 commit 335fd60

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

doc/using_pytorch.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,11 @@ Using third-party libraries
125125
When running your training script on SageMaker, it will have access to some pre-installed third-party libraries including ``torch``, ``torchvisopm``, and ``numpy``.
126126
For more information on the runtime environment, including specific package versions, see `SageMaker PyTorch Docker containers <#id4>`__.
127127

128-
If there are other packages you want to use with your script, you can include a ``requirements.txt`` file in the same directory as your training script to install other dependencies at runtime. Both ``requirements.txt`` and your training script should be put in the same folder. You must specify this folder in ``source_dir`` argument when creating a PyTorch estimator. A ``requirements.txt`` file is a text file that contains a list of items that are installed by using ``pip install``. You can also specify the version of an item to install.
129-
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.
128+
If there are other packages you want to use with your script, you can include a ``requirements.txt`` file in the same directory as your training script to install other dependencies at runtime. Both ``requirements.txt`` and your training script should be put in the same folder. You must specify this folder in ``source_dir`` argument when creating PyTorch estimator.
130129

130+
The function of installing packages using ``requirements.txt`` is supported for all PyTorch versions during training. When serving a PyTorch model, support for this function varies with PyTorch Versions. For PyTorch 1.3.1 or newer, ``requirements.txt`` must be under folder ``code``. SageMaker PyTorch Estimator will automatically save ``code`` in ``model.tar.gz`` after training (assuming you set up your script and ``requirements.txt`` correctly as stipulated in the previous paragraph). In the case of bringing your own trained model for deployment, you must save ``requirements.txt`` under folder ``code`` in ``model.tar.gz`` yourself. For PyTorch 1.2.0, ``requirements.txt`` is not supported for inference. For PyTorch 0.4.0 to 1.1.0, ``requirements.txt`` must be in ``source_dir``.
131+
132+
A ``requirements.txt`` file is a text file that contains a list of items that are installed by using ``pip install``. You can also specify the version of an item to install. 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.
131133

132134
Create an Estimator
133135
===================

0 commit comments

Comments
 (0)