Class: AWSCDK::Sagemaker::CfnModel::S3DataSourceProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
sagemaker/cfn_model.rb

Overview

Describes the S3 data source.

Your input bucket must be in the same AWS region as your training job.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(compression_type:, s3_data_type:, s3_uri:, hub_access_config: nil, model_access_config: nil) ⇒ S3DataSourceProperty

Returns a new instance of S3DataSourceProperty.

Parameters:



1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
# File 'sagemaker/cfn_model.rb', line 1040

def initialize(compression_type:, s3_data_type:, s3_uri:, hub_access_config: nil, model_access_config: nil)
  @compression_type = compression_type
  Jsii::Type.check_type(@compression_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "compressionType")
  @s3_data_type = s3_data_type
  Jsii::Type.check_type(@s3_data_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "s3DataType")
  @s3_uri = s3_uri
  Jsii::Type.check_type(@s3_uri, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "s3Uri")
  @hub_access_config = hub_access_config.is_a?(Hash) ? ::AWSCDK::Sagemaker::CfnModel::HubAccessConfigProperty.new(**hub_access_config.transform_keys(&:to_sym)) : hub_access_config
  Jsii::Type.check_type(@hub_access_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zYWdlbWFrZXIuQ2ZuTW9kZWwuSHViQWNjZXNzQ29uZmlnUHJvcGVydHkifV19fQ==")), "hubAccessConfig") unless @hub_access_config.nil?
  @model_access_config = model_access_config.is_a?(Hash) ? ::AWSCDK::Sagemaker::CfnModel::ModelAccessConfigProperty.new(**model_access_config.transform_keys(&:to_sym)) : model_access_config
  Jsii::Type.check_type(@model_access_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19zYWdlbWFrZXIuQ2ZuTW9kZWwuTW9kZWxBY2Nlc3NDb25maWdQcm9wZXJ0eSJ9XX19")), "modelAccessConfig") unless @model_access_config.nil?
end

Instance Attribute Details

#compression_typeString (readonly)

Specifies how the ML model data is prepared.



1057
1058
1059
# File 'sagemaker/cfn_model.rb', line 1057

def compression_type
  @compression_type
end

#hub_access_configAWSCDK::IResolvable, ... (readonly)

The configuration for a private hub model reference that points to a SageMaker JumpStart public hub model.



1115
1116
1117
# File 'sagemaker/cfn_model.rb', line 1115

def hub_access_config
  @hub_access_config
end

#model_access_configAWSCDK::IResolvable, ... (readonly)

The access configuration file to control access to the ML model.

You can explicitly accept the model end-user license agreement (EULA) within the ModelAccessConfig.



1122
1123
1124
# File 'sagemaker/cfn_model.rb', line 1122

def model_access_config
  @model_access_config
end

#s3_data_typeString (readonly)

If you choose S3Prefix , S3Uri identifies a key name prefix.

SageMaker uses all objects that match the specified key name prefix for model training.

If you choose ManifestFile , S3Uri identifies an object that is a manifest file containing a list of object keys that you want SageMaker to use for model training.

If you choose AugmentedManifestFile , S3Uri identifies an object that is an augmented manifest file in JSON lines format. This file contains the data you want to use for model training. AugmentedManifestFile can only be used if the Channel's input mode is Pipe .

If you choose Converse , S3Uri identifies an Amazon S3 location that contains data formatted according to Converse format. This format structures conversational messages with specific roles and content types used for training and fine-tuning foundational models.



1070
1071
1072
# File 'sagemaker/cfn_model.rb', line 1070

def s3_data_type
  @s3_data_type
end

#s3_uriString (readonly)

Depending on the value specified for the S3DataType , identifies either a key name prefix or a manifest.

For example:

  • A key name prefix might look like this: s3://bucketname/exampleprefix/
  • A manifest might look like this: s3://bucketname/example.manifest

A manifest is an S3 object which is a JSON file consisting of an array of elements. The first element is a prefix which is followed by one or more suffixes. SageMaker appends the suffix elements to the prefix to get a full set of S3Uri . Note that the prefix must be a valid non-empty S3Uri that precludes users from specifying a manifest whose individual S3Uri is sourced from different S3 buckets.

The following code example shows a valid manifest format:

[ {"prefix": "s3://customer_bucket/some/prefix/"},

"relative/path/to/custdata-1",

"relative/path/custdata-2",

...

"relative/path/custdata-N"

]

This JSON is equivalent to the following S3Uri list:

s3://customer_bucket/some/prefix/relative/path/to/custdata-1

s3://customer_bucket/some/prefix/relative/path/custdata-2

...

s3://customer_bucket/some/prefix/relative/path/custdata-N

The complete set of S3Uri in this manifest is the input data for the channel for this data source. The object that each S3Uri points to must be readable by the IAM role that SageMaker uses to perform tasks on your behalf.

Your input bucket must be located in same AWS region as your training job.



1110
1111
1112
# File 'sagemaker/cfn_model.rb', line 1110

def s3_uri
  @s3_uri
end

Class Method Details

.jsii_propertiesObject



1124
1125
1126
1127
1128
1129
1130
1131
1132
# File 'sagemaker/cfn_model.rb', line 1124

def self.jsii_properties
  {
    :compression_type => "compressionType",
    :s3_data_type => "s3DataType",
    :s3_uri => "s3Uri",
    :hub_access_config => "hubAccessConfig",
    :model_access_config => "modelAccessConfig",
  }
end

Instance Method Details

#to_jsiiObject



1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
# File 'sagemaker/cfn_model.rb', line 1134

def to_jsii
  result = {}
  result.merge!({
    "compressionType" => @compression_type,
    "s3DataType" => @s3_data_type,
    "s3Uri" => @s3_uri,
    "hubAccessConfig" => @hub_access_config,
    "modelAccessConfig" => @model_access_config,
  })
  result.compact
end