Struct InputConfig

Source
pub struct InputConfig {
    pub data_input_config: String,
    pub framework: String,
    pub framework_version: Option<String>,
    pub s3_uri: String,
}
Expand description

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.

Fields§

§data_input_config: String

Specifies the name and shape of the expected data inputs for your trained model with a JSON dictionary form. The data inputs are InputConfig$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, {"input":[1,1024,1024,3]}

      • If using the CLI, {"input":[1,1024,1024,3]}

    • Examples for two inputs:

      • If using the console, {"data1": [1,28,28,1], "data2":[1,28,28,1]}

      • If using the CLI, {"data1": [1,28,28,1], "data2":[1,28,28,1]}

  • 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, {"input1":[1,3,224,224]}

      • If using the CLI, {"input1":[1,3,224,224]}

    • Examples for two inputs:

      • If using the console, {"input1": [1,3,224,224], "input2":[1,3,224,224]}

      • If using the CLI, {"input1": [1,3,224,224], "input2":[1,3,224,224]}

  • 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, {"data":[1,3,1024,1024]}

      • If using the CLI, {"data":[1,3,1024,1024]}

    • Examples for two inputs:

      • If using the console, {"var1": [1,1,28,28], "var2":[1,1,28,28]}

      • If using the CLI, {"var1": [1,1,28,28], "var2":[1,1,28,28]}

  • 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, {"input0":[1,3,224,224]}

      • If using the CLI, {"input0":[1,3,224,224]}

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

    • Examples for two inputs in dictionary format:

      • If using the console, {"input0":[1,3,224,224], "input1":[1,3,224,224]}

      • If using the CLI, {"input0":[1,3,224,224], "input1":[1,3,224,224]}

    • 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 OutputConfig$TargetDevice (ML Model format):

  • shape: Input shape, for example {"input1": {"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: {"input1": {"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: {"input1": {"shape": [[1, 224, 224, 3], [1, 160, 160, 3]]}}

  • defaultshape: Default input shape. You can set a default shape during conversion for both Range Dimension and Enumerated Shapes. For example {"input1": {"shape": ["1..10", 224, 224, 3], "defaultshape": [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$CompilerOptions. CoreML converter supports Tensorflow and PyTorch models. CoreML conversion examples:

  • Tensor type input:

    • "DataInputConfig": {"input1": {"shape": [[1,224,224,3], [1,160,160,3]], "defaultshape": [1,224,224,3]}}

  • Tensor type input without input name (PyTorch):

    • "DataInputConfig": [{"shape": [[1,3,224,224], [1,3,160,160]], "defaultshape": [1,3,224,224]}]

  • Image type input:

    • "DataInputConfig": {"input1": {"shape": [[1,224,224,3], [1,160,160,3]], "defaultshape": [1,224,224,3], "type": "Image", "bias": [-1,-1,-1], "scale": 0.007843137255}}

    • "CompilerOptions": {"classlabels": "imagenetlabels1000.txt"}

  • Image type input without input name (PyTorch):

    • "DataInputConfig": [{"shape": [[1,3,224,224], [1,3,160,160]], "defaultshape": [1,3,224,224], "type": "Image", "bias": [-1,-1,-1], "scale": 0.007843137255}]

    • "CompilerOptions": {"classlabels": "imagenetlabels1000.txt"}

Depending on the model format, DataInputConfig requires the following parameters for mleia2 <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/APIOutputConfig.html#sagemaker-Type-OutputConfig-TargetDevice">OutputConfig:TargetDevice.

  • For TensorFlow models saved in the SavedModel format, specify the input names from signaturedefkey and the input model shapes for DataInputConfig. Specify the signaturedefkey in OutputConfig:CompilerOptions if the model does not use TensorFlow's default signature def key. For example:

    • "DataInputConfig": {"inputs": [1, 224, 224, 3]}

    • "CompilerOptions": {"signaturedefkey": "servingcustom"}

  • For TensorFlow models saved as a frozen graph, specify the input tensor names and shapes in DataInputConfig and the output tensor names for outputnames in OutputConfig:CompilerOptions . For example:

    • "DataInputConfig": {"inputtensor:0": [1, 224, 224, 3]}

    • "CompilerOptions": {"outputnames": ["output_tensor:0"]}

§framework: String

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

§framework_version: Option<String>

Specifies the framework version to use.

This API field is only supported for PyTorch framework versions 1.4, 1.5, and 1.6 for cloud instance target devices: ml_c4, ml_c5, ml_m4, ml_m5, ml_p2, ml_p3, and ml_g4dn.

§s3_uri: String

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

Trait Implementations§

Source§

impl Clone for InputConfig

Source§

fn clone(&self) -> InputConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InputConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InputConfig

Source§

fn default() -> InputConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for InputConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for InputConfig

Source§

fn eq(&self, other: &InputConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for InputConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for InputConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,