Skip to content

Commit db41eba

Browse files
doc: Add Hugging Face docs (#2513)
* added Hugging Face docs * Update model.py fixed lines too long * Update model.py Co-authored-by: Ahsan Khan <[email protected]>
1 parent 2741e6e commit db41eba

File tree

2 files changed

+41
-23
lines changed

2 files changed

+41
-23
lines changed
Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
1-
HuggingFace
2-
===========
1+
Hugging Face
2+
============
33

4-
HuggingFace Estimator
5-
---------------------
4+
Hugging Face Estimator
5+
----------------------
66

77
.. autoclass:: sagemaker.huggingface.estimator.HuggingFace
88
:members:
99
:undoc-members:
1010
:show-inheritance:
11+
12+
Hugging Face Model
13+
------------------
14+
15+
.. autoclass:: sagemaker.huggingface.model.HuggingFaceModel
16+
:members:
17+
:undoc-members:
18+
:show-inheritance:
19+
20+
HuggingFace Predictor
21+
---------------------
22+
23+
.. autoclass:: sagemaker.huggingface.model.HuggingFacePredictor
24+
:members:
25+
:undoc-members:
26+
:show-inheritance:

src/sagemaker/huggingface/model.py

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030

3131

3232
class HuggingFacePredictor(Predictor):
33-
"""A Predictor for inference against HuggingFace Endpoints.
33+
"""A Predictor for inference against Hugging Face Endpoints.
3434
3535
This is able to serialize Python lists, dictionaries, and numpy arrays to
36-
multidimensional tensors for HuggingFace inference.
36+
multidimensional tensors for Hugging Face inference.
3737
"""
3838

3939
def __init__(
@@ -48,7 +48,7 @@ def __init__(
4848
Args:
4949
endpoint_name (str): The name of the endpoint to perform inference
5050
on.
51-
sagemaker_session (sagemaker.session.Session): Session object which
51+
sagemaker_session (sagemaker.session.Session): Session object that
5252
manages interactions with Amazon SageMaker APIs and any other
5353
AWS services needed. If not specified, the estimator creates one
5454
using the default AWS configuration chain.
@@ -85,7 +85,7 @@ def _validate_pt_tf_versions(pytorch_version, tensorflow_version, image_uri):
8585

8686

8787
class HuggingFaceModel(FrameworkModel):
88-
"""An HuggingFace SageMaker ``Model`` that can be deployed to a SageMaker ``Endpoint``."""
88+
"""A Hugging Face SageMaker ``Model`` that can be deployed to a SageMaker ``Endpoint``."""
8989

9090
_framework_name = "huggingface"
9191

@@ -106,19 +106,19 @@ def __init__(
106106
"""Initialize a HuggingFaceModel.
107107
108108
Args:
109-
model_data (str): The S3 location of a SageMaker model data
109+
model_data (str): The Amazon S3 location of a SageMaker model data
110110
``.tar.gz`` file.
111-
role (str): An AWS IAM role (either name or full ARN). The Amazon
111+
role (str): An AWS IAM role specified with either the name or full ARN. The Amazon
112112
SageMaker training jobs and APIs that create Amazon SageMaker
113113
endpoints use this role to access training data and model
114114
artifacts. After the endpoint is created, the inference code
115115
might use the IAM role, if it needs to access an AWS resource.
116-
entry_point (str): Path (absolute or relative) to the Python source
117-
file which should be executed as the entry point to model
116+
entry_point (str): The absolute or relative path to the Python source
117+
file that should be executed as the entry point to model
118118
hosting. If ``source_dir`` is specified, then ``entry_point``
119119
must point to a file located at the root of ``source_dir``.
120120
Defaults to None.
121-
transformers_version (str): transformers version you want to use for
121+
transformers_version (str): Transformers version you want to use for
122122
executing your model training code. Defaults to None. Required
123123
unless ``image_uri`` is provided.
124124
tensorflow_version (str): TensorFlow version you want to use for
@@ -132,7 +132,7 @@ def __init__(
132132
py_version (str): Python version you want to use for executing your
133133
model training code. Defaults to ``None``. Required unless
134134
``image_uri`` is provided.
135-
image_uri (str): A Docker image URI (default: None). If not specified, a
135+
image_uri (str): A Docker image URI. Defaults to None. If not specified, a
136136
default image for PyTorch will be used. If ``framework_version``
137137
or ``py_version`` are ``None``, then ``image_uri`` is required. If
138138
also ``None``, then a ``ValueError`` will be raised.
@@ -197,19 +197,21 @@ def register(
197197
transform_instances (list): A list of the instance types on which a transformation
198198
job can be run or on which an endpoint can be deployed.
199199
model_package_name (str): Model Package name, exclusive to `model_package_group_name`,
200-
using `model_package_name` makes the Model Package un-versioned (default: None).
200+
using `model_package_name` makes the Model Package un-versioned.
201+
Defaults to ``None``.
201202
model_package_group_name (str): Model Package Group name, exclusive to
202203
`model_package_name`, using `model_package_group_name` makes the Model Package
203-
versioned (default: None).
204-
image_uri (str): Inference image uri for the container. Model class' self.image will
205-
be used if it is None (default: None).
206-
model_metrics (ModelMetrics): ModelMetrics object (default: None).
207-
metadata_properties (MetadataProperties): MetadataProperties object (default: None).
204+
versioned. Defaults to ``None``.
205+
image_uri (str): Inference image URI for the container. Model class' self.image will
206+
be used if it is None. Defaults to ``None``.
207+
model_metrics (ModelMetrics): ModelMetrics object. Defaults to ``None``.
208+
metadata_properties (MetadataProperties): MetadataProperties object.
209+
Defaults to ``None``.
208210
marketplace_cert (bool): A boolean value indicating if the Model Package is certified
209-
for AWS Marketplace (default: False).
211+
for AWS Marketplace. Defaults to ``False``.
210212
approval_status (str): Model Approval Status, values can be "Approved", "Rejected",
211-
or "PendingManualApproval" (default: "PendingManualApproval").
212-
description (str): Model Package description (default: None).
213+
or "PendingManualApproval". Defaults to ``PendingManualApproval``.
214+
description (str): Model Package description. Defaults to ``None``.
213215
214216
Returns:
215217
A `sagemaker.model.ModelPackage` instance.

0 commit comments

Comments
 (0)