Skip to content

S3ModelDataSource

Source code in docs_src/capo_sagemaker/types/s3_model_data_source.py
class S3ModelDataSource(TypedDict, closed=True):
    s3_uri: NotRequired["capo_sagemaker.types.s3_model_uri.S3ModelUri"]
    """<p>Specifies the S3 path of ML model data to deploy.</p>"""
    s3_data_type: NotRequired["capo_sagemaker.types.s3_model_data_type.S3ModelDataType"]
    """<p>Specifies the type of ML model data to deploy.</p> <p>If you choose <code>S3Prefix</code>, <code>S3Uri</code> identifies a key name prefix. SageMaker uses all objects that match the specified key name prefix as part of the ML model data to deploy. A valid key name prefix identified by <code>S3Uri</code> always ends with a forward slash (/).</p> <p>If you choose <code>S3Object</code>, <code>S3Uri</code> identifies an object that is the ML model data to deploy.</p>"""
    compression_type: NotRequired[
        "capo_sagemaker.types.model_compression_type.ModelCompressionType"
    ]
    """<p>Specifies how the ML model data is prepared.</p> <p>If you choose <code>Gzip</code> and choose <code>S3Object</code> as the value of <code>S3DataType</code>, <code>S3Uri</code> identifies an object that is a gzip-compressed TAR archive. SageMaker will attempt to decompress and untar the object during model deployment.</p> <p>If you choose <code>None</code> and chooose <code>S3Object</code> as the value of <code>S3DataType</code>, <code>S3Uri</code> identifies an object that represents an uncompressed ML model to deploy.</p> <p>If you choose None and choose <code>S3Prefix</code> as the value of <code>S3DataType</code>, <code>S3Uri</code> identifies a key name prefix, under which all objects represents the uncompressed ML model to deploy.</p> <p>If you choose None, then SageMaker will follow rules below when creating model data files under /opt/ml/model directory for use by your inference code:</p> <ul> <li> <p>If you choose <code>S3Object</code> as the value of <code>S3DataType</code>, then SageMaker will split the key of the S3 object referenced by <code>S3Uri</code> by slash (/), and use the last part as the filename of the file holding the content of the S3 object.</p> </li> <li> <p>If you choose <code>S3Prefix</code> as the value of <code>S3DataType</code>, then for each S3 object under the key name pefix referenced by <code>S3Uri</code>, SageMaker will trim its key by the prefix, and use the remainder as the path (relative to <code>/opt/ml/model</code>) of the file holding the content of the S3 object. SageMaker will split the remainder by slash (/), using intermediate parts as directory names and the last part as filename of the file holding the content of the S3 object.</p> </li> <li> <p>Do not use any of the following as file names or directory names:</p> <ul> <li> <p>An empty or blank string</p> </li> <li> <p>A string which contains null bytes</p> </li> <li> <p>A string longer than 255 bytes</p> </li> <li> <p>A single dot (<code>.</code>)</p> </li> <li> <p>A double dot (<code>..</code>)</p> </li> </ul> </li> <li> <p>Ambiguous file names will result in model deployment failure. For example, if your uncompressed ML model consists of two S3 objects <code>s3://mybucket/model/weights</code> and <code>s3://mybucket/model/weights/part1</code> and you specify <code>s3://mybucket/model/</code> as the value of <code>S3Uri</code> and <code>S3Prefix</code> as the value of <code>S3DataType</code>, then it will result in name clash between <code>/opt/ml/model/weights</code> (a regular file) and <code>/opt/ml/model/weights/</code> (a directory).</p> </li> <li> <p>Do not organize the model artifacts in <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-folders.html">S3 console using folders</a>. When you create a folder in S3 console, S3 creates a 0-byte object with a key set to the folder name you provide. They key of the 0-byte object ends with a slash (/) which violates SageMaker restrictions on model artifact file names, leading to model deployment failure. </p> </li> </ul>"""
    model_access_config: NotRequired[
        "capo_sagemaker.types.model_access_config.ModelAccessConfig"
    ]
    """<p>Specifies the access configuration file for the ML model. You can explicitly accept the model end-user license agreement (EULA) within the <code>ModelAccessConfig</code>. You are responsible for reviewing and complying with any applicable license terms and making sure they are acceptable for your use case before downloading or using a model.</p>"""
    hub_access_config: NotRequired[
        "capo_sagemaker.types.inference_hub_access_config.InferenceHubAccessConfig"
    ]
    """<p>Configuration information for hub access.</p>"""
    manifest_s3_uri: NotRequired["capo_sagemaker.types.s3_model_uri.S3ModelUri"]
    """<p>The Amazon S3 URI of the manifest file. The manifest file is a CSV file that stores the artifact locations.</p>"""
    e_tag: NotRequired["capo_sagemaker.types.string.String"]
    """<p>The ETag associated with S3 URI.</p>"""
    manifest_etag: NotRequired["capo_sagemaker.types.string.String"]
    """<p>The ETag associated with Manifest S3 URI.</p>"""

compression_type instance-attribute

compression_type: NotRequired[ModelCompressionType]

Specifies how the ML model data is prepared.

If you choose Gzip and choose S3Object as the value of S3DataType, S3Uri identifies an object that is a gzip-compressed TAR archive. SageMaker will attempt to decompress and untar the object during model deployment.

If you choose None and chooose S3Object as the value of S3DataType, S3Uri identifies an object that represents an uncompressed ML model to deploy.

If you choose None and choose S3Prefix as the value of S3DataType, S3Uri identifies a key name prefix, under which all objects represents the uncompressed ML model to deploy.

If you choose None, then SageMaker will follow rules below when creating model data files under /opt/ml/model directory for use by your inference code:

  • If you choose S3Object as the value of S3DataType, then SageMaker will split the key of the S3 object referenced by S3Uri by slash (/), and use the last part as the filename of the file holding the content of the S3 object.

  • If you choose S3Prefix as the value of S3DataType, then for each S3 object under the key name pefix referenced by S3Uri, SageMaker will trim its key by the prefix, and use the remainder as the path (relative to /opt/ml/model) of the file holding the content of the S3 object. SageMaker will split the remainder by slash (/), using intermediate parts as directory names and the last part as filename of the file holding the content of the S3 object.

  • Do not use any of the following as file names or directory names:

    • An empty or blank string

    • A string which contains null bytes

    • A string longer than 255 bytes

    • A single dot (.)

    • A double dot (..)

  • Ambiguous file names will result in model deployment failure. For example, if your uncompressed ML model consists of two S3 objects s3://mybucket/model/weights and s3://mybucket/model/weights/part1 and you specify s3://mybucket/model/ as the value of S3Uri and S3Prefix as the value of S3DataType, then it will result in name clash between /opt/ml/model/weights (a regular file) and /opt/ml/model/weights/ (a directory).

  • Do not organize the model artifacts in S3 console using folders. When you create a folder in S3 console, S3 creates a 0-byte object with a key set to the folder name you provide. They key of the 0-byte object ends with a slash (/) which violates SageMaker restrictions on model artifact file names, leading to model deployment failure.

e_tag instance-attribute

e_tag: NotRequired[String]

The ETag associated with S3 URI.

hub_access_config instance-attribute

hub_access_config: NotRequired[InferenceHubAccessConfig]

Configuration information for hub access.

manifest_etag instance-attribute

manifest_etag: NotRequired[String]

The ETag associated with Manifest S3 URI.

manifest_s3_uri instance-attribute

manifest_s3_uri: NotRequired[S3ModelUri]

The Amazon S3 URI of the manifest file. The manifest file is a CSV file that stores the artifact locations.

model_access_config instance-attribute

model_access_config: NotRequired[ModelAccessConfig]

Specifies the access configuration file for the ML model. You can explicitly accept the model end-user license agreement (EULA) within the ModelAccessConfig. You are responsible for reviewing and complying with any applicable license terms and making sure they are acceptable for your use case before downloading or using a model.

s3_data_type instance-attribute

s3_data_type: NotRequired[S3ModelDataType]

Specifies the type of ML model data to deploy.

If you choose S3Prefix, S3Uri identifies a key name prefix. SageMaker uses all objects that match the specified key name prefix as part of the ML model data to deploy. A valid key name prefix identified by S3Uri always ends with a forward slash (/).

If you choose S3Object, S3Uri identifies an object that is the ML model data to deploy.

s3_uri instance-attribute

s3_uri: NotRequired[S3ModelUri]

Specifies the S3 path of ML model data to deploy.