All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.sagemaker.model.S3ModelDataSource Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon SageMaker module holds the client classes that are used for communicating with Amazon SageMaker Service

There is a newer version: 2.28.4
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.sagemaker.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Specifies the S3 location of ML model data to deploy. *

*/ @Generated("software.amazon.awssdk:codegen") public final class S3ModelDataSource implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField S3_URI_FIELD = SdkField. builder(MarshallingType.STRING).memberName("S3Uri") .getter(getter(S3ModelDataSource::s3Uri)).setter(setter(Builder::s3Uri)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3Uri").build()).build(); private static final SdkField S3_DATA_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("S3DataType").getter(getter(S3ModelDataSource::s3DataTypeAsString)).setter(setter(Builder::s3DataType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3DataType").build()).build(); private static final SdkField COMPRESSION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("CompressionType").getter(getter(S3ModelDataSource::compressionTypeAsString)) .setter(setter(Builder::compressionType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompressionType").build()).build(); private static final SdkField MODEL_ACCESS_CONFIG_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("ModelAccessConfig") .getter(getter(S3ModelDataSource::modelAccessConfig)).setter(setter(Builder::modelAccessConfig)) .constructor(ModelAccessConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModelAccessConfig").build()).build(); private static final SdkField HUB_ACCESS_CONFIG_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("HubAccessConfig") .getter(getter(S3ModelDataSource::hubAccessConfig)).setter(setter(Builder::hubAccessConfig)) .constructor(InferenceHubAccessConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HubAccessConfig").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(S3_URI_FIELD, S3_DATA_TYPE_FIELD, COMPRESSION_TYPE_FIELD, MODEL_ACCESS_CONFIG_FIELD, HUB_ACCESS_CONFIG_FIELD)); private static final long serialVersionUID = 1L; private final String s3Uri; private final String s3DataType; private final String compressionType; private final ModelAccessConfig modelAccessConfig; private final InferenceHubAccessConfig hubAccessConfig; private S3ModelDataSource(BuilderImpl builder) { this.s3Uri = builder.s3Uri; this.s3DataType = builder.s3DataType; this.compressionType = builder.compressionType; this.modelAccessConfig = builder.modelAccessConfig; this.hubAccessConfig = builder.hubAccessConfig; } /** *

* Specifies the S3 path of ML model data to deploy. *

* * @return Specifies the S3 path of ML model data to deploy. */ public final String s3Uri() { return s3Uri; } /** *

* 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. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #s3DataType} will * return {@link S3ModelDataType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #s3DataTypeAsString}. *

* * @return 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. * @see S3ModelDataType */ public final S3ModelDataType s3DataType() { return S3ModelDataType.fromValue(s3DataType); } /** *

* 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. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #s3DataType} will * return {@link S3ModelDataType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #s3DataTypeAsString}. *

* * @return 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. * @see S3ModelDataType */ public final String s3DataTypeAsString() { return s3DataType; } /** *

* 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. *

    *
  • *
*

* If the service returns an enum value that is not available in the current SDK version, {@link #compressionType} * will return {@link ModelCompressionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is * available from {@link #compressionTypeAsString}. *

* * @return 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. *

    *
  • * @see ModelCompressionType */ public final ModelCompressionType compressionType() { return ModelCompressionType.fromValue(compressionType); } /** *

    * 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. *

      *
    • *
    *

    * If the service returns an enum value that is not available in the current SDK version, {@link #compressionType} * will return {@link ModelCompressionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is * available from {@link #compressionTypeAsString}. *

    * * @return 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. *

      *
    • * @see ModelCompressionType */ public final String compressionTypeAsString() { return compressionType; } /** *

      * 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. *

      * * @return 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. */ public final ModelAccessConfig modelAccessConfig() { return modelAccessConfig; } /** *

      * Configuration information for hub access. *

      * * @return Configuration information for hub access. */ public final InferenceHubAccessConfig hubAccessConfig() { return hubAccessConfig; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(s3Uri()); hashCode = 31 * hashCode + Objects.hashCode(s3DataTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(compressionTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(modelAccessConfig()); hashCode = 31 * hashCode + Objects.hashCode(hubAccessConfig()); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof S3ModelDataSource)) { return false; } S3ModelDataSource other = (S3ModelDataSource) obj; return Objects.equals(s3Uri(), other.s3Uri()) && Objects.equals(s3DataTypeAsString(), other.s3DataTypeAsString()) && Objects.equals(compressionTypeAsString(), other.compressionTypeAsString()) && Objects.equals(modelAccessConfig(), other.modelAccessConfig()) && Objects.equals(hubAccessConfig(), other.hubAccessConfig()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public final String toString() { return ToString.builder("S3ModelDataSource").add("S3Uri", s3Uri()).add("S3DataType", s3DataTypeAsString()) .add("CompressionType", compressionTypeAsString()).add("ModelAccessConfig", modelAccessConfig()) .add("HubAccessConfig", hubAccessConfig()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "S3Uri": return Optional.ofNullable(clazz.cast(s3Uri())); case "S3DataType": return Optional.ofNullable(clazz.cast(s3DataTypeAsString())); case "CompressionType": return Optional.ofNullable(clazz.cast(compressionTypeAsString())); case "ModelAccessConfig": return Optional.ofNullable(clazz.cast(modelAccessConfig())); case "HubAccessConfig": return Optional.ofNullable(clazz.cast(hubAccessConfig())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((S3ModelDataSource) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

      * Specifies the S3 path of ML model data to deploy. *

      * * @param s3Uri * Specifies the S3 path of ML model data to deploy. * @return Returns a reference to this object so that method calls can be chained together. */ Builder s3Uri(String s3Uri); /** *

      * 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. *

      * * @param s3DataType * 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. * @see S3ModelDataType * @return Returns a reference to this object so that method calls can be chained together. * @see S3ModelDataType */ Builder s3DataType(String s3DataType); /** *

      * 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. *

      * * @param s3DataType * 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. * @see S3ModelDataType * @return Returns a reference to this object so that method calls can be chained together. * @see S3ModelDataType */ Builder s3DataType(S3ModelDataType s3DataType); /** *

      * 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. *

        *
      • *
      * * @param compressionType * 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. *

        *
      • * @see ModelCompressionType * @return Returns a reference to this object so that method calls can be chained together. * @see ModelCompressionType */ Builder compressionType(String compressionType); /** *

        * 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. *

          *
        • *
        * * @param compressionType * 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. *

          *
        • * @see ModelCompressionType * @return Returns a reference to this object so that method calls can be chained together. * @see ModelCompressionType */ Builder compressionType(ModelCompressionType compressionType); /** *

          * 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. *

          * * @param 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. * @return Returns a reference to this object so that method calls can be chained together. */ Builder modelAccessConfig(ModelAccessConfig 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. *

          * This is a convenience method that creates an instance of the {@link ModelAccessConfig.Builder} avoiding the * need to create one manually via {@link ModelAccessConfig#builder()}. * *

          * When the {@link Consumer} completes, {@link ModelAccessConfig.Builder#build()} is called immediately and its * result is passed to {@link #modelAccessConfig(ModelAccessConfig)}. * * @param modelAccessConfig * a consumer that will call methods on {@link ModelAccessConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #modelAccessConfig(ModelAccessConfig) */ default Builder modelAccessConfig(Consumer modelAccessConfig) { return modelAccessConfig(ModelAccessConfig.builder().applyMutation(modelAccessConfig).build()); } /** *

          * Configuration information for hub access. *

          * * @param hubAccessConfig * Configuration information for hub access. * @return Returns a reference to this object so that method calls can be chained together. */ Builder hubAccessConfig(InferenceHubAccessConfig hubAccessConfig); /** *

          * Configuration information for hub access. *

          * This is a convenience method that creates an instance of the {@link InferenceHubAccessConfig.Builder} * avoiding the need to create one manually via {@link InferenceHubAccessConfig#builder()}. * *

          * When the {@link Consumer} completes, {@link InferenceHubAccessConfig.Builder#build()} is called immediately * and its result is passed to {@link #hubAccessConfig(InferenceHubAccessConfig)}. * * @param hubAccessConfig * a consumer that will call methods on {@link InferenceHubAccessConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #hubAccessConfig(InferenceHubAccessConfig) */ default Builder hubAccessConfig(Consumer hubAccessConfig) { return hubAccessConfig(InferenceHubAccessConfig.builder().applyMutation(hubAccessConfig).build()); } } static final class BuilderImpl implements Builder { private String s3Uri; private String s3DataType; private String compressionType; private ModelAccessConfig modelAccessConfig; private InferenceHubAccessConfig hubAccessConfig; private BuilderImpl() { } private BuilderImpl(S3ModelDataSource model) { s3Uri(model.s3Uri); s3DataType(model.s3DataType); compressionType(model.compressionType); modelAccessConfig(model.modelAccessConfig); hubAccessConfig(model.hubAccessConfig); } public final String getS3Uri() { return s3Uri; } public final void setS3Uri(String s3Uri) { this.s3Uri = s3Uri; } @Override public final Builder s3Uri(String s3Uri) { this.s3Uri = s3Uri; return this; } public final String getS3DataType() { return s3DataType; } public final void setS3DataType(String s3DataType) { this.s3DataType = s3DataType; } @Override public final Builder s3DataType(String s3DataType) { this.s3DataType = s3DataType; return this; } @Override public final Builder s3DataType(S3ModelDataType s3DataType) { this.s3DataType(s3DataType == null ? null : s3DataType.toString()); return this; } public final String getCompressionType() { return compressionType; } public final void setCompressionType(String compressionType) { this.compressionType = compressionType; } @Override public final Builder compressionType(String compressionType) { this.compressionType = compressionType; return this; } @Override public final Builder compressionType(ModelCompressionType compressionType) { this.compressionType(compressionType == null ? null : compressionType.toString()); return this; } public final ModelAccessConfig.Builder getModelAccessConfig() { return modelAccessConfig != null ? modelAccessConfig.toBuilder() : null; } public final void setModelAccessConfig(ModelAccessConfig.BuilderImpl modelAccessConfig) { this.modelAccessConfig = modelAccessConfig != null ? modelAccessConfig.build() : null; } @Override public final Builder modelAccessConfig(ModelAccessConfig modelAccessConfig) { this.modelAccessConfig = modelAccessConfig; return this; } public final InferenceHubAccessConfig.Builder getHubAccessConfig() { return hubAccessConfig != null ? hubAccessConfig.toBuilder() : null; } public final void setHubAccessConfig(InferenceHubAccessConfig.BuilderImpl hubAccessConfig) { this.hubAccessConfig = hubAccessConfig != null ? hubAccessConfig.build() : null; } @Override public final Builder hubAccessConfig(InferenceHubAccessConfig hubAccessConfig) { this.hubAccessConfig = hubAccessConfig; return this; } @Override public S3ModelDataSource build() { return new S3ModelDataSource(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy