ChainerModel: ChainerModel Class

ChainerModelR Documentation

ChainerModel Class

Description

An Chainer SageMaker “Model“ that can be deployed to a SageMaker “Endpoint“.

Super classes

sagemaker.mlcore::ModelBase -> sagemaker.mlcore::Model -> sagemaker.mlcore::FrameworkModel -> ChainerModel

Methods

Public methods

Inherited methods

Method new()

Initialize an ChainerModel.

Usage
ChainerModel$new(
  model_data,
  role,
  entry_point,
  image_uri = NULL,
  framework_version = NULL,
  py_version = NULL,
  predictor_cls = ChainerPredictor,
  model_server_workers = NULL,
  ...
)
Arguments
model_data

(str): The S3 location of a SageMaker model data “.tar.gz“ file.

role

(str): An AWS IAM role (either name or full ARN). The Amazon SageMaker training jobs and APIs that create Amazon SageMaker endpoints use this role to access training data and model artifacts. After the endpoint is created, the inference code might use the IAM role, if it needs to access an AWS resource.

entry_point

(str): Path (absolute or relative) to the Python source file which should be executed as the entry point to model hosting. If “source_dir“ is specified, then “entry_point“ must point to a file located at the root of “source_dir“.

image_uri

(str): A Docker image URI (default: None). If not specified, a default image for Chainer will be used. If “framework_version“ or “py_version“ are “None“, then “image_uri“ is required. If also “None“, then a “ValueError“ will be raised.

framework_version

(str): Chainer version you want to use for executing your model training code. Defaults to “None“. Required unless “image_uri“ is provided.

py_version

(str): Python version you want to use for executing your model training code. Defaults to “None“. Required unless “image_uri“ is provided.

predictor_cls

(callable[str, sagemaker.session.Session]): A function to call to create a predictor with an endpoint name and SageMaker “Session“. If specified, “deploy()“ returns the result of invoking this function on the created endpoint name.

model_server_workers

(int): Optional. The number of worker processes used by the inference server. If None, server will use one worker per vCPU.

...

: Keyword arguments passed to the :class:'~sagemaker.model.FrameworkModel' initializer.


Method prepare_container_def()

Return a container definition with framework configuration set in model environment variables.

Usage
ChainerModel$prepare_container_def(
  instance_type = NULL,
  accelerator_type = NULL
)
Arguments
instance_type

(str): The EC2 instance type to deploy this Model to. For example, 'ml.p2.xlarge'.

accelerator_type

(str): The Elastic Inference accelerator type to deploy to the instance for loading and making inferences to the model. For example, 'ml.eia1.medium'.

Returns

dict[str, str]: A container definition object usable with the CreateModel API.


Method serving_image_uri()

Create a URI for the serving image.

Usage
ChainerModel$serving_image_uri(
  region_name,
  instance_type,
  accelerator_type = NULL
)
Arguments
region_name

(str): AWS region where the image is uploaded.

instance_type

(str): SageMaker instance type. Used to determine device type (cpu/gpu/family-specific optimized).

accelerator_type

(str): The Elastic Inference accelerator type to deploy to the instance for loading and making inferences to the model. For example, 'ml.eia1.medium'.

Returns

str: The appropriate image URI based on the given parameters.


Method clone()

The objects of this class are cloneable with this method.

Usage
ChainerModel$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


DyfanJones/sagemaker-r-mlframework documentation built on March 18, 2022, 7:41 a.m.