diff --git a/doc/algorithms/factorization_machines.rst b/doc/algorithms/factorization_machines.rst index 4427f0cd35..e6a509d167 100644 --- a/doc/algorithms/factorization_machines.rst +++ b/doc/algorithms/factorization_machines.rst @@ -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 diff --git a/doc/algorithms/ipinsights.rst b/doc/algorithms/ipinsights.rst index aea09bd478..f3aa8ac437 100644 --- a/doc/algorithms/ipinsights.rst +++ b/doc/algorithms/ipinsights.rst @@ -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 diff --git a/doc/algorithms/kmeans.rst b/doc/algorithms/kmeans.rst index ca468a30fc..bcf2b221bf 100644 --- a/doc/algorithms/kmeans.rst +++ b/doc/algorithms/kmeans.rst @@ -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: diff --git a/doc/algorithms/knn.rst b/doc/algorithms/knn.rst index 022d4704a8..89180ce3d8 100644 --- a/doc/algorithms/knn.rst +++ b/doc/algorithms/knn.rst @@ -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 diff --git a/doc/algorithms/lda.rst b/doc/algorithms/lda.rst index f6b965e577..394503b90b 100644 --- a/doc/algorithms/lda.rst +++ b/doc/algorithms/lda.rst @@ -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 diff --git a/doc/algorithms/linear_learner.rst b/doc/algorithms/linear_learner.rst index 7d5529e963..6c255c169d 100644 --- a/doc/algorithms/linear_learner.rst +++ b/doc/algorithms/linear_learner.rst @@ -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: diff --git a/doc/algorithms/ntm.rst b/doc/algorithms/ntm.rst index 47063f56aa..2d72cda2b2 100644 --- a/doc/algorithms/ntm.rst +++ b/doc/algorithms/ntm.rst @@ -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 diff --git a/doc/algorithms/object2vec.rst b/doc/algorithms/object2vec.rst index 05b37f0124..102db5ee5d 100644 --- a/doc/algorithms/object2vec.rst +++ b/doc/algorithms/object2vec.rst @@ -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, diff --git a/doc/algorithms/pca.rst b/doc/algorithms/pca.rst index 7924a0f771..68a5db29f3 100644 --- a/doc/algorithms/pca.rst +++ b/doc/algorithms/pca.rst @@ -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 diff --git a/doc/algorithms/randomcutforest.rst b/doc/algorithms/randomcutforest.rst index 48c290203b..b723319a52 100644 --- a/doc/algorithms/randomcutforest.rst +++ b/doc/algorithms/randomcutforest.rst @@ -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 diff --git a/doc/frameworks/chainer/using_chainer.rst b/doc/frameworks/chainer/using_chainer.rst index dd821b69e1..220eb8d3e1 100644 --- a/doc/frameworks/chainer/using_chainer.rst +++ b/doc/frameworks/chainer/using_chainer.rst @@ -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. @@ -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 @@ -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 diff --git a/doc/frameworks/pytorch/using_pytorch.rst b/doc/frameworks/pytorch/using_pytorch.rst index a395c67bcf..c2c4b3bf75 100644 --- a/doc/frameworks/pytorch/using_pytorch.rst +++ b/doc/frameworks/pytorch/using_pytorch.rst @@ -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 `_. -- ``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 - `_ 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 diff --git a/doc/frameworks/rl/using_rl.rst b/doc/frameworks/rl/using_rl.rst index 39b012faad..062fc9f7cf 100644 --- a/doc/frameworks/rl/using_rl.rst +++ b/doc/frameworks/rl/using_rl.rst @@ -14,10 +14,10 @@ RL Training Training RL models using ``RLEstimator`` is a two-step process: 1. Prepare a training script to run on SageMaker -2. Run this script on SageMaker via an ``RlEstimator``. +2. Run this script on SageMaker via an ``RLEstimator``. You should prepare your script in a separate source file than the notebook, terminal session, or source file you're -using to submit the script to SageMaker via an ``RlEstimator``. This will be discussed in further detail below. +using to submit the script to SageMaker via an ``RLEstimator``. This will be discussed in further detail below. Suppose that you already have a training script called ``coach-train.py``. You can then create an ``RLEstimator`` with keyword arguments to point to this script and define how SageMaker runs it: @@ -71,7 +71,7 @@ The ``RLEstimator`` constructor takes both required and optional arguments. Required arguments ~~~~~~~~~~~~~~~~~~ -The following are required arguments to the ``RLEstimator`` constructor. When you create an instance of RLEstimator, you must include +The following are required arguments to the ``RLEstimator`` constructor. When you create an instance of ``RLEstimator``, you must include these in the constructor, either positionally or as keyword arguments. - ``entry_point`` Path (absolute or relative) to the Python file which @@ -97,7 +97,7 @@ You must as well include either: or provide: -- ``image_name`` An alternative docker image to use for training and +- ``image_uri`` 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 RL Docker Containers @@ -108,85 +108,14 @@ or provide: Optional arguments ~~~~~~~~~~~~~~~~~~ -The following are optional arguments. When you create an ``RlEstimator`` 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. - - For example, the following call: - - .. code:: python - - >>> RLEstimator(entry_point='train.py', - toolkit=RLToolkit.COACH, - toolkit_version='0.11.0', - framework=RLFramework.TENSORFLOW, - dependencies=['my/libs/common', 'virtual-env']) - - results in the following inside the container: - - .. code:: bash - - >>> $ 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. -- ``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 +When you create an ``RLEstimator`` object, you can specify a number of optional arguments. +For more information, see :class:`sagemaker.rl.estimator.RLEstimator`. Calling fit ~~~~~~~~~~~ -You start your training script by calling ``fit`` on an ``RLEstimator``. ``fit`` takes a few optional -arguments. - -fit Optional arguments -'''''''''''''''''''''' - -- ``inputs``: This can take one of the following forms: A string - S3 URI, for example ``s3://my-bucket/my-training-data``. In this - case, the S3 objects rooted at the ``my-training-data`` prefix will - be available in the default ``train`` channel. A dict from - string channel names to S3 URIs. In this case, the objects rooted at - each S3 prefix will available as files in each channel directory. -- ``wait``: Defaults to True, whether to block and wait for the - training script to complete before returning. -- ``logs``: Defaults to True, whether to show logs produced by training - job in the Python session. Only meaningful when wait is True. - +You start your training script by calling ``fit`` on an ``RLEstimator``. +For more information about what arguments can be passed to ``fit``, see :func:`sagemaker.estimator.EstimatorBase.fit`. Distributed RL Training ----------------------- @@ -210,11 +139,11 @@ Deploying RL Models After an RL Estimator has been fit, you can host the newly created model in SageMaker. -After calling ``fit``, you can call ``deploy`` on an ``RlEstimator`` Estimator to create a SageMaker Endpoint. +After calling ``fit``, you can call ``deploy`` on an ``RLEstimator`` Estimator to create a SageMaker Endpoint. The Endpoint runs one of the SageMaker-provided model server based on the ``framework`` parameter specified in the ``RLEstimator`` constructor and hosts the model produced by your training script, which was run when you called ``fit``. This was the model you saved to ``model_dir``. -In case if ``image_name`` was specified it would use provided image for the deployment. +In case if ``image_uri`` was specified it would use provided image for the deployment. ``deploy`` returns a ``sagemaker.mxnet.MXNetPredictor`` for MXNet or ``sagemaker.tensorflow.TensorFlowPredictor`` for TensorFlow. diff --git a/doc/frameworks/sklearn/using_sklearn.rst b/doc/frameworks/sklearn/using_sklearn.rst index 540e3d79e6..8c3f63efd4 100644 --- a/doc/frameworks/sklearn/using_sklearn.rst +++ b/doc/frameworks/sklearn/using_sklearn.rst @@ -472,36 +472,7 @@ The following code sample shows how to do this, using the ``SKLearnModel`` class predictor = sklearn_model.deploy(instance_type="ml.c4.xlarge", initial_instance_count=1) -The sklearn_model 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 ``SKLearnModel`` constructor, see :class:`sagemaker.sklearn.model.SKLearnModel`. 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. @@ -530,69 +501,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.sklearn.SKLearn Class -******************************* +****************************** +SageMaker scikit-learn Classes +****************************** -The `SKLearn` constructor takes both required and optional arguments. - -Required arguments -================== - -The following are required arguments to the ``SKLearn`` constructor. When you create a Scikit-learn 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_type`` Type of EC2 instance to use for training, for - example, 'ml.m4.xlarge'. Please note that Scikit-learn does not have GPU support. - -Optional arguments -================== - -The following are optional arguments. When you create a ``SKLearn`` 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. -- ``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. -- ``base_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 Scikit-learn Docker Containers `_ for details on what the official images support - and where to find the source code to build your custom image. +For information about the different scikit-learn classes in the SageMaker Python SDK, see https://sagemaker.readthedocs.io/en/stable/frameworks/sklearn/sagemaker.sklearn.html. **************************************** SageMaker Scikit-learn Docker Containers diff --git a/doc/frameworks/tensorflow/upgrade_from_legacy.rst b/doc/frameworks/tensorflow/upgrade_from_legacy.rst index 458a4dca81..6eb292359a 100644 --- a/doc/frameworks/tensorflow/upgrade_from_legacy.rst +++ b/doc/frameworks/tensorflow/upgrade_from_legacy.rst @@ -75,7 +75,7 @@ Training When creating an estimator, the Python SDK version 2.0 and later requires the following changes: -#. Explicitly specify the ECR image URI via ``image_name``. +#. Explicitly specify the ECR image URI via ``image_uri``. To determine the URI, you can use :func:`sagemaker.fw_utils.create_image_uri`. #. Specify ``model_dir=False``. #. Use hyperparameters for ``training_steps``, ``evaluation_steps``, ``checkpoint_path``, and ``requirements_file``. @@ -106,7 +106,7 @@ the difference in code would be as follows: framework_version="1.10.0", py_version="py2", train_instance_type="ml.m4.xlarge", - image_name="520713654638.dkr.ecr.us-west-2.amazonaws.com/sagemaker-tensorflow:1.10.0-cpu-py2", + image_uri="520713654638.dkr.ecr.us-west-2.amazonaws.com/sagemaker-tensorflow:1.10.0-cpu-py2", hyperparameters={ "training_steps": 100, "evaluation_steps": 10, @@ -147,7 +147,7 @@ From a Trained Model If you are starting with a trained model, the Python SDK version 2.0 and later requires the following changes: #. Use the the :class:`sagemaker.model.FrameworkModel` class. -#. Explicitly specify the ECR image URI via ``image``. +#. Explicitly specify the ECR image URI via ``image_uri``. To determine the URI, you can use :func:`sagemaker.fw_utils.create_image_uri`. #. Use an environment variable for ``model_server_workers``. @@ -171,7 +171,7 @@ the difference in code would be as follows: model = FrameworkModel( ... - image="520713654638.dkr.ecr.us-west-2.amazonaws.com/sagemaker-tensorflow:1.10.0-cpu-py2", + image_uri="520713654638.dkr.ecr.us-west-2.amazonaws.com/sagemaker-tensorflow:1.10.0-cpu-py2", env={"MODEL_SERVER_WORKERS": 4}, ) diff --git a/doc/overview.rst b/doc/overview.rst index 40fd03984d..89de3312a0 100644 --- a/doc/overview.rst +++ b/doc/overview.rst @@ -418,7 +418,7 @@ Here is an example of how to define metrics: .. code:: python # Configure an BYO Estimator with metric definitions (no training happens yet) - byo_estimator = Estimator(image_name=image_name, + byo_estimator = Estimator(image_uri=image_uri, role='SageMakerRole', train_instance_count=1, train_instance_type='ml.c4.xlarge', sagemaker_session=sagemaker_session, @@ -994,7 +994,7 @@ the ML Pipeline. .. code:: python xgb_image = get_image_uri(sess.boto_region_name, 'xgboost', repo_version="latest") - xgb_model = Model(model_data='s3://path/to/model.tar.gz', image=xgb_image) + xgb_model = Model(model_data='s3://path/to/model.tar.gz', image_uri=xgb_image) sparkml_model = SparkMLModel(model_data='s3://path/to/model.tar.gz', env={'SAGEMAKER_SPARKML_SCHEMA': schema}) model_name = 'inference-pipeline-model' diff --git a/doc/v2.rst b/doc/v2.rst index 6cb82853af..3be98f4ef0 100644 --- a/doc/v2.rst +++ b/doc/v2.rst @@ -83,8 +83,8 @@ For more information, see `Upgrade from Legacy TensorFlow Support