« blib/lib/Paws/SageMaker/InferenceSpecification.pm
↑ Summary
blib/lib/Paws/SageMaker/IntegerParameterRange.pm »
| 1 | # Generated by default/object.tt | ||
| 2 | package Paws::SageMaker::InputConfig; | ||
| 3 | use Moose; | ||
| 4 | has DataInputConfig => (is => 'ro', isa => 'Str', required => 1); | ||
| 5 | has Framework => (is => 'ro', isa => 'Str', required => 1); | ||
| 6 | has FrameworkVersion => (is => 'ro', isa => 'Str'); | ||
| 7 | has S3Uri => (is => 'ro', isa => 'Str', required => 1); | ||
| 8 | |||
| 9 | 1; | ||
| 10 | |||
| 11 | ### main pod documentation begin ### | ||
| 12 | |||
| 13 | =head1 NAME | ||
| 14 | |||
| 15 | Paws::SageMaker::InputConfig | ||
| 16 | |||
| 17 | =head1 USAGE | ||
| 18 | |||
| 19 | This class represents one of two things: | ||
| 20 | |||
| 21 | =head3 Arguments in a call to a service | ||
| 22 | |||
| 23 | Use the attributes of this class as arguments to methods. You shouldn't make instances of this class. | ||
| 24 | Each attribute should be used as a named argument in the calls that expect this type of object. | ||
| 25 | |||
| 26 | As an example, if Att1 is expected to be a Paws::SageMaker::InputConfig object: | ||
| 27 | |||
| 28 | $service_obj->Method(Att1 => { DataInputConfig => $value, ..., S3Uri => $value }); | ||
| 29 | |||
| 30 | =head3 Results returned from an API call | ||
| 31 | |||
| 32 | Use accessors for each attribute. If Att1 is expected to be an Paws::SageMaker::InputConfig object: | ||
| 33 | |||
| 34 | $result = $service_obj->Method(...); | ||
| 35 | $result->Att1->DataInputConfig | ||
| 36 | |||
| 37 | =head1 DESCRIPTION | ||
| 38 | |||
| 39 | Contains information about the location of input model artifacts, the | ||
| 40 | name and shape of the expected data inputs, and the framework in which | ||
| 41 | the model was trained. | ||
| 42 | |||
| 43 | =head1 ATTRIBUTES | ||
| 44 | |||
| 45 | |||
| 46 | =head2 B<REQUIRED> DataInputConfig => Str | ||
| 47 | |||
| 48 | Specifies the name and shape of the expected data inputs for your | ||
| 49 | trained model with a JSON dictionary form. The data inputs are | ||
| 50 | InputConfig$Framework specific. | ||
| 51 | |||
| 52 | =over | ||
| 53 | |||
| 54 | =item * | ||
| 55 | |||
| 56 | C<TensorFlow>: You must specify the name and shape (NHWC format) of the | ||
| 57 | expected data inputs using a dictionary format for your trained model. | ||
| 58 | The dictionary formats required for the console and CLI are different. | ||
| 59 | |||
| 60 | =over | ||
| 61 | |||
| 62 | =item * | ||
| 63 | |||
| 64 | Examples for one input: | ||
| 65 | |||
| 66 | =over | ||
| 67 | |||
| 68 | =item * | ||
| 69 | |||
| 70 | If using the console, C<{"input":[1,1024,1024,3]}> | ||
| 71 | |||
| 72 | =item * | ||
| 73 | |||
| 74 | If using the CLI, C<{\"input\":[1,1024,1024,3]}> | ||
| 75 | |||
| 76 | =back | ||
| 77 | |||
| 78 | =item * | ||
| 79 | |||
| 80 | Examples for two inputs: | ||
| 81 | |||
| 82 | =over | ||
| 83 | |||
| 84 | =item * | ||
| 85 | |||
| 86 | If using the console, C<{"data1": [1,28,28,1], "data2":[1,28,28,1]}> | ||
| 87 | |||
| 88 | =item * | ||
| 89 | |||
| 90 | If using the CLI, C<{\"data1\": [1,28,28,1], \"data2\":[1,28,28,1]}> | ||
| 91 | |||
| 92 | =back | ||
| 93 | |||
| 94 | =back | ||
| 95 | |||
| 96 | =item * | ||
| 97 | |||
| 98 | C<KERAS>: You must specify the name and shape (NCHW format) of expected | ||
| 99 | data inputs using a dictionary format for your trained model. Note that | ||
| 100 | while Keras model artifacts should be uploaded in NHWC (channel-last) | ||
| 101 | format, C<DataInputConfig> should be specified in NCHW (channel-first) | ||
| 102 | format. The dictionary formats required for the console and CLI are | ||
| 103 | different. | ||
| 104 | |||
| 105 | =over | ||
| 106 | |||
| 107 | =item * | ||
| 108 | |||
| 109 | Examples for one input: | ||
| 110 | |||
| 111 | =over | ||
| 112 | |||
| 113 | =item * | ||
| 114 | |||
| 115 | If using the console, C<{"input_1":[1,3,224,224]}> | ||
| 116 | |||
| 117 | =item * | ||
| 118 | |||
| 119 | If using the CLI, C<{\"input_1\":[1,3,224,224]}> | ||
| 120 | |||
| 121 | =back | ||
| 122 | |||
| 123 | =item * | ||
| 124 | |||
| 125 | Examples for two inputs: | ||
| 126 | |||
| 127 | =over | ||
| 128 | |||
| 129 | =item * | ||
| 130 | |||
| 131 | If using the console, C<{"input_1": [1,3,224,224], | ||
| 132 | "input_2":[1,3,224,224]}> | ||
| 133 | |||
| 134 | =item * | ||
| 135 | |||
| 136 | If using the CLI, C<{\"input_1\": [1,3,224,224], | ||
| 137 | \"input_2\":[1,3,224,224]}> | ||
| 138 | |||
| 139 | =back | ||
| 140 | |||
| 141 | =back | ||
| 142 | |||
| 143 | =item * | ||
| 144 | |||
| 145 | C<MXNET/ONNX/DARKNET>: You must specify the name and shape (NCHW | ||
| 146 | format) of the expected data inputs in order using a dictionary format | ||
| 147 | for your trained model. The dictionary formats required for the console | ||
| 148 | and CLI are different. | ||
| 149 | |||
| 150 | =over | ||
| 151 | |||
| 152 | =item * | ||
| 153 | |||
| 154 | Examples for one input: | ||
| 155 | |||
| 156 | =over | ||
| 157 | |||
| 158 | =item * | ||
| 159 | |||
| 160 | If using the console, C<{"data":[1,3,1024,1024]}> | ||
| 161 | |||
| 162 | =item * | ||
| 163 | |||
| 164 | If using the CLI, C<{\"data\":[1,3,1024,1024]}> | ||
| 165 | |||
| 166 | =back | ||
| 167 | |||
| 168 | =item * | ||
| 169 | |||
| 170 | Examples for two inputs: | ||
| 171 | |||
| 172 | =over | ||
| 173 | |||
| 174 | =item * | ||
| 175 | |||
| 176 | If using the console, C<{"var1": [1,1,28,28], "var2":[1,1,28,28]}> | ||
| 177 | |||
| 178 | =item * | ||
| 179 | |||
| 180 | If using the CLI, C<{\"var1\": [1,1,28,28], \"var2\":[1,1,28,28]}> | ||
| 181 | |||
| 182 | =back | ||
| 183 | |||
| 184 | =back | ||
| 185 | |||
| 186 | =item * | ||
| 187 | |||
| 188 | C<PyTorch>: You can either specify the name and shape (NCHW format) of | ||
| 189 | expected data inputs in order using a dictionary format for your | ||
| 190 | trained model or you can specify the shape only using a list format. | ||
| 191 | The dictionary formats required for the console and CLI are different. | ||
| 192 | The list formats for the console and CLI are the same. | ||
| 193 | |||
| 194 | =over | ||
| 195 | |||
| 196 | =item * | ||
| 197 | |||
| 198 | Examples for one input in dictionary format: | ||
| 199 | |||
| 200 | =over | ||
| 201 | |||
| 202 | =item * | ||
| 203 | |||
| 204 | If using the console, C<{"input0":[1,3,224,224]}> | ||
| 205 | |||
| 206 | =item * | ||
| 207 | |||
| 208 | If using the CLI, C<{\"input0\":[1,3,224,224]}> | ||
| 209 | |||
| 210 | =back | ||
| 211 | |||
| 212 | =item * | ||
| 213 | |||
| 214 | Example for one input in list format: C<[[1,3,224,224]]> | ||
| 215 | |||
| 216 | =item * | ||
| 217 | |||
| 218 | Examples for two inputs in dictionary format: | ||
| 219 | |||
| 220 | =over | ||
| 221 | |||
| 222 | =item * | ||
| 223 | |||
| 224 | If using the console, C<{"input0":[1,3,224,224], | ||
| 225 | "input1":[1,3,224,224]}> | ||
| 226 | |||
| 227 | =item * | ||
| 228 | |||
| 229 | If using the CLI, C<{\"input0\":[1,3,224,224], | ||
| 230 | \"input1\":[1,3,224,224]}> | ||
| 231 | |||
| 232 | =back | ||
| 233 | |||
| 234 | =item * | ||
| 235 | |||
| 236 | Example for two inputs in list format: C<[[1,3,224,224], | ||
| 237 | [1,3,224,224]]> | ||
| 238 | |||
| 239 | =back | ||
| 240 | |||
| 241 | =item * | ||
| 242 | |||
| 243 | C<XGBOOST>: input data name and shape are not needed. | ||
| 244 | |||
| 245 | =back | ||
| 246 | |||
| 247 | C<DataInputConfig> supports the following parameters for C<CoreML> | ||
| 248 | OutputConfig$TargetDevice (ML Model format): | ||
| 249 | |||
| 250 | =over | ||
| 251 | |||
| 252 | =item * | ||
| 253 | |||
| 254 | C<shape>: Input shape, for example C<{"input_1": {"shape": | ||
| 255 | [1,224,224,3]}}>. In addition to static input shapes, CoreML converter | ||
| 256 | supports Flexible input shapes: | ||
| 257 | |||
| 258 | =over | ||
| 259 | |||
| 260 | =item * | ||
| 261 | |||
| 262 | Range Dimension. You can use the Range Dimension feature if you know | ||
| 263 | the input shape will be within some specific interval in that | ||
| 264 | dimension, for example: C<{"input_1": {"shape": ["1..10", 224, 224, | ||
| 265 | 3]}}> | ||
| 266 | |||
| 267 | =item * | ||
| 268 | |||
| 269 | Enumerated shapes. Sometimes, the models are trained to work only on a | ||
| 270 | select set of inputs. You can enumerate all supported input shapes, for | ||
| 271 | example: C<{"input_1": {"shape": [[1, 224, 224, 3], [1, 160, 160, | ||
| 272 | 3]]}}> | ||
| 273 | |||
| 274 | =back | ||
| 275 | |||
| 276 | =item * | ||
| 277 | |||
| 278 | C<default_shape>: Default input shape. You can set a default shape | ||
| 279 | during conversion for both Range Dimension and Enumerated Shapes. For | ||
| 280 | example C<{"input_1": {"shape": ["1..10", 224, 224, 3], | ||
| 281 | "default_shape": [1, 224, 224, 3]}}> | ||
| 282 | |||
| 283 | =item * | ||
| 284 | |||
| 285 | C<type>: Input type. Allowed values: C<Image> and C<Tensor>. By | ||
| 286 | default, the converter generates an ML Model with inputs of type Tensor | ||
| 287 | (MultiArray). User can set input type to be Image. Image input type | ||
| 288 | requires additional input parameters such as C<bias> and C<scale>. | ||
| 289 | |||
| 290 | =item * | ||
| 291 | |||
| 292 | C<bias>: If the input type is an Image, you need to provide the bias | ||
| 293 | vector. | ||
| 294 | |||
| 295 | =item * | ||
| 296 | |||
| 297 | C<scale>: If the input type is an Image, you need to provide a scale | ||
| 298 | factor. | ||
| 299 | |||
| 300 | =back | ||
| 301 | |||
| 302 | CoreML C<ClassifierConfig> parameters can be specified using | ||
| 303 | OutputConfig$CompilerOptions. CoreML converter supports Tensorflow and | ||
| 304 | PyTorch models. CoreML conversion examples: | ||
| 305 | |||
| 306 | =over | ||
| 307 | |||
| 308 | =item * | ||
| 309 | |||
| 310 | Tensor type input: | ||
| 311 | |||
| 312 | =over | ||
| 313 | |||
| 314 | =item * | ||
| 315 | |||
| 316 | C<"DataInputConfig": {"input_1": {"shape": [[1,224,224,3], | ||
| 317 | [1,160,160,3]], "default_shape": [1,224,224,3]}}> | ||
| 318 | |||
| 319 | =back | ||
| 320 | |||
| 321 | =item * | ||
| 322 | |||
| 323 | Tensor type input without input name (PyTorch): | ||
| 324 | |||
| 325 | =over | ||
| 326 | |||
| 327 | =item * | ||
| 328 | |||
| 329 | C<"DataInputConfig": [{"shape": [[1,3,224,224], [1,3,160,160]], | ||
| 330 | "default_shape": [1,3,224,224]}]> | ||
| 331 | |||
| 332 | =back | ||
| 333 | |||
| 334 | =item * | ||
| 335 | |||
| 336 | Image type input: | ||
| 337 | |||
| 338 | =over | ||
| 339 | |||
| 340 | =item * | ||
| 341 | |||
| 342 | C<"DataInputConfig": {"input_1": {"shape": [[1,224,224,3], | ||
| 343 | [1,160,160,3]], "default_shape": [1,224,224,3], "type": "Image", | ||
| 344 | "bias": [-1,-1,-1], "scale": 0.007843137255}}> | ||
| 345 | |||
| 346 | =item * | ||
| 347 | |||
| 348 | C<"CompilerOptions": {"class_labels": "imagenet_labels_1000.txt"}> | ||
| 349 | |||
| 350 | =back | ||
| 351 | |||
| 352 | =item * | ||
| 353 | |||
| 354 | Image type input without input name (PyTorch): | ||
| 355 | |||
| 356 | =over | ||
| 357 | |||
| 358 | =item * | ||
| 359 | |||
| 360 | C<"DataInputConfig": [{"shape": [[1,3,224,224], [1,3,160,160]], | ||
| 361 | "default_shape": [1,3,224,224], "type": "Image", "bias": [-1,-1,-1], | ||
| 362 | "scale": 0.007843137255}]> | ||
| 363 | |||
| 364 | =item * | ||
| 365 | |||
| 366 | C<"CompilerOptions": {"class_labels": "imagenet_labels_1000.txt"}> | ||
| 367 | |||
| 368 | =back | ||
| 369 | |||
| 370 | =back | ||
| 371 | |||
| 372 | Depending on the model format, C<DataInputConfig> requires the | ||
| 373 | following parameters for C<ml_eia2> OutputConfig:TargetDevice | ||
| 374 | (https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_OutputConfig.html#sagemaker-Type-OutputConfig-TargetDevice). | ||
| 375 | |||
| 376 | =over | ||
| 377 | |||
| 378 | =item * | ||
| 379 | |||
| 380 | For TensorFlow models saved in the SavedModel format, specify the input | ||
| 381 | names from C<signature_def_key> and the input model shapes for | ||
| 382 | C<DataInputConfig>. Specify the C<signature_def_key> in | ||
| 383 | C<OutputConfig:CompilerOptions> | ||
| 384 | (https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_OutputConfig.html#sagemaker-Type-OutputConfig-CompilerOptions) | ||
| 385 | if the model does not use TensorFlow's default signature def key. For | ||
| 386 | example: | ||
| 387 | |||
| 388 | =over | ||
| 389 | |||
| 390 | =item * | ||
| 391 | |||
| 392 | C<"DataInputConfig": {"inputs": [1, 224, 224, 3]}> | ||
| 393 | |||
| 394 | =item * | ||
| 395 | |||
| 396 | C<"CompilerOptions": {"signature_def_key": "serving_custom"}> | ||
| 397 | |||
| 398 | =back | ||
| 399 | |||
| 400 | =item * | ||
| 401 | |||
| 402 | For TensorFlow models saved as a frozen graph, specify the input tensor | ||
| 403 | names and shapes in C<DataInputConfig> and the output tensor names for | ||
| 404 | C<output_names> in C<OutputConfig:CompilerOptions> | ||
| 405 | (https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_OutputConfig.html#sagemaker-Type-OutputConfig-CompilerOptions). | ||
| 406 | For example: | ||
| 407 | |||
| 408 | =over | ||
| 409 | |||
| 410 | =item * | ||
| 411 | |||
| 412 | C<"DataInputConfig": {"input_tensor:0": [1, 224, 224, 3]}> | ||
| 413 | |||
| 414 | =item * | ||
| 415 | |||
| 416 | C<"CompilerOptions": {"output_names": ["output_tensor:0"]}> | ||
| 417 | |||
| 418 | =back | ||
| 419 | |||
| 420 | =back | ||
| 421 | |||
| 422 | |||
| 423 | |||
| 424 | =head2 B<REQUIRED> Framework => Str | ||
| 425 | |||
| 426 | Identifies the framework in which the model was trained. For example: | ||
| 427 | TENSORFLOW. | ||
| 428 | |||
| 429 | |||
| 430 | =head2 FrameworkVersion => Str | ||
| 431 | |||
| 432 | Specifies the framework version to use. | ||
| 433 | |||
| 434 | This API field is only supported for PyTorch framework versions C<1.4>, | ||
| 435 | C<1.5>, and C<1.6> for cloud instance target devices: C<ml_c4>, | ||
| 436 | C<ml_c5>, C<ml_m4>, C<ml_m5>, C<ml_p2>, C<ml_p3>, and C<ml_g4dn>. | ||
| 437 | |||
| 438 | |||
| 439 | =head2 B<REQUIRED> S3Uri => Str | ||
| 440 | |||
| 441 | The S3 path where the model artifacts, which result from model | ||
| 442 | training, are stored. This path must point to a single gzip compressed | ||
| 443 | tar archive (.tar.gz suffix). | ||
| 444 | |||
| 445 | |||
| 446 | |||
| 447 | =head1 SEE ALSO | ||
| 448 | |||
| 449 | This class forms part of L<Paws>, describing an object used in L<Paws::SageMaker> | ||
| 450 | |||
| 451 | =head1 BUGS and CONTRIBUTIONS | ||
| 452 | |||
| 453 | The source code is located here: L<https://github.com/pplu/aws-sdk-perl> | ||
| 454 | |||
| 455 | Please report bugs to: L<https://github.com/pplu/aws-sdk-perl/issues> | ||
| 456 | |||
| 457 | =cut | ||
| 458 |