vetiver_deploy_sagemaker {vetiver} | R Documentation |
Deploy a vetiver model API to Amazon SageMaker
Description
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.
Usage
vetiver_deploy_sagemaker(
board,
name,
instance_type,
...,
predict_args = list(),
docker_args = list(),
build_args = list(),
endpoint_args = list(),
repo_name = glue("vetiver-sagemaker-{name}")
)
Arguments
board |
An AWS S3 board created with |
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 |
docker_args |
A list of optional arguments passed to
|
build_args |
A list of optional arguments passed to
|
endpoint_args |
A list of optional arguments passed to
|
repo_name |
The name for the AWS ECR repository to store the model. |
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, and -
vetiver_sm_endpoint()
to deploy a SageMaker model endpoint.
These modular functions are available for more advanced use cases.
If you are working locally, you will likely need to explicitly set up your execution role to work correctly. Check out "Execution role requirements" in the smdocker documentation, and especially note that the bucket containing your vetiver model needs to be added as a resource in your IAM role policy.
Value
The deployed vetiver_endpoint_sagemaker()
.
See Also
vetiver_sm_build()
, vetiver_sm_model()
, vetiver_sm_endpoint()
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)
)
}