Class: Aws::SageMaker::Types::InputConfig

Inherits:
Struct
  • Object
show all
Includes:
Aws::Structure
Defined in:
lib/aws-sdk-sagemaker/types.rb

Overview

Contains information about the location of input model artifacts, the name and shape of the expected data inputs, and the framework in which the model was trained.

Constant Summary collapse

SENSITIVE =
[]

Instance Attribute Summary collapse

Instance Attribute Details

#data_input_configString

Specifies the name and shape of the expected data inputs for your trained model with a JSON dictionary form. The data inputs are ‘Framework` specific.

  • ‘TensorFlow`: You must specify the name and shape (NHWC format) of the expected data inputs using a dictionary format for your trained model. The dictionary formats required for the console and CLI are different.

    • Examples for one input:

      • If using the console, ‘href="1,1024,1024,3">input”:`

      • If using the CLI, ‘href="1,1024,1024,3">input”:`

    • Examples for two inputs:

      • If using the console, ‘[1,28,28,1], “data2”:`

      • If using the CLI, ‘[1,28,28,1], “data2”:`

  • ‘KERAS`: You must specify the name and shape (NCHW format) of expected data inputs using a dictionary format for your trained model. Note that while Keras model artifacts should be uploaded in NHWC (channel-last) format, `DataInputConfig` should be specified in NCHW (channel-first) format. The dictionary formats required for the console and CLI are different.

    • Examples for one input:

      • If using the console, ‘href="1,3,224,224">input_1”:`

      • If using the CLI, ‘href="1,3,224,224">input_1”:`

    • Examples for two inputs:

      • If using the console, ‘[1,3,224,224], “input_2”: `

      • If using the CLI, ‘[1,3,224,224], “input_2”:`

  • ‘MXNET/ONNX/DARKNET`: You must specify the name and shape (NCHW format) of the expected data inputs in order using a dictionary format for your trained model. The dictionary formats required for the console and CLI are different.

    • Examples for one input:

      • If using the console, ‘href="1,3,1024,1024">data”:`

      • If using the CLI, ‘href="1,3,1024,1024">data”:`

    • Examples for two inputs:

      • If using the console, ‘[1,1,28,28], “var2”: `

      • If using the CLI, ‘[1,1,28,28], “var2”:`

  • ‘PyTorch`: You can either specify the name and shape (NCHW format) of expected data inputs in order using a dictionary format for your trained model or you can specify the shape only using a list format. The dictionary formats required for the console and CLI are different. The list formats for the console and CLI are the same.

    • Examples for one input in dictionary format:

      • If using the console, ‘href="1,3,224,224">input0”:`

      • If using the CLI, ‘href="1,3,224,224">input0”:`

    • Example for one input in list format: ‘[[1,3,224,224]]`

    • Examples for two inputs in dictionary format:

      • If using the console, ‘href="1,3,224,224">input0”:, “input1”:`

      • If using the CLI, ‘href="1,3,224,224">input0”:, “input1”: `

    • Example for two inputs in list format: ‘[[1,3,224,224], [1,3,224,224]]`

  • ‘XGBOOST`: input data name and shape are not needed.

‘DataInputConfig` supports the following parameters for `CoreML` `TargetDevice` (ML Model format):

  • ‘shape`: Input shape, for example `{“shape”: [1,224,224,3]}`. In addition to static input shapes, CoreML converter supports Flexible input shapes:

    • Range Dimension. You can use the Range Dimension feature if you know the input shape will be within some specific interval in that dimension, for example: ‘{“shape”: [“1..10”, 224, 224, 3]}`

    • Enumerated shapes. Sometimes, the models are trained to work only on a select set of inputs. You can enumerate all supported input shapes, for example: ‘{“shape”: [[1, 224, 224, 3], [1, 160, 160, 3]]}`

  • ‘default_shape`: Default input shape. You can set a default shape during conversion for both Range Dimension and Enumerated Shapes. For example `{“shape”: [“1..10”, 224, 224, 3], “default_shape”: [1, 224, 224, 3]}`

  • ‘type`: Input type. Allowed values: `Image` and `Tensor`. By default, the converter generates an ML Model with inputs of type Tensor (MultiArray). User can set input type to be Image. Image input type requires additional input parameters such as `bias` and `scale`.

  • ‘bias`: If the input type is an Image, you need to provide the bias vector.

  • ‘scale`: If the input type is an Image, you need to provide a scale factor.

CoreML ‘ClassifierConfig` parameters can be specified using

OutputConfig][1

‘CompilerOptions`. CoreML converter supports

Tensorflow and PyTorch models. CoreML conversion examples:

  • Tensor type input:

    • ‘“DataInputConfig”: {“shape”: [[1,224,224,3], [1,160,160,3]], “default_shape”: [1,224,224,3]}`

    ^

  • Tensor type input without input name (PyTorch):

    • ‘“DataInputConfig”: [[[1,3,224,224], [1,3,160,160]], “default_shape”: [1,3,224,224]]`

    ^

  • Image type input:

    • ‘“DataInputConfig”: {“shape”: [[1,224,224,3], [1,160,160,3]], “default_shape”: [1,224,224,3], “type”: “Image”, “bias”: [-1,-1,-1], “scale”: 0.007843137255}`

    • ‘“CompilerOptions”: “imagenet_labels_1000.txt”`

  • Image type input without input name (PyTorch):

    • ‘“DataInputConfig”: [[[1,3,224,224], [1,3,160,160]], “default_shape”: [1,3,224,224], “type”: “Image”, “bias”: [-1,-1,-1], “scale”: 0.007843137255]`

    • ‘“CompilerOptions”: “imagenet_labels_1000.txt”`

Depending on the model format, ‘DataInputConfig` requires the following parameters for `ml_eia2` [OutputConfig:TargetDevice].

  • For TensorFlow models saved in the SavedModel format, specify the input names from ‘signature_def_key` and the input model shapes for `DataInputConfig`. Specify the `signature_def_key` in [ `OutputConfig:CompilerOptions` ][3] if the model does not use TensorFlow’s default signature def key. For example:

    • ‘“DataInputConfig”: [1, 224, 224, 3]`

    • ‘“CompilerOptions”: “serving_custom”`

  • For TensorFlow models saved as a frozen graph, specify the input tensor names and shapes in ‘DataInputConfig` and the output tensor names for `output_names` in [ `OutputConfig:CompilerOptions` ][3]. For example:

    • ‘“DataInputConfig”: [1, 224, 224, 3]`

    • ‘“CompilerOptions”: [“output_tensor:0”]`

[1]: docs.aws.amazon.com/sagemaker/latest/APIReference/API_OutputConfig.html [2]: docs.aws.amazon.com/sagemaker/latest/APIReference/API_OutputConfig.html#sagemaker-Type-OutputConfig-TargetDevice [3]: docs.aws.amazon.com/sagemaker/latest/APIReference/API_OutputConfig.html#sagemaker-Type-OutputConfig-CompilerOptions

Returns:

  • (String)


25154
25155
25156
25157
25158
25159
25160
25161
# File 'lib/aws-sdk-sagemaker/types.rb', line 25154

class InputConfig < Struct.new(
  :s3_uri,
  :data_input_config,
  :framework,
  :framework_version)
  SENSITIVE = []
  include Aws::Structure
end

#frameworkString

Identifies the framework in which the model was trained. For example: TENSORFLOW.

Returns:

  • (String)


25154
25155
25156
25157
25158
25159
25160
25161
# File 'lib/aws-sdk-sagemaker/types.rb', line 25154

class InputConfig < Struct.new(
  :s3_uri,
  :data_input_config,
  :framework,
  :framework_version)
  SENSITIVE = []
  include Aws::Structure
end

#framework_versionString

Specifies the framework version to use. This API field is only supported for the MXNet, PyTorch, TensorFlow and TensorFlow Lite frameworks.

For information about framework versions supported for cloud targets and edge devices, see [Cloud Supported Instance Types and Frameworks] and [Edge Supported Frameworks].

[1]: docs.aws.amazon.com/sagemaker/latest/dg/neo-supported-cloud.html [2]: docs.aws.amazon.com/sagemaker/latest/dg/neo-supported-devices-edge-frameworks.html

Returns:

  • (String)


25154
25155
25156
25157
25158
25159
25160
25161
# File 'lib/aws-sdk-sagemaker/types.rb', line 25154

class InputConfig < Struct.new(
  :s3_uri,
  :data_input_config,
  :framework,
  :framework_version)
  SENSITIVE = []
  include Aws::Structure
end

#s3_uriString

The S3 path where the model artifacts, which result from model training, are stored. This path must point to a single gzip compressed tar archive (.tar.gz suffix).

Returns:

  • (String)


25154
25155
25156
25157
25158
25159
25160
25161
# File 'lib/aws-sdk-sagemaker/types.rb', line 25154

class InputConfig < Struct.new(
  :s3_uri,
  :data_input_config,
  :framework,
  :framework_version)
  SENSITIVE = []
  include Aws::Structure
end