Skip to content

doc: JumpStart Utility Doc Update #3866

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 14 commits into from
Jun 2, 2023
1 change: 1 addition & 0 deletions doc/api/inference/deserializers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Deserializers
:members:
:undoc-members:
:show-inheritance:

6 changes: 6 additions & 0 deletions doc/api/inference/model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ Model
:show-inheritance:
:inherited-members:

.. autoclass:: sagemaker.jumpstart.model.JumpStartModel
:members:
:undoc-members:
:show-inheritance:
:inherited-members:

.. autoclass:: sagemaker.model.FrameworkModel
:members:
:undoc-members:
Expand Down
1 change: 1 addition & 0 deletions doc/api/inference/serializers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Serializers
:members:
:undoc-members:
:show-inheritance:

6 changes: 6 additions & 0 deletions doc/api/training/estimators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ A high level interface for SageMaker training
:show-inheritance:
:inherited-members:

.. autoclass:: sagemaker.jumpstart.estimator.JumpStartEstimator
:members:
:undoc-members:
:show-inheritance:
:inherited-members:

.. autoclass:: sagemaker.estimator.Framework
:members:
:undoc-members:
Expand Down
8 changes: 8 additions & 0 deletions doc/api/utility/accept_types.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Accept Types
------------

.. automodule:: sagemaker.accept_types
:members:
:undoc-members:
:show-inheritance:
:private-members:
8 changes: 8 additions & 0 deletions doc/api/utility/content_types.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Content Types
-------------

.. automodule:: sagemaker.content_types
:members:
:undoc-members:
:show-inheritance:
:private-members:
1 change: 1 addition & 0 deletions doc/api/utility/hyperparameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Hyperparameters
:members:
:undoc-members:
:show-inheritance:

8 changes: 8 additions & 0 deletions doc/api/utility/instance_types.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Instance Types
--------------

.. automodule:: sagemaker.instance_types
:members:
:undoc-members:
:show-inheritance:
:private-members:
8 changes: 8 additions & 0 deletions doc/api/utility/metric_definitions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Metric Definitions
------------------

.. automodule:: sagemaker.metric_definitions
:members:
:undoc-members:
:show-inheritance:
:private-members:
327 changes: 248 additions & 79 deletions doc/overview.rst

Large diffs are not rendered by default.

43 changes: 18 additions & 25 deletions src/sagemaker/jumpstart/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ def __init__(
when training on Amazon SageMaker. If 'git_config' is provided,
'source_dir' should be a relative location to a directory in the Git
repo.
(Default: None).

.. admonition:: Example

Expand All @@ -353,7 +354,6 @@ def __init__(
if you need 'train.py'
as the entry point and 'test.py' as the training source code, you can assign
entry_point='train.py', source_dir='src'.
(Default: None).
git_config (Optional[dict[str, str]]): Git configurations used for cloning
files, including ``repo``, ``branch``, ``commit``,
``2FA_enabled``, ``username``, ``password`` and ``token``. The
Expand All @@ -363,18 +363,6 @@ def __init__(
'master' is used. If you don't provide ``commit``, the latest
commit in the specified branch is used.

.. admonition:: Example

The following config:

>>> git_config = {'repo': 'https://github.com/aws/sagemaker-python-sdk.git',
>>> 'branch': 'test-branch-git-config',
>>> 'commit': '329bfcf884482002c05ff7f44f62599ebc9f445a'}

results in cloning the repo specified in 'repo', then
checking out the 'master' branch, and checking out the specified
commit.

``2FA_enabled``, ``username``, ``password`` and ``token`` are
used for authentication. For GitHub (or other Git) accounts, set
``2FA_enabled`` to 'True' if two-factor authentication is
Expand Down Expand Up @@ -405,6 +393,17 @@ def __init__(
the SageMaker Python SDK attempts to use either the CodeCommit
credential helper or local credential storage for authentication.
(Default: None).

.. admonition:: Example
The following config:

>>> git_config = {'repo': 'https://github.com/aws/sagemaker-python-sdk.git',
>>> 'branch': 'test-branch-git-config',
>>> 'commit': '329bfcf884482002c05ff7f44f62599ebc9f445a'}

results in cloning the repo specified in 'repo', then
checking out the 'master' branch, and checking out the specified
commit.
container_log_level (Optional[Union[int, PipelineVariable]]): The log level to use
within the container. Valid values are defined in the Python logging module.
(Default: None).
Expand All @@ -420,8 +419,9 @@ def __init__(
must point to a file located at the root of ``source_dir``.
If 'git_config' is provided, 'entry_point' should be
a relative location to the Python source file in the Git repo.
(Default: None).

Example:
.. admonition:: Example
With the following GitHub repo directory structure:

>>> |----- README.md
Expand All @@ -430,18 +430,16 @@ def __init__(
>>> |----- test.py

You can assign entry_point='src/train.py'.

(Default: None).
dependencies (Optional[list[str]]): A list of absolute or relative paths to directories
with any additional libraries that should be exported
to the container. The library folders are
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.
libraries needed in the Git repo. This is not supported with "local code"
in Local Mode. (Default: None).

.. admonition:: Example

The following Estimator call:

>>> Estimator(entry_point='train.py',
Expand All @@ -455,9 +453,6 @@ def __init__(
>>> |------ train.py
>>> |------ common
>>> |------ virtual-env

This is not supported with "local code" in Local Mode.
(Default: None).
instance_groups (Optional[list[:class:`sagemaker.instance_group.InstanceGroup`]]):
A list of ``InstanceGroup`` objects for launching a training job with a
heterogeneous cluster. For example:
Expand All @@ -475,8 +470,7 @@ def __init__(
through the SageMaker generic and framework estimator classes, see
`Train Using a Heterogeneous Cluster
<https://docs.aws.amazon.com/sagemaker/latest/dg/train-heterogeneous-cluster.html>`_
in the *Amazon SageMaker developer guide*.
(Default: None).
in the *Amazon SageMaker developer guide*. (Default: None).
training_repository_access_mode (Optional[str]): Specifies how SageMaker accesses the
Docker image that contains the training algorithm (Default: None).
Set this to one of the following values:
Expand Down Expand Up @@ -797,7 +791,7 @@ def deploy(
when training on Amazon SageMaker. If 'git_config' is provided,
'source_dir' should be a relative location to a directory in the Git repo.
If the directory points to S3, no code is uploaded and the S3 location
is used instead.
is used instead. (Default: None).

.. admonition:: Example

Expand All @@ -809,7 +803,6 @@ def deploy(
>>> |----- test.py

You can assign entry_point='inference.py', source_dir='src'.
(Default: None).
code_location (Optional[str]): Name of the S3 bucket where custom code is
uploaded (Default: None). If not specified, the default bucket
created by ``sagemaker.session.Session`` is used. (Default: None).
Expand Down
37 changes: 15 additions & 22 deletions src/sagemaker/jumpstart/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def __init__(
when training on Amazon SageMaker. If 'git_config' is provided,
'source_dir' should be a relative location to a directory in the Git repo.
If the directory points to S3, no code is uploaded and the S3 location
is used instead.
is used instead. (Default: None).

.. admonition:: Example

Expand All @@ -150,7 +150,6 @@ def __init__(
>>> |----- test.py

You can assign entry_point='inference.py', source_dir='src'.
(Default: None).
code_location (Optional[str]): Name of the S3 bucket where custom code is
uploaded (Default: None). If not specified, the default bucket
created by ``sagemaker.session.Session`` is used. (Default: None).
Expand All @@ -159,9 +158,9 @@ def __init__(
model hosting. (Default: None). If ``source_dir`` is specified, then ``entry_point``
must point to a file located at the root of ``source_dir``.
If 'git_config' is provided, 'entry_point' should be
a relative location to the Python source file in the Git repo.
a relative location to the Python source file in the Git repo. (Default: None).

Example:
.. admonition:: Example
With the following GitHub repo directory structure:

>>> |----- README.md
Expand All @@ -170,8 +169,6 @@ def __init__(
>>> |----- test.py

You can assign entry_point='src/inference.py'.

(Default: None).
container_log_level (Optional[Union[int, PipelineVariable]]): Log level to use
within the container. Valid values are defined in the Python
logging module. (Default: None).
Expand All @@ -183,7 +180,8 @@ 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.
instead. This is not supported with "local code" in Local Mode.
(Default: None).

.. admonition:: Example

Expand All @@ -200,9 +198,6 @@ def __init__(
>>> |------ inference.py
>>> |------ common
>>> |------ virtual-env

This is not supported with "local code" in Local Mode.
(Default: None).
git_config (Optional[dict[str, str]]): Git configurations used for cloning
files, including ``repo``, ``branch``, ``commit``,
``2FA_enabled``, ``username``, ``password`` and ``token``. The
Expand All @@ -212,18 +207,6 @@ def __init__(
'master' is used. If you don't provide ``commit``, the latest
commit in the specified branch is used.

.. admonition:: Example

The following config:

>>> git_config = {'repo': 'https://github.com/aws/sagemaker-python-sdk.git',
>>> 'branch': 'test-branch-git-config',
>>> 'commit': '329bfcf884482002c05ff7f44f62599ebc9f445a'}

results in cloning the repo specified in 'repo', then
checking out the 'master' branch, and checking out the specified
commit.

``2FA_enabled``, ``username``, ``password`` and ``token`` are
used for authentication. For GitHub (or other Git) accounts, set
``2FA_enabled`` to 'True' if two-factor authentication is
Expand Down Expand Up @@ -255,6 +238,16 @@ def __init__(
credential helper or local credential storage for authentication.
(Default: None).

.. admonition:: Example

The following config results in cloning the repo specified in 'repo', then
checking out the 'master' branch, and checking out the specified
commit.

>>> git_config = {'repo': 'https://github.com/aws/sagemaker-python-sdk.git',
>>> 'branch': 'test-branch-git-config',
>>> 'commit': '329bfcf884482002c05ff7f44f62599ebc9f445a'}

Raises:
ValueError: If the model ID is not recognized by JumpStart.
"""
Expand Down