package_model {azuremlsdk}R Documentation

Create a model package that packages all the assets needed to host a model as a web service

Description

In some cases, you might want to create a Docker image without deploying the model (for example, if you plan to deploy to Azure App Service). Or you might want to download the image and run it on a local Docker installation. You might even want to download the files used to build the image, inspect them, modify them, and build the image manually.

Model packaging enables you to do these things. package_model() packages all the assets needed to host a model as a web service and allows you to download either a fully built Docker image or the files needed to build one. There are two ways to use model packaging:

Usage

package_model(workspace, models, inference_config, generate_dockerfile = FALSE)

Arguments

workspace

The Workspace object.

models

A list of Model objects to include in the package. Can be an empty list.

inference_config

The InferenceConfig object to configure the operation of the models.

generate_dockerfile

If TRUE, will create a Dockerfile that can be run locally instead of building an image.

Value

The ModelPackage object.

See Also

wait_for_model_package_creation(), get_model_package_container_registry(), get_model_package_creation_logs(), pull_model_package_image(), save_model_package_files()

Examples

# Package a registered model
## Not run: 
ws <- load_workspace_from_config()
model <- get_model(ws, name = "my_model")
r_env <- r_environment(name = "r_env")
inference_config <- inference_config(entry_script = "score.R",
                                     source_directory = ".",
                                     environment = r_env)
package <- package_model(ws,
                         models = list(model),
                         inference_config = inference_config)
wait_for_model_package_creation(show_output = TRUE)

## End(Not run)

[Package azuremlsdk version 1.10.0 Index]