Skip to content

doc: update documentation for image_name/image --> image_uri #1671

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

Merged
merged 2 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/algorithms/factorization_machines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The Amazon SageMaker Factorization Machines algorithm.
:undoc-members:
:show-inheritance:
:inherited-members:
:exclude-members: image, num_factors, predictor_type, epochs, clip_gradient, mini_batch_size, feature_dim, eps, rescale_grad, bias_lr, linear_lr, factors_lr, bias_wd, linear_wd, factors_wd, bias_init_method, bias_init_scale, bias_init_sigma, bias_init_value, linear_init_method, linear_init_scale, linear_init_sigma, linear_init_value, factors_init_method, factors_init_scale, factors_init_sigma, factors_init_value
:exclude-members: image_uri, num_factors, predictor_type, epochs, clip_gradient, mini_batch_size, feature_dim, eps, rescale_grad, bias_lr, linear_lr, factors_lr, bias_wd, linear_wd, factors_wd, bias_init_method, bias_init_scale, bias_init_sigma, bias_init_value, linear_init_method, linear_init_scale, linear_init_sigma, linear_init_value, factors_init_method, factors_init_scale, factors_init_sigma, factors_init_value


.. autoclass:: sagemaker.FactorizationMachinesModel
Expand Down
2 changes: 1 addition & 1 deletion doc/algorithms/ipinsights.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The Amazon SageMaker IP Insights algorithm.
:undoc-members:
:show-inheritance:
:inherited-members:
:exclude-members: image, num_entity_vectors, vector_dim, batch_metrics_publish_interval, epochs, learning_rate,
:exclude-members: image_uri, num_entity_vectors, vector_dim, batch_metrics_publish_interval, epochs, learning_rate,
num_ip_encoder_layers, random_negative_sampling_rate, shuffled_negative_sampling_rate, weight_decay

.. autoclass:: sagemaker.IPInsightsModel
Expand Down
2 changes: 1 addition & 1 deletion doc/algorithms/kmeans.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The Amazon SageMaker K-means algorithm.
:undoc-members:
:show-inheritance:
:inherited-members:
:exclude-members: image, k, init_method, max_iterations, tol, num_trials, local_init_method, half_life_time_size, epochs, center_factor, mini_batch_size, feature_dim, MAX_DEFAULT_BATCH_SIZE
:exclude-members: image_uri, k, init_method, max_iterations, tol, num_trials, local_init_method, half_life_time_size, epochs, center_factor, mini_batch_size, feature_dim, MAX_DEFAULT_BATCH_SIZE

.. autoclass:: sagemaker.KMeansModel
:members:
Expand Down
2 changes: 1 addition & 1 deletion doc/algorithms/knn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The Amazon SageMaker K-Nearest Neighbors (k-NN) algorithm.
:undoc-members:
:show-inheritance:
:inherited-members:
:exclude-members: image, k, sample_size, predictor_type, dimension_reduction_target, dimension_reduction_type,
:exclude-members: image_uri, k, sample_size, predictor_type, dimension_reduction_target, dimension_reduction_type,
index_metric, index_type, faiss_index_ivf_nlists, faiss_index_pq_m

.. autoclass:: sagemaker.KNNModel
Expand Down
2 changes: 1 addition & 1 deletion doc/algorithms/lda.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The Amazon SageMaker LDA algorithm.
:undoc-members:
:show-inheritance:
:inherited-members:
:exclude-members: image, num_topics, alpha0, max_restarts, max_iterations, mini_batch_size, feature_dim, tol
:exclude-members: image_uri, num_topics, alpha0, max_restarts, max_iterations, mini_batch_size, feature_dim, tol


.. autoclass:: sagemaker.LDAModel
Expand Down
2 changes: 1 addition & 1 deletion doc/algorithms/linear_learner.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The Amazon SageMaker LinearLearner algorithm.
:undoc-members:
:show-inheritance:
:inherited-members:
:exclude-members: image, train_instance_count, train_instance_type, predictor_type, binary_classifier_model_selection_criteria, target_recall, target_precision, positive_example_weight_mult, epochs, use_bias, num_models, parameter, num_calibration_samples, calibration, init_method, init_scale, init_sigma, init_bias, optimizer, loss, wd, l1, momentum, learning_rate, beta_1, beta_2, bias_lr_mult, use_lr_scheduler, lr_scheduler_step, lr_scheduler_factor, lr_scheduler_minimum_lr, lr_scheduler_minimum_lr, mini_batch_size, feature_dim, bias_wd_mult, MAX_DEFAULT_BATCH_SIZE
:exclude-members: image_uri, train_instance_count, train_instance_type, predictor_type, binary_classifier_model_selection_criteria, target_recall, target_precision, positive_example_weight_mult, epochs, use_bias, num_models, parameter, num_calibration_samples, calibration, init_method, init_scale, init_sigma, init_bias, optimizer, loss, wd, l1, momentum, learning_rate, beta_1, beta_2, bias_lr_mult, use_lr_scheduler, lr_scheduler_step, lr_scheduler_factor, lr_scheduler_minimum_lr, lr_scheduler_minimum_lr, mini_batch_size, feature_dim, bias_wd_mult, MAX_DEFAULT_BATCH_SIZE

.. autoclass:: sagemaker.LinearLearnerModel
:members:
Expand Down
4 changes: 2 additions & 2 deletions doc/algorithms/ntm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ The Amazon SageMaker NTM algorithm.
:undoc-members:
:show-inheritance:
:inherited-members:
:exclude-members: image, num_topics, encoder_layers, epochs, encoder_layers_activation, optimizer, tolerance,
num_patience_epochs, batch_norm, rescale_gradient, clip_gradient, weight_decay, learning_rate
:exclude-members: image_uri, num_topics, encoder_layers, epochs, encoder_layers_activation, optimizer, tolerance,
num_patience_epochs, batch_norm, rescale_gradient, clip_gradient, weight_decay, learning_rate


.. autoclass:: sagemaker.NTMModel
Expand Down
2 changes: 1 addition & 1 deletion doc/algorithms/object2vec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The Amazon SageMaker Object2Vec algorithm.
:undoc-members:
:show-inheritance:
:inherited-members:
:exclude-members: image, enc_dim, mini_batch_size, epochs, early_stopping_patience, early_stopping_tolerance,
:exclude-members: image_uri, enc_dim, mini_batch_size, epochs, early_stopping_patience, early_stopping_tolerance,
dropout, weight_decay, bucket_width, num_classes, mlp_layers, mlp_dim, mlp_activation,
output_layer, optimizer, learning_rate, enc0_network, enc1_network, enc0_cnn_filter_width,
enc1_cnn_filter_width, enc0_max_seq_len, enc1_max_seq_len, enc0_token_embedding_dim,
Expand Down
2 changes: 1 addition & 1 deletion doc/algorithms/pca.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The Amazon SageMaker PCA algorithm.
:undoc-members:
:show-inheritance:
:inherited-members:
:exclude-members: image, num_components, algorithm_mode, subtract_mean, extra_components, mini_batch_size, feature_dim, MAX_DEFAULT_BATCH_SIZE
:exclude-members: image_uri, num_components, algorithm_mode, subtract_mean, extra_components, mini_batch_size, feature_dim, MAX_DEFAULT_BATCH_SIZE


.. autoclass:: sagemaker.PCAModel
Expand Down
2 changes: 1 addition & 1 deletion doc/algorithms/randomcutforest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The Amazon SageMaker Random Cut Forest algorithm.
:undoc-members:
:show-inheritance:
:inherited-members:
:exclude-members: image, num_trees, num_samples_per_tree, eval_metrics, feature_dim, MINI_BATCH_SIZE
:exclude-members: image_uri, num_trees, num_samples_per_tree, eval_metrics, feature_dim, MINI_BATCH_SIZE


.. autoclass:: sagemaker.RandomCutForestModel
Expand Down
128 changes: 12 additions & 116 deletions doc/frameworks/chainer/using_chainer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -492,41 +492,15 @@ The following code sample shows how to do this, using the ``ChainerModel`` class

.. code:: python

chainer_model = ChainerModel(model_data="s3://bucket/model.tar.gz", role="SageMakerRole",
entry_point="transform_script.py")
chainer_model = ChainerModel(
model_data="s3://bucket/model.tar.gz",
role="SageMakerRole",
entry_point="transform_script.py",
)

predictor = chainer_model.deploy(instance_type="ml.c4.xlarge", initial_instance_count=1)

The ChainerModel constructor takes the following arguments:

- ``model_data (str):`` An S3 location of a SageMaker model data
.tar.gz file
- ``image (str):`` A Docker image URI
- ``role (str):`` An IAM role name or Arn for SageMaker to access AWS
resources on your behalf.
- ``predictor_cls (callable[string,sagemaker.Session]):`` A function to
call to create a predictor. If not None, ``deploy`` will return the
result of invoking this function on the created endpoint name
- ``env (dict[string,string]):`` Environment variables to run with
``image`` when hosted in SageMaker.
- ``name (str):`` The model name. If None, a default model name will be
selected on each ``deploy.``
- ``entry_point (str):`` Path (absolute or relative) to the Python file
which should be executed as the entry point to model hosting.
- ``source_dir (str):`` Optional. Path (absolute or relative) to a
directory with any other training source code dependencies including
the entry point file. Structure within this directory will be
preserved when training on SageMaker.
- ``enable_cloudwatch_metrics (boolean):`` Optional. If true, training
and hosting containers will generate Cloudwatch metrics under the
AWS/SageMakerContainer namespace.
- ``container_log_level (int):`` Log level to use within the container.
Valid values are defined in the Python logging module.
- ``code_location (str):`` Optional. Name of the S3 bucket where your
custom code will be uploaded to. If not specified, will use the
SageMaker default bucket created by sagemaker.Session.
- ``sagemaker_session (sagemaker.Session):`` The SageMaker Session
object, used for SageMaker interaction"""
To see what arguments are accepted by the ``ChainerModel`` constructor, see :class:`sagemaker.chainer.model.ChainerModel`.

Your model data must be a .tar.gz file in S3. SageMaker Training Job model data is saved to .tar.gz files in S3,
however if you have local data you want to deploy, you can prepare the data yourself.
Expand Down Expand Up @@ -556,89 +530,11 @@ https://github.com/awslabs/amazon-sagemaker-examples/tree/master/sagemaker-pytho

These are also available in SageMaker Notebook Instance hosted Jupyter notebooks under the "sample notebooks" folder.

*******************************
sagemaker.chainer.Chainer Class
*******************************

The `Chainer` constructor takes both required and optional arguments.

Required arguments
==================

The following are required arguments to the ``Chainer`` constructor. When you create a Chainer object, you must include
these in the constructor, either positionally or as keyword arguments.

- ``entry_point`` Path (absolute or relative) to the Python file which
should be executed as the entry point to training.
- ``role`` An AWS IAM role (either name or full ARN). The Amazon
SageMaker training jobs and APIs that create Amazon SageMaker
endpoints use this role to access training data and model artifacts.
After the endpoint is created, the inference code might use the IAM
role, if accessing AWS resource.
- ``train_instance_count`` Number of Amazon EC2 instances to use for
training.
- ``train_instance_type`` Type of EC2 instance to use for training, for
example, 'ml.m4.xlarge'.

Optional arguments
==================

The following are optional arguments. When you create a ``Chainer`` object, you can specify these as keyword arguments.

- ``source_dir`` Path (absolute or relative) to a directory with any
other training source code dependencies including the entry point
file. Structure within this directory will be preserved when training
on SageMaker.
- ``dependencies (list[str])`` A list of paths to directories (absolute or relative) with
any additional libraries that will be exported to the container (default: []).
The library folders will be copied to SageMaker in the same folder where the entrypoint is copied.
If the ```source_dir``` points to S3, code will be uploaded and the S3 location will be used
instead. Example:

The following call
>>> Chainer(entry_point='train.py', dependencies=['my/libs/common', 'virtual-env'])
results in the following inside the container:

>>> $ ls

>>> opt/ml/code
>>> ├── train.py
>>> ├── common
>>> └── virtual-env

- ``hyperparameters`` Hyperparameters that will be used for training.
Will be made accessible as a dict[str, str] to the training code on
SageMaker. For convenience, accepts other types besides str, but
str() will be called on keys and values to convert them before
training.
- ``py_version`` Python version you want to use for executing your
model training code.
- ``train_volume_size`` Size in GB of the EBS volume to use for storing
input data during training. Must be large enough to store training
data if input_mode='File' is used (which is the default).
- ``train_max_run`` Timeout in seconds for training, after which Amazon
SageMaker terminates the job regardless of its current status.
- ``input_mode`` The input mode that the algorithm supports. Valid
modes: 'File' - Amazon SageMaker copies the training dataset from the
s3 location to a directory in the Docker container. 'Pipe' - Amazon
SageMaker streams data directly from s3 to the container via a Unix
named pipe.
- ``output_path`` s3 location where you want the training result (model
artifacts and optional output files) saved. If not specified, results
are stored to a default bucket. If the bucket with the specific name
does not exist, the estimator creates the bucket during the fit()
method execution.
- ``output_kms_key`` Optional KMS key ID to optionally encrypt training
output with.
- ``job_name`` Name to assign for the training job that the fit()
method launches. If not specified, the estimator generates a default
job name, based on the training image name and current timestamp
- ``image_name`` An alternative docker image to use for training and
serving. If specified, the estimator will use this image for training and
hosting, instead of selecting the appropriate SageMaker official image based on
framework_version and py_version. Refer to: `SageMaker Chainer Docker Containers
<#sagemaker-chainer-docker-containers>`__ for details on what the Official images support
and where to find the source code to build your custom image.
*************************
SageMaker Chainer Classes
*************************

For information about the different Chainer-related classes in the SageMaker Python SDK, see https://sagemaker.readthedocs.io/en/stable/frameworks/chainer/sagemaker.chainer.html.

***********************************
SageMaker Chainer Docker containers
Expand Down Expand Up @@ -689,6 +585,6 @@ specify major and minor version, which will cause your training script to be run
version of that minor version.

Alternatively, you can build your own image by following the instructions in the SageMaker Chainer containers
repository, and passing ``image_name`` to the Chainer Estimator constructor.
repository, and passing ``image_uri`` to the Chainer Estimator constructor.

You can visit the SageMaker Chainer containers repository at https://github.com/aws/sagemaker-chainer-container
91 changes: 5 additions & 86 deletions doc/frameworks/pytorch/using_pytorch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -667,92 +667,11 @@ https://github.com/awslabs/amazon-sagemaker-examples/tree/master/sagemaker-pytho

These are also available in SageMaker Notebook Instance hosted Jupyter notebooks under the sample notebooks folder.

******************
PyTorch Estimators
******************

The `PyTorch` constructor takes both required and optional arguments.

Required arguments
==================

The following are required arguments to the ``PyTorch`` constructor. When you create a PyTorch object, you must include
these in the constructor, either positionally or as keyword arguments.

- ``entry_point`` Path (absolute or relative) to the Python file which
should be executed as the entry point to training.
- ``role`` An AWS IAM role (either name or full ARN). The Amazon
SageMaker training jobs and APIs that create Amazon SageMaker
endpoints use this role to access training data and model artifacts.
After the endpoint is created, the inference code might use the IAM
role, if accessing AWS resource.
- ``train_instance_count`` Number of Amazon EC2 instances to use for
training.
- ``train_instance_type`` Type of EC2 instance to use for training, for
example, 'ml.m4.xlarge'.

Optional arguments
==================

The following are optional arguments. When you create a ``PyTorch`` object, you can specify these as keyword arguments.

- ``source_dir`` Path (absolute or relative) to a directory with any
other training source code dependencies including the entry point
file. Structure within this directory will be preserved when training
on SageMaker.
- ``dependencies (list[str])`` A list of paths to directories (absolute or relative) with
any additional libraries that will be exported to the container (default: []).
The library folders will be copied to SageMaker in the same folder where the entrypoint is copied.
If the ```source_dir``` points to S3, code will be uploaded and the S3 location will be used
instead. Example:

The following call
>>> PyTorch(entry_point='train.py', dependencies=['my/libs/common', 'virtual-env'])
results in the following inside the container:

>>> $ ls

>>> opt/ml/code
>>> ├── train.py
>>> ├── common
>>> └── virtual-env

- ``hyperparameters`` Hyperparameters that will be used for training.
Will be made accessible as a dict[str, str] to the training code on
SageMaker. For convenience, accepts other types besides strings, but
``str`` will be called on keys and values to convert them before
training.
- ``py_version`` Python version you want to use for executing your
model training code.
- ``framework_version`` PyTorch version you want to use for executing
your model training code. You can find the list of supported versions
in `SageMaker PyTorch Docker Containers <https://github.com/aws/sagemaker-python-sdk/tree/master/src/sagemaker/pytorch#sagemaker-pytorch-docker-containers>`_.
- ``train_volume_size`` Size in GB of the EBS volume to use for storing
input data during training. Must be large enough to store training
data if input_mode='File' is used (which is the default).
- ``train_max_run`` Timeout in seconds for training, after which Amazon
SageMaker terminates the job regardless of its current status.
- ``input_mode`` The input mode that the algorithm supports. Valid
modes: 'File' - Amazon SageMaker copies the training dataset from the
S3 location to a directory in the Docker container. 'Pipe' - Amazon
SageMaker streams data directly from S3 to the container via a Unix
named pipe.
- ``output_path`` S3 location where you want the training result (model
artifacts and optional output files) saved. If not specified, results
are stored to a default bucket. If the bucket with the specific name
does not exist, the estimator creates the bucket during the ``fit``
method execution.
- ``output_kms_key`` Optional KMS key ID to optionally encrypt training
output with.
- ``job_name`` Name to assign for the training job that the ``fit```
method launches. If not specified, the estimator generates a default
job name, based on the training image name and current timestamp
- ``image_name`` An alternative docker image to use for training and
serving. If specified, the estimator will use this image for training and
hosting, instead of selecting the appropriate SageMaker official image based on
framework_version and py_version. Refer to: `SageMaker PyTorch Docker Containers
<https://github.com/aws/sagemaker-python-sdk/tree/master/src/sagemaker/pytorch#sagemaker-pytorch-docker-containers>`_ for details on what the Official images support
and where to find the source code to build your custom image.
*************************
SageMaker PyTorch Classes
*************************

For information about the different PyTorch-related classes in the SageMaker Python SDK, see https://sagemaker.readthedocs.io/en/stable/frameworks/pytorch/sagemaker.pytorch.html.

***********************************
SageMaker PyTorch Docker Containers
Expand Down
Loading