From 7dd5407072176bb5cc186ae92cd43d1ff73e3d37 Mon Sep 17 00:00:00 2001 From: Lauren Yu <6631887+laurenyu@users.noreply.github.com> Date: Thu, 18 Jun 2020 10:00:44 -0700 Subject: [PATCH 1/2] doc: document that Local Mode + local code doesn't support dependencies arg --- src/sagemaker/chainer/estimator.py | 1 + src/sagemaker/estimator.py | 14 ++++++++++---- src/sagemaker/model.py | 15 +++++++++++---- src/sagemaker/mxnet/estimator.py | 1 + src/sagemaker/pytorch/estimator.py | 1 + src/sagemaker/rl/estimator.py | 1 + src/sagemaker/sklearn/estimator.py | 1 + src/sagemaker/tensorflow/estimator.py | 1 + src/sagemaker/xgboost/estimator.py | 1 + 9 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/sagemaker/chainer/estimator.py b/src/sagemaker/chainer/estimator.py index 19016447f8..dd8f5f378e 100644 --- a/src/sagemaker/chainer/estimator.py +++ b/src/sagemaker/chainer/estimator.py @@ -200,6 +200,7 @@ def create_model( dependencies (list[str]): A list of paths to directories (absolute or relative) with any additional libraries that will be exported to the container. If not specified, the dependencies from training are used. + This is not supported with "local code" in Local Mode. **kwargs: Additional kwargs passed to the ChainerModel constructor. Returns: diff --git a/src/sagemaker/estimator.py b/src/sagemaker/estimator.py index db3f47662f..00072db2f3 100644 --- a/src/sagemaker/estimator.py +++ b/src/sagemaker/estimator.py @@ -1528,11 +1528,16 @@ def __init__( copied to SageMaker in the same folder where the entrypoint is copied. If 'git_config' is provided, 'dependencies' should be a list of relative locations to directories with any additional - libraries needed in the Git repo. .. admonition:: Example + libraries needed in the Git repo. - The following call >>> Estimator(entry_point='train.py', - dependencies=['my/libs/common', 'virtual-env']) results in - the following inside the container: + .. admonition:: Example + + The following call + + >>> Estimator(entry_point='train.py', + ... dependencies=['my/libs/common', 'virtual-env']) + + results in the following inside the container: >>> $ ls @@ -1541,6 +1546,7 @@ def __init__( >>> |------ common >>> |------ virtual-env + This is not supported with "local code" in Local Mode. enable_network_isolation (bool): Specifies whether container will run in network isolation mode. Network isolation mode restricts the container access to outside networks (such as the internet). diff --git a/src/sagemaker/model.py b/src/sagemaker/model.py index e9d379f0b5..787b37091a 100644 --- a/src/sagemaker/model.py +++ b/src/sagemaker/model.py @@ -709,11 +709,16 @@ def __init__( list of relative locations to directories with any additional libraries needed in the Git repo. If the ```source_dir``` points to S3, code will be uploaded and the S3 location will be used - instead. .. admonition:: Example + instead. - The following call >>> Estimator(entry_point='inference.py', - dependencies=['my/libs/common', 'virtual-env']) results in - the following inside the container: + .. admonition:: Example + + The following call + + >>> Model(entry_point='inference.py', + ... dependencies=['my/libs/common', 'virtual-env']) + + results in the following inside the container: >>> $ ls @@ -721,6 +726,8 @@ def __init__( >>> |------ inference.py >>> |------ common >>> |------ virtual-env + + This is not supported with "local code" in Local Mode. git_config (dict[str, str]): Git configurations used for cloning files, including ``repo``, ``branch``, ``commit``, ``2FA_enabled``, ``username``, ``password`` and ``token``. The diff --git a/src/sagemaker/mxnet/estimator.py b/src/sagemaker/mxnet/estimator.py index a1432dc259..727a3f42b6 100644 --- a/src/sagemaker/mxnet/estimator.py +++ b/src/sagemaker/mxnet/estimator.py @@ -196,6 +196,7 @@ def create_model( dependencies (list[str]): A list of paths to directories (absolute or relative) with any additional libraries that will be exported to the container. If not specified, the dependencies from training are used. + This is not supported with "local code" in Local Mode. image_name (str): If specified, the estimator will use this image for hosting, instead of selecting the appropriate SageMaker official image based on framework_version and py_version. It can be an ECR url or dockerhub image and tag. diff --git a/src/sagemaker/pytorch/estimator.py b/src/sagemaker/pytorch/estimator.py index 0ba66b00d8..e51d6357b7 100644 --- a/src/sagemaker/pytorch/estimator.py +++ b/src/sagemaker/pytorch/estimator.py @@ -159,6 +159,7 @@ def create_model( dependencies (list[str]): A list of paths to directories (absolute or relative) with any additional libraries that will be exported to the container. If not specified, the dependencies from training are used. + This is not supported with "local code" in Local Mode. **kwargs: Additional kwargs passed to the :class:`~sagemaker.pytorch.model.PyTorchModel` constructor. diff --git a/src/sagemaker/rl/estimator.py b/src/sagemaker/rl/estimator.py index 60c67ef5de..2c945d14a0 100644 --- a/src/sagemaker/rl/estimator.py +++ b/src/sagemaker/rl/estimator.py @@ -199,6 +199,7 @@ def create_model( folders will be copied to SageMaker in the same folder where the entry_point is copied. If the ```source_dir``` points to S3, code will be uploaded and the S3 location will be used instead. + This is not supported with "local code" in Local Mode. **kwargs: Additional kwargs passed to the :class:`~sagemaker.model.FrameworkModel` constructor. diff --git a/src/sagemaker/sklearn/estimator.py b/src/sagemaker/sklearn/estimator.py index f13e300427..ea57cea411 100644 --- a/src/sagemaker/sklearn/estimator.py +++ b/src/sagemaker/sklearn/estimator.py @@ -179,6 +179,7 @@ def create_model( dependencies (list[str]): A list of paths to directories (absolute or relative) with any additional libraries that will be exported to the container. If not specified, the dependencies from training are used. + This is not supported with "local code" in Local Mode. **kwargs: Additional kwargs passed to the :class:`~sagemaker.sklearn.model.SKLearnModel` constructor. diff --git a/src/sagemaker/tensorflow/estimator.py b/src/sagemaker/tensorflow/estimator.py index c29daf9f69..b899f5500e 100644 --- a/src/sagemaker/tensorflow/estimator.py +++ b/src/sagemaker/tensorflow/estimator.py @@ -582,6 +582,7 @@ def create_model( If not specified and ``endpoint_type`` is 'tensorflow-serving', ``dependencies`` is set to ``None``. If ``endpoint_type`` is also ``None``, then the dependencies from training are used. + This is not supported with "local code" in Local Mode. **kwargs: Additional kwargs passed to :class:`~sagemaker.tensorflow.serving.Model` and :class:`~sagemaker.tensorflow.model.TensorFlowModel` constructors. diff --git a/src/sagemaker/xgboost/estimator.py b/src/sagemaker/xgboost/estimator.py index c6b0b5a95a..76e9cec316 100644 --- a/src/sagemaker/xgboost/estimator.py +++ b/src/sagemaker/xgboost/estimator.py @@ -155,6 +155,7 @@ def create_model( dependencies (list[str]): A list of paths to directories (absolute or relative) with any additional libraries that will be exported to the container. If not specified, the dependencies from training are used. + This is not supported with "local code" in Local Mode. **kwargs: Additional kwargs passed to the :class:`~sagemaker.xgboost.model.XGBoostModel` constructor. From f7bb8b77c5b1ec0131e7bd4258079ba096b548d9 Mon Sep 17 00:00:00 2001 From: Lauren Yu <6631887+laurenyu@users.noreply.github.com> Date: Thu, 18 Jun 2020 10:06:22 -0700 Subject: [PATCH 2/2] edit main doc --- doc/overview.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/overview.rst b/doc/overview.rst index 84bae6b69e..f8f95e2638 100644 --- a/doc/overview.rst +++ b/doc/overview.rst @@ -752,6 +752,9 @@ If you want to keep everything local, and not use Amazon S3 either, you can enab # pass sagemaker_session to your estimator or model +.. note:: + If you enable "local code," then you cannot use the ``dependencies`` parameter in your estimator or model. + We can take the example in `Using Estimators <#using-estimators>`__ , and use either ``local`` or ``local_gpu`` as the instance type. .. code:: python