Use vetiver_deploy_sagemaker()
to deploy a vetiver_model()
that has been versioned and stored via vetiver_pin_write()
as a Plumber API
on Amazon SageMaker.
Arguments
- board
An AWS S3 board created with
pins::board_s3()
. This board must be in the correct region for your SageMaker instance.- name
Pin name.
- instance_type
Type of EC2 instance to use; see Amazon SageMaker pricing.
- ...
Not currently used.
- predict_args
A list of optional arguments passed to
vetiver_api()
such as the predictiontype
.- docker_args
A list of optional arguments passed to
vetiver_write_docker()
such as thelockfile
name or whether to userspm
. Do not passadditional_pkgs
here, as this function usesadditional_pkgs = required_pkgs(board)
.- build_args
A list of optional arguments passed to
vetiver_sm_build()
such as the modelversion
or thecompute_type
.- endpoint_args
A list of optional arguments passed to
vetiver_sm_endpoint()
such asaccelerator_type
ordata_capture_config
.- repo_name
The name for the AWS ECR repository to store the model.
Value
The deployed vetiver_endpoint_sagemaker()
.
Details
This function stores your model deployment image in the same bucket used
by board
.
The function vetiver_deploy_sagemaker()
uses:
vetiver_sm_build()
to build and push a Docker image to ECR,vetiver_sm_model()
to create a SageMaker model, andvetiver_sm_endpoint()
to deploy a SageMaker model endpoint.
These modular functions are available for more advanced use cases.
Examples
if (FALSE) {
library(pins)
b <- board_s3(bucket = "my-existing-bucket")
cars_lm <- lm(mpg ~ ., data = mtcars)
v <- vetiver_model(cars_lm, "cars_linear")
vetiver_pin_write(b, v)
endpoint <- vetiver_deploy_sagemaker(
board = b,
name = "cars_linear",
instance_type = "ml.t2.medium",
predict_args = list(type = "class", debug = TRUE)
)
}