Image URIs

Functions for generating ECR image URIs for pre-built SageMaker Docker images.

sagemaker.image_uris.retrieve(framework, region, version=None, py_version=None, instance_type=None, accelerator_type=None, image_scope=None, container_version=None, distribution=None, base_framework_version=None, training_compiler_config=None, model_id=None, model_version=None, tolerate_vulnerable_model=False, tolerate_deprecated_model=False, sdk_version=None, inference_tool=None, serverless_inference_config=None)

Retrieves the ECR URI for the Docker image matching the given arguments.

Ideally this function should not be called directly, rather it should be called from the fit() function inside framework estimator.

Parameters
  • framework (str) – The name of the framework or algorithm.

  • region (str) – The AWS region.

  • version (str) – The framework or algorithm version. This is required if there is more than one supported version for the given framework or algorithm.

  • py_version (str) – The Python version. This is required if there is more than one supported Python version for the given framework version.

  • instance_type (str) – The SageMaker instance type. For supported types, see https://aws.amazon.com/sagemaker/pricing. This is required if there are different images for different processor types.

  • accelerator_type (str) – Elastic Inference accelerator type. For more, see https://docs.aws.amazon.com/sagemaker/latest/dg/ei.html.

  • image_scope (str) – The image type, i.e. what it is used for. Valid values: “training”, “inference”, “inference_graviton”, “eia”. If accelerator_type is set, image_scope is ignored.

  • container_version (str) – the version of docker image. Ideally the value of parameter should be created inside the framework. For custom use, see the list of supported container versions: https://github.com/aws/deep-learning-containers/blob/master/available_images.md (default: None).

  • distribution (dict) – A dictionary with information on how to run distributed training

  • training_compiler_config (TrainingCompilerConfig) – A configuration class for the SageMaker Training Compiler (default: None).

  • model_id (str) – The JumpStart model ID for which to retrieve the image URI (default: None).

  • model_version (str) – The version of the JumpStart model for which to retrieve the image URI (default: None).

  • tolerate_vulnerable_model (bool) – True if vulnerable versions of model specifications should be tolerated without an exception raised. If False, raises an exception if the script used by this version of the model has dependencies with known security vulnerabilities. (Default: False).

  • tolerate_deprecated_model (bool) – True if deprecated versions of model specifications should be tolerated without an exception raised. If False, raises an exception if the version of the model is deprecated. (Default: False).

  • sdk_version (str) – the version of python-sdk that will be used in the image retrieval. (default: None).

  • inference_tool (str) – the tool that will be used to aid in the inference. Valid values: “neuron, None” (default: None).

  • serverless_inference_config (sagemaker.serverless.ServerlessInferenceConfig) – Specifies configuration related to serverless endpoint. Instance type is not provided in serverless inference. So this is used to determine processor type.

Returns

The ECR URI for the corresponding SageMaker Docker image.

Return type

str

Raises
  • NotImplementedError – If the scope is not supported.

  • ValueError – If the combination of arguments specified is not supported or any PipelineVariable object is passed in.

  • VulnerableJumpStartModelError – If any of the dependencies required by the script have known security vulnerabilities.

  • DeprecatedJumpStartModelError – If the version of the model is deprecated.

sagemaker.image_uris.config_for_framework(framework)

Loads the JSON config for the given framework.

sagemaker.image_uris.get_training_image_uri(region, framework, framework_version=None, py_version=None, image_uri=None, distribution=None, compiler_config=None, tensorflow_version=None, pytorch_version=None, instance_type=None)

Retrieves the image URI for training.

Parameters
  • region (str) – The AWS region to use for image URI.

  • framework (str) – The framework for which to retrieve an image URI.

  • framework_version (str) – The framework version for which to retrieve an image URI (default: None).

  • py_version (str) – The python version to use for the image (default: None).

  • image_uri (str) – If an image URI is supplied, it is returned (default: None).

  • distribution (dict) – A dictionary with information on how to run distributed training (default: None).

  • compiler_config (TrainingCompilerConfig) – A configuration class for the SageMaker Training Compiler (default: None).

  • tensorflow_version (str) – The version of TensorFlow to use. (default: None)

  • pytorch_version (str) – The version of PyTorch to use. (default: None)

  • instance_type (str) – The instance type to use. (default: None)

Returns

The image URI string.

Return type

str