|
1 |
| - |
2 | 1 | =======================================
|
3 | 2 | SageMaker PyTorch Estimators and Models
|
4 | 3 | =======================================
|
@@ -39,24 +38,21 @@ using to submit the script to SageMaker via a ``PyTorch`` Estimator. This will b
|
39 | 38 | Suppose that you already have a PyTorch training script called `pytorch-train.py`.
|
40 | 39 | You can then setup a ``PyTorch`` Estimator with keyword arguments to point to this script and define how SageMaker runs it:
|
41 | 40 |
|
42 |
| -```python |
| 41 | +.. code:: python |
43 | 42 |
|
44 | 43 | from sagemaker.pytorch import PyTorch
|
45 | 44 |
|
46 |
| - pytorch_estimator = PyTorch(entry_point="pytorch-train.py", |
47 |
| - role="SageMakerRole", |
48 |
| - train_instance_type="ml.p3.2xlarge", |
| 45 | + pytorch_estimator = PyTorch(entry_point='pytorch-train.py', |
| 46 | + role='SageMakerRole', |
| 47 | + train_instance_type='ml.p3.2xlarge', |
49 | 48 | train_instance_count=1)
|
50 |
| -``` |
51 | 49 |
|
52 | 50 | After that, you simply tell the estimator to start a training job and provide an S3 URL
|
53 | 51 | that is the path to your training data within Amazon S3:
|
54 | 52 |
|
55 |
| -```python |
56 |
| -
|
57 |
| - pytorch_estimator.fit("s3://bucket/path/to/training/data") |
| 53 | +.. code:: python |
58 | 54 |
|
59 |
| -``` |
| 55 | + pytorch_estimator.fit('s3://bucket/path/to/training/data') |
60 | 56 |
|
61 | 57 | In the following sections, we'll discuss how to prepare a training script for execution on SageMaker,
|
62 | 58 | then how to run that script on SageMaker using a ``PyTorch`` Estimator.
|
@@ -443,7 +439,7 @@ the model server receives two pieces of information:
|
443 | 439 | - The request data body, a byte array which is at most 5 MB (5 \* 1024
|
444 | 440 | \* 1024 bytes) in size.
|
445 | 441 |
|
446 |
| -The SageMaker PyTorch model server will invoke an "input_fn" function in your hosting script, |
| 442 | +The SageMaker PyTorch model server will invoke an ``input_fn`` function in your hosting script, |
447 | 443 | passing in this information. If you define an ``input_fn`` function definition,
|
448 | 444 | it should return an object that can be passed to ``predict_fn`` and have the following signature:
|
449 | 445 |
|
@@ -647,7 +643,7 @@ Please refer to:
|
647 | 643 |
|
648 | 644 | https://github.com/awslabs/amazon-sagemaker-examples/tree/master/sagemaker-python-sdk
|
649 | 645 |
|
650 |
| -These are also available in SageMaker Notebook Instance hosted Jupyter notebooks under the "sample notebooks" folder. |
| 646 | +These are also available in SageMaker Notebook Instance hosted Jupyter notebooks under the sample notebooks folder. |
651 | 647 |
|
652 | 648 |
|
653 | 649 | SageMaker PyTorch Docker Containers
|
|
0 commit comments