Address additional CRAN release warnings/notes (#133)
* Fix additional warnings from devtools check. * address the cran release issues * fix the code sytle issue * fix code style issue * Fix the code sytle issues
This commit is contained in:
Родитель
da51d061c9
Коммит
21f89c9132
|
@ -11,7 +11,7 @@ Authors@R: c(
|
|||
)
|
||||
URL: https://github.com/azure/azureml-sdk-for-r
|
||||
BugReports: https://github.com/azure/azureml-sdk-for-r/issues
|
||||
Description: An R interface to the Azure Machine Learning service to build and run machine learning workflows.
|
||||
Description: An R interface to the Azure Machine Learning service to build and run machine learning workloads.
|
||||
Encoding: UTF-8
|
||||
License: MIT + file LICENSE
|
||||
RoxygenNote: 6.1.1
|
||||
|
|
51
R/model.R
51
R/model.R
|
@ -48,8 +48,8 @@ get_model <- function(workspace,
|
|||
#' you have a model that's stored in multiple files, you can register them
|
||||
#' as a single model in your workspace. After registration, you can then
|
||||
#' download or deploy the registered model and receive all the files that
|
||||
#' were registered.\cr
|
||||
#' \cr
|
||||
#' were registered.
|
||||
#'
|
||||
#' Models are identified by name and version. Each time you register a
|
||||
#' model with the same name as an existing one, your workspace's model
|
||||
#' registry assumes that it's a new version. The version is incremented,
|
||||
|
@ -230,8 +230,8 @@ deploy_model <- function(workspace,
|
|||
#' 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.\cr
|
||||
#' \cr
|
||||
#' 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
|
||||
|
@ -241,7 +241,7 @@ deploy_model <- function(workspace,
|
|||
#' * **Generate a Dockerfile**: Download the Dockerfile, model, entry script, and
|
||||
#' other assets needed to build a Docker image. You can then inspect the files or
|
||||
#' make changes before you build the image locally. To use this method, make sure
|
||||
#' to set `generate_dockerfile = TRUE`.\cr
|
||||
#' to set `generate_dockerfile = TRUE`.
|
||||
#' With either scenario, you will need to have Docker installed in your
|
||||
#' development environment.
|
||||
#' @param workspace The `Workspace` object.
|
||||
|
@ -300,7 +300,7 @@ package_model <- function(workspace,
|
|||
#' username <- container_registry$username
|
||||
#' password <- container_registry$password
|
||||
#' ```
|
||||
#' \cr
|
||||
#'
|
||||
#' To then authenticate Docker with the Azure container registry from
|
||||
#' a shell or command-line session, use the following command, replacing
|
||||
#' `<address>`, `<username>`, and `<password>` with the values retrieved
|
||||
|
@ -338,11 +338,11 @@ get_model_package_creation_logs <- function(package,
|
|||
#' Pull the Docker image from a created `ModelPackage` to your
|
||||
#' local Docker environment. The output of this call will
|
||||
#' display the name of the image. For example:
|
||||
#' `Status: Downloaded newer image for myworkspacef78fd10.azurecr.io/package:20190822181338`.\cr
|
||||
#' \cr
|
||||
#' `Status: Downloaded newer image for myworkspacef78fd10.azurecr.io/package:20190822181338`.
|
||||
#'
|
||||
#' This can only be used with a Docker image `ModelPackage` (where
|
||||
#' `package_model()` was called with `generate_dockerfile = FALSE`).\cr
|
||||
#' \cr
|
||||
#' `package_model()` was called with `generate_dockerfile = FALSE`).
|
||||
#'
|
||||
#' After you've pulled the image, you can start a local container based
|
||||
#' on this image using Docker commands.
|
||||
#' @param package The `ModelPackage` object.
|
||||
|
@ -358,12 +358,12 @@ pull_model_package_image <- function(package) {
|
|||
#' your local file system
|
||||
#' @description
|
||||
#' Download the Dockerfile, model, and other assets needed to build
|
||||
#' an image locally from a created `ModelPackage`.\cr
|
||||
#' \cr
|
||||
#' an image locally from a created `ModelPackage`.
|
||||
#'
|
||||
#' This can only be used with a Dockerfile `ModelPackage` (where
|
||||
#' `package_model()` was called with `generate_dockerfile = TRUE` to
|
||||
#' indicated that you wanted only the files and not a fully built image).\cr
|
||||
#' \cr
|
||||
#' indicated that you wanted only the files and not a fully built image).
|
||||
#'
|
||||
#' `save_model_package_files()` downloads the files needed to build the
|
||||
#' image to the `output_directory`. The Dockerfile included in the saved
|
||||
#' files references a base image stored in an Azure container registry.
|
||||
|
@ -423,8 +423,8 @@ wait_for_model_package_creation <- function(package, show_output = FALSE) {
|
|||
#' and the format of the data returned to clients. If the request data is in a
|
||||
#' format that is not usable by your model, the script can transform it into
|
||||
#' an acceptable format. It can also transform the response before returning
|
||||
#' it to the client.\cr
|
||||
#' \cr
|
||||
#' it to the client.
|
||||
#'
|
||||
#' The entry script must contain an `init()` method that loads your model and
|
||||
#' then returns a function that uses the model to make a prediction based on
|
||||
#' the input data passed to the function. Azure ML runs the `init()` method
|
||||
|
@ -432,25 +432,18 @@ wait_for_model_package_creation <- function(package, show_output = FALSE) {
|
|||
#' prediction function returned by `init()` will be run every time the service
|
||||
#' is invoked to make a prediction on some input data. The inputs and outputs
|
||||
#' of this prediction function typically use JSON for serialization and
|
||||
#' deserialization.\cr
|
||||
#' \cr
|
||||
#' deserialization.
|
||||
#'
|
||||
#' To locate the model in your entry script (when you load the model in the
|
||||
#' script's `init()` method), use `AZUREML_MODEL_DIR`, an environment variable
|
||||
#' containing the path to the model location. The environment variable is
|
||||
#' created during service deployment, and you can use it to find the location
|
||||
#' of your deployed model(s).\cr
|
||||
#' \cr
|
||||
#' The following table describes the value of `AZUREML_MODEL_DIR` depending
|
||||
#' on the number of models deployed:
|
||||
#' \tabular{rr}{
|
||||
#' **Deployment** \tab **Environment variable value**\cr
|
||||
#' Single model \tab The path to the folder containing the model\cr
|
||||
#' Multiple models \tab The path to the folder containing all models. Models are located by name and version in this folder (`$MODEL_NAME/$VERSION`)
|
||||
#' }
|
||||
#' of your deployed model(s).
|
||||
#'
|
||||
#' To get the path to a file in a model, combine the environment variable
|
||||
#' with the filename you're looking for. The filenames of the model files
|
||||
#' are preserved during registration and deployment.\cr
|
||||
#' \cr
|
||||
#' are preserved during registration and deployment.
|
||||
#'
|
||||
#' Single model example:
|
||||
#' ```
|
||||
#' model_path <- file.path(Sys.getenv("AZUREML_MODEL_DIR"), "my_model.rds")
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
#' @description
|
||||
#' Deploy a web service to Azure Container Instances for testing or
|
||||
#' debugging. Use ACI for low-scale CPU-based workloads that
|
||||
#' require less than 48 GB of RAM.\cr
|
||||
#' \cr
|
||||
#' require less than 48 GB of RAM.
|
||||
#'
|
||||
#' Deploy to ACI if one of the following conditions is true:
|
||||
#' * You need to quickly deploy and validate your model. You do not need
|
||||
#' to create ACI containers ahead of time. They are created as part of
|
||||
|
@ -80,8 +80,8 @@ aci_webservice_deployment_config <- function(cpu_cores = NULL,
|
|||
#' @description
|
||||
#' Update an ACI web service with the provided properties. You can update the
|
||||
#' web service to use a new model, a new entry script, or new dependencies
|
||||
#' that can be specified in an inference configuration.\cr
|
||||
#' \cr
|
||||
#' that can be specified in an inference configuration.
|
||||
#'
|
||||
#' Values left as `NULL` will remain unchanged in the web service.
|
||||
#' @param webservice The `AciWebservice` object.
|
||||
#' @param tags A named list of key-value tags for the web service,
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
#' Deploy a web service to Azure Kubernetes Service for high-scale
|
||||
#' prodution deployments. Provides fast response time and autoscaling
|
||||
#' of the deployed service. Using GPU for inference when deployed as a
|
||||
#' web service is only supported on AKS.\cr
|
||||
#' \cr
|
||||
#' web service is only supported on AKS.
|
||||
#'
|
||||
#' Deploy to AKS if you need one or more of the following capabilities:
|
||||
#' * Fast response time
|
||||
#' * Autoscaling of the deployed service
|
||||
|
@ -79,8 +79,8 @@
|
|||
#' When deploying to AKS, you deploy to an AKS cluster that is connected to your workspace.
|
||||
#' There are two ways to connect an AKS cluster to your workspace:
|
||||
#' * Create the AKS cluster using Azure ML (see `create_aks_compute()`).
|
||||
#' * Attach an existing AKS cluster to your workspace (see `attach_aks_compute()`).\cr
|
||||
#' \cr
|
||||
#' * Attach an existing AKS cluster to your workspace (see `attach_aks_compute()`).
|
||||
#'
|
||||
#' Pass the `AksCompute` object to the `deployment_target` parameter of `deploy_model()`.
|
||||
#' }
|
||||
#' \subsection{Token-based authentication}{
|
||||
|
@ -161,8 +161,8 @@ aks_webservice_deployment_config <- function(
|
|||
#' @description
|
||||
#' Update an AKS web service with the provided properties. You can update the
|
||||
#' web service to use a new model, a new entry script, or new dependencies
|
||||
#' that can be specified in an inference configuration.\cr
|
||||
#' \cr
|
||||
#' that can be specified in an inference configuration.
|
||||
#'
|
||||
#' Values left as `NULL` will remain unchanged in the web service.
|
||||
#' @param webservice The `AksWebservice` object.
|
||||
#' @param autoscale_enabled If `TRUE` enable autoscaling for the web service.
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
#' Create a deployment config for deploying a local web service
|
||||
#' @description
|
||||
#' You can deploy a model locally for limited testing and troubleshooting.
|
||||
#' To do so, you will need to have Docker installed on your local machine.\cr
|
||||
#' \cr
|
||||
#' To do so, you will need to have Docker installed on your local machine.
|
||||
#'
|
||||
#' If you are using an Azure Machine Learning Compute Instance for
|
||||
#' development, you can also deploy locally on your compute instance.
|
||||
#' @param port An int of the local port on which to expose the service's
|
||||
|
@ -26,8 +26,8 @@ local_webservice_deployment_config <- function(port = NULL) {
|
|||
#' @description
|
||||
#' Update a local web service with the provided properties. You can update the
|
||||
#' web service to use a new model, a new entry script, or new dependencies
|
||||
#' that can be specified in an inference configuration.\cr
|
||||
#' \cr
|
||||
#' that can be specified in an inference configuration.
|
||||
#'
|
||||
#' Values left as `NULL` will remain unchanged in the service.
|
||||
#' @param webservice The `LocalWebservice` object.
|
||||
#' @param models A list of `Model` objects to package into the updated service.
|
||||
|
|
|
@ -19,8 +19,8 @@ get_webservice <- function(workspace, name) {
|
|||
#' @description
|
||||
#' Automatically poll on the running web service deployment and
|
||||
#' wait for the web service to reach a terminal state. Will throw
|
||||
#' an exception if it reaches a non-successful terminal state.\cr
|
||||
#' \cr
|
||||
#' an exception if it reaches a non-successful terminal state.
|
||||
#'
|
||||
#' Typically called after running `deploy_model()`.
|
||||
#' @param webservice The `LocalWebservice`, `AciWebservice`, or
|
||||
#' `AksWebservice` object.
|
||||
|
@ -40,8 +40,8 @@ wait_for_deployment <- function(webservice, show_output = FALSE) {
|
|||
#' @description
|
||||
#' You can get the detailed Docker engine log messages from your
|
||||
#' web service deployment. You can view the logs for local, ACI,
|
||||
#' and AKS deployments.\cr
|
||||
#' \cr
|
||||
#' and AKS deployments.
|
||||
#'
|
||||
#' For example, if your web service deployment fails, you can
|
||||
#' inspect the logs to help troubleshoot.
|
||||
#' @param webservice The `LocalWebservice`, `AciWebservice`, or
|
||||
|
@ -65,12 +65,12 @@ get_webservice_logs <- function(webservice, num_lines = 5000L) {
|
|||
#' `aks_webservice_deployment_config()` for creation and
|
||||
#' `update_aci_webservice()` or `update_aks_webservice()` for updating).
|
||||
#' Note that key-based auth is enabled by default for `AksWebservice`
|
||||
#' but not for `AciWebservice`.\cr
|
||||
#' \cr
|
||||
#' but not for `AciWebservice`.
|
||||
#'
|
||||
#' To check if a web service has key-based auth enabled, you can
|
||||
#' access the following boolean property from the Webservice object:
|
||||
#' `service$auth_enabled`\cr
|
||||
#' \cr
|
||||
#' `service$auth_enabled`
|
||||
#'
|
||||
#' Not supported for `LocalWebservice` deployments.
|
||||
#' @param webservice The `AciWebservice` or `AksWebservice` object.
|
||||
#' @return A list of two strings corresponding to the primary and
|
||||
|
@ -87,8 +87,8 @@ get_webservice_keys <- function(webservice) {
|
|||
#' @description
|
||||
#' Delete a deployed ACI or AKS web service from the given workspace.
|
||||
#' This function call is not asynchronous; it runs until the resource is
|
||||
#' deleted.\cr
|
||||
#' \cr
|
||||
#' deleted.
|
||||
#'
|
||||
#' To delete a `LocalWebservice` see `delete_local_webservice()`.
|
||||
#' @param webservice The `AciWebservice` or `AksWebservice` object.
|
||||
#' @export
|
||||
|
@ -119,8 +119,8 @@ delete_webservice <- function(webservice) {
|
|||
#' a service key as a token in your request header
|
||||
#' (see `get_webservice_keys()`). If you've enabled token-based
|
||||
#' authentication, you will need to provide an JWT token as a bearer
|
||||
#' token in your request header (see `get_webservice_token()`).\cr
|
||||
#' \cr
|
||||
#' token in your request header (see `get_webservice_token()`).
|
||||
#'
|
||||
#' To get the REST API address for the service's scoring endpoint, you can
|
||||
#' access the following property from the Webservice object:
|
||||
#' `service$scoring_uri`
|
||||
|
@ -133,8 +133,8 @@ invoke_webservice <- function(webservice, input_data) {
|
|||
#' @description
|
||||
#' Regenerate either the primary or secondary authentication key for
|
||||
#' an `AciWebservice` or `AksWebservice`.The web service must have
|
||||
#' been deployed with key-based authentication enabled.\cr
|
||||
#' \cr
|
||||
#' been deployed with key-based authentication enabled.
|
||||
#'
|
||||
#' Not supported for `LocalWebservice` deployments.
|
||||
#' @param webservice The `AciWebservice` or `AksWebservice` object.
|
||||
#' @param key_type A string of which key to regenerate. Options are
|
||||
|
@ -153,15 +153,15 @@ generate_new_webservice_key <- function(webservice, key_type) {
|
|||
#' enabled. Token-based authentication requires clients to use an Azure
|
||||
#' Active Directory account to request an authentication token, which is
|
||||
#' used to make requests to the deployed service. Only available for
|
||||
#' AKS deployments.\cr
|
||||
#' \cr
|
||||
#' AKS deployments.
|
||||
#'
|
||||
#' In order to enable token-based authentication, set the
|
||||
#' `token_auth_enabled = TRUE` parameter when you are creating or
|
||||
#' updating a deployment (`aks_webservice_deployment_config()` for creation
|
||||
#' or `update_aks_webservice()` for updating). Note that you cannot have both
|
||||
#' key-based authentication and token-based authentication enabled.
|
||||
#' Token-based authentication is not enabled by default.\cr
|
||||
#' \cr
|
||||
#' Token-based authentication is not enabled by default.
|
||||
#'
|
||||
#' To check if a web service has token-based auth enabled, you can
|
||||
#' access the following boolean property from the Webservice object:
|
||||
#' `service$token_auth_enabled`
|
||||
|
|
|
@ -87,14 +87,14 @@ To begin running experiments with Azure Machine Learning, you must establish a c
|
|||
```
|
||||
Once you've accessed your workspace, you can begin running and tracking your own experiments with Azure Machine Learning SDK for R.
|
||||
|
||||
Take a look at our [code samples](samples/) and [end-to-end vignettes](vignettes/) for examples of what's possible with the SDK!
|
||||
Take a look at our [code samples](https://github.com/Azure/azureml-sdk-for-r/tree/master/samples) and [end-to-end vignettes](https://github.com/Azure/azureml-sdk-for-r/tree/master/vignettes) for examples of what's possible with the SDK!
|
||||
|
||||
## Resources
|
||||
* R SDK package documentation: https://azure.github.io/azureml-sdk-for-r/reference/index.html
|
||||
* Azure Machine Learning service: https://docs.microsoft.com/en-us/azure/machine-learning/service/overview-what-is-azure-ml
|
||||
|
||||
## Contribute
|
||||
We welcome contributions from the community. If you would like to contribute to the repository, please refer to the [contribution guide](CONTRIBUTING.md).
|
||||
We welcome contributions from the community. If you would like to contribute to the repository, please refer to the [contribution guide](https://github.com/Azure/azureml-sdk-for-r/blob/master/CONTRIBUTING.md).
|
||||
|
||||
## Code of Conduct
|
||||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
||||
|
|
|
@ -56,8 +56,8 @@ The \code{AciServiceDeploymentConfiguration} object.
|
|||
\description{
|
||||
Deploy a web service to Azure Container Instances for testing or
|
||||
debugging. Use ACI for low-scale CPU-based workloads that
|
||||
require less than 48 GB of RAM.\cr
|
||||
\cr
|
||||
require less than 48 GB of RAM.
|
||||
|
||||
Deploy to ACI if one of the following conditions is true:
|
||||
\itemize{
|
||||
\item You need to quickly deploy and validate your model. You do not need
|
||||
|
|
|
@ -112,8 +112,8 @@ The \code{AksServiceDeploymentConfiguration} object.
|
|||
Deploy a web service to Azure Kubernetes Service for high-scale
|
||||
prodution deployments. Provides fast response time and autoscaling
|
||||
of the deployed service. Using GPU for inference when deployed as a
|
||||
web service is only supported on AKS.\cr
|
||||
\cr
|
||||
web service is only supported on AKS.
|
||||
|
||||
Deploy to AKS if you need one or more of the following capabilities:
|
||||
\itemize{
|
||||
\item Fast response time
|
||||
|
@ -127,8 +127,9 @@ When deploying to AKS, you deploy to an AKS cluster that is connected to your wo
|
|||
There are two ways to connect an AKS cluster to your workspace:
|
||||
\itemize{
|
||||
\item Create the AKS cluster using Azure ML (see \code{create_aks_compute()}).
|
||||
\item Attach an existing AKS cluster to your workspace (see \code{attach_aks_compute()}).\cr
|
||||
\cr
|
||||
\item Attach an existing AKS cluster to your workspace (see \code{attach_aks_compute()}).
|
||||
}
|
||||
|
||||
Pass the \code{AksCompute} object to the \code{deployment_target} parameter of \code{deploy_model()}.
|
||||
}
|
||||
\subsection{Token-based authentication}{
|
||||
|
@ -141,7 +142,6 @@ workspace's region is available again. In addition, the greater the distance bet
|
|||
cluster's region and your workspace's region, the longer it will take to fetch a token.
|
||||
}
|
||||
}
|
||||
}
|
||||
\section{Examples}{
|
||||
\preformatted{deployment_config <- aks_webservice_deployment_config(cpu_cores = 1, memory_gb = 1)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ delete_webservice(webservice)
|
|||
\description{
|
||||
Delete a deployed ACI or AKS web service from the given workspace.
|
||||
This function call is not asynchronous; it runs until the resource is
|
||||
deleted.\cr
|
||||
\cr
|
||||
deleted.
|
||||
|
||||
To delete a \code{LocalWebservice} see \code{delete_local_webservice()}.
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ generate_new_webservice_key(webservice, key_type)
|
|||
\description{
|
||||
Regenerate either the primary or secondary authentication key for
|
||||
an \code{AciWebservice} or \code{AksWebservice}.The web service must have
|
||||
been deployed with key-based authentication enabled.\cr
|
||||
\cr
|
||||
been deployed with key-based authentication enabled.
|
||||
|
||||
Not supported for \code{LocalWebservice} deployments.
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ username <- container_registry$username
|
|||
password <- container_registry$password
|
||||
}
|
||||
|
||||
\cr
|
||||
To then authenticate Docker with the Azure container registry from
|
||||
a shell or command-line session, use the following command, replacing
|
||||
\code{<address>}, \code{<username>}, and \code{<password>} with the values retrieved
|
||||
|
|
|
@ -22,12 +22,12 @@ when you are creating or updating a deployment (either
|
|||
\code{aks_webservice_deployment_config()} for creation and
|
||||
\code{update_aci_webservice()} or \code{update_aks_webservice()} for updating).
|
||||
Note that key-based auth is enabled by default for \code{AksWebservice}
|
||||
but not for \code{AciWebservice}.\cr
|
||||
\cr
|
||||
but not for \code{AciWebservice}.
|
||||
|
||||
To check if a web service has key-based auth enabled, you can
|
||||
access the following boolean property from the Webservice object:
|
||||
\code{service$auth_enabled}\cr
|
||||
\cr
|
||||
\code{service$auth_enabled}
|
||||
|
||||
Not supported for \code{LocalWebservice} deployments.
|
||||
}
|
||||
\seealso{
|
||||
|
|
|
@ -19,8 +19,8 @@ A string of the logs for the web service.
|
|||
\description{
|
||||
You can get the detailed Docker engine log messages from your
|
||||
web service deployment. You can view the logs for local, ACI,
|
||||
and AKS deployments.\cr
|
||||
\cr
|
||||
and AKS deployments.
|
||||
|
||||
For example, if your web service deployment fails, you can
|
||||
inspect the logs to help troubleshoot.
|
||||
}
|
||||
|
|
|
@ -21,15 +21,15 @@ for a web service that was deployed with token-based authentication
|
|||
enabled. Token-based authentication requires clients to use an Azure
|
||||
Active Directory account to request an authentication token, which is
|
||||
used to make requests to the deployed service. Only available for
|
||||
AKS deployments.\cr
|
||||
\cr
|
||||
AKS deployments.
|
||||
|
||||
In order to enable token-based authentication, set the
|
||||
\code{token_auth_enabled = TRUE} parameter when you are creating or
|
||||
updating a deployment (\code{aks_webservice_deployment_config()} for creation
|
||||
or \code{update_aks_webservice()} for updating). Note that you cannot have both
|
||||
key-based authentication and token-based authentication enabled.
|
||||
Token-based authentication is not enabled by default.\cr
|
||||
\cr
|
||||
Token-based authentication is not enabled by default.
|
||||
|
||||
To check if a web service has token-based auth enabled, you can
|
||||
access the following boolean property from the Webservice object:
|
||||
\code{service$token_auth_enabled}
|
||||
|
|
|
@ -41,8 +41,8 @@ the incoming request data, the format of the data expected by your model,
|
|||
and the format of the data returned to clients. If the request data is in a
|
||||
format that is not usable by your model, the script can transform it into
|
||||
an acceptable format. It can also transform the response before returning
|
||||
it to the client.\cr
|
||||
\cr
|
||||
it to the client.
|
||||
|
||||
The entry script must contain an \code{init()} method that loads your model and
|
||||
then returns a function that uses the model to make a prediction based on
|
||||
the input data passed to the function. Azure ML runs the \code{init()} method
|
||||
|
@ -50,25 +50,18 @@ once, when the Docker container for your web service is started. The
|
|||
prediction function returned by \code{init()} will be run every time the service
|
||||
is invoked to make a prediction on some input data. The inputs and outputs
|
||||
of this prediction function typically use JSON for serialization and
|
||||
deserialization.\cr
|
||||
\cr
|
||||
deserialization.
|
||||
|
||||
To locate the model in your entry script (when you load the model in the
|
||||
script's \code{init()} method), use \code{AZUREML_MODEL_DIR}, an environment variable
|
||||
containing the path to the model location. The environment variable is
|
||||
created during service deployment, and you can use it to find the location
|
||||
of your deployed model(s).\cr
|
||||
\cr
|
||||
The following table describes the value of \code{AZUREML_MODEL_DIR} depending
|
||||
on the number of models deployed:
|
||||
\tabular{rr}{
|
||||
\strong{Deployment} \tab \strong{Environment variable value}\cr
|
||||
Single model \tab The path to the folder containing the model\cr
|
||||
Multiple models \tab The path to the folder containing all models. Models are located by name and version in this folder (\code{$MODEL_NAME/$VERSION})
|
||||
}
|
||||
of your deployed model(s).
|
||||
|
||||
To get the path to a file in a model, combine the environment variable
|
||||
with the filename you're looking for. The filenames of the model files
|
||||
are preserved during registration and deployment.\cr
|
||||
\cr
|
||||
are preserved during registration and deployment.
|
||||
|
||||
Single model example:\preformatted{model_path <- file.path(Sys.getenv("AZUREML_MODEL_DIR"), "my_model.rds")
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ enabled key-based authentication for your service, you will need to provide
|
|||
a service key as a token in your request header
|
||||
(see \code{get_webservice_keys()}). If you've enabled token-based
|
||||
authentication, you will need to provide an JWT token as a bearer
|
||||
token in your request header (see \code{get_webservice_token()}).\cr
|
||||
\cr
|
||||
token in your request header (see \code{get_webservice_token()}).
|
||||
|
||||
To get the REST API address for the service's scoring endpoint, you can
|
||||
access the following property from the Webservice object:
|
||||
\code{service$scoring_uri}
|
||||
|
|
|
@ -15,8 +15,8 @@ The \code{LocalWebserviceDeploymentConfiguration} object.
|
|||
}
|
||||
\description{
|
||||
You can deploy a model locally for limited testing and troubleshooting.
|
||||
To do so, you will need to have Docker installed on your local machine.\cr
|
||||
\cr
|
||||
To do so, you will need to have Docker installed on your local machine.
|
||||
|
||||
If you are using an Azure Machine Learning Compute Instance for
|
||||
development, you can also deploy locally on your compute instance.
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ 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.\cr
|
||||
\cr
|
||||
them, modify them, and build the image manually.
|
||||
|
||||
Model packaging enables you to do these things. \code{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
|
||||
|
@ -40,7 +40,7 @@ and other files needed to host it as a web service.
|
|||
\item \strong{Generate a Dockerfile}: Download the Dockerfile, model, entry script, and
|
||||
other assets needed to build a Docker image. You can then inspect the files or
|
||||
make changes before you build the image locally. To use this method, make sure
|
||||
to set \code{generate_dockerfile = TRUE}.\cr
|
||||
to set \code{generate_dockerfile = TRUE}.
|
||||
With either scenario, you will need to have Docker installed in your
|
||||
development environment.
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@ pull_model_package_image(package)
|
|||
Pull the Docker image from a created \code{ModelPackage} to your
|
||||
local Docker environment. The output of this call will
|
||||
display the name of the image. For example:
|
||||
\code{Status: Downloaded newer image for myworkspacef78fd10.azurecr.io/package:20190822181338}.\cr
|
||||
\cr
|
||||
\code{Status: Downloaded newer image for myworkspacef78fd10.azurecr.io/package:20190822181338}.
|
||||
|
||||
This can only be used with a Docker image \code{ModelPackage} (where
|
||||
\code{package_model()} was called with \code{generate_dockerfile = FALSE}).\cr
|
||||
\cr
|
||||
\code{package_model()} was called with \code{generate_dockerfile = FALSE}).
|
||||
|
||||
After you've pulled the image, you can start a local container based
|
||||
on this image using Docker commands.
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@ container for one or more files that make up your model. For example, if
|
|||
you have a model that's stored in multiple files, you can register them
|
||||
as a single model in your workspace. After registration, you can then
|
||||
download or deploy the registered model and receive all the files that
|
||||
were registered.\cr
|
||||
\cr
|
||||
were registered.
|
||||
|
||||
Models are identified by name and version. Each time you register a
|
||||
model with the same name as an existing one, your workspace's model
|
||||
registry assumes that it's a new version. The version is incremented,
|
||||
|
|
|
@ -15,12 +15,12 @@ will be created to contain the contents of the package.}
|
|||
}
|
||||
\description{
|
||||
Download the Dockerfile, model, and other assets needed to build
|
||||
an image locally from a created \code{ModelPackage}.\cr
|
||||
\cr
|
||||
an image locally from a created \code{ModelPackage}.
|
||||
|
||||
This can only be used with a Dockerfile \code{ModelPackage} (where
|
||||
\code{package_model()} was called with \code{generate_dockerfile = TRUE} to
|
||||
indicated that you wanted only the files and not a fully built image).\cr
|
||||
\cr
|
||||
indicated that you wanted only the files and not a fully built image).
|
||||
|
||||
\code{save_model_package_files()} downloads the files needed to build the
|
||||
image to the \code{output_directory}. The Dockerfile included in the saved
|
||||
files references a base image stored in an Azure container registry.
|
||||
|
|
|
@ -41,8 +41,8 @@ web service.}
|
|||
\description{
|
||||
Update an ACI web service with the provided properties. You can update the
|
||||
web service to use a new model, a new entry script, or new dependencies
|
||||
that can be specified in an inference configuration.\cr
|
||||
\cr
|
||||
that can be specified in an inference configuration.
|
||||
|
||||
Values left as \code{NULL} will remain unchanged in the web service.
|
||||
}
|
||||
\section{Examples}{
|
||||
|
|
|
@ -104,7 +104,7 @@ Both \code{token_auth_enabled} and \code{auth_enabled} cannot be set to \code{TR
|
|||
\description{
|
||||
Update an AKS web service with the provided properties. You can update the
|
||||
web service to use a new model, a new entry script, or new dependencies
|
||||
that can be specified in an inference configuration.\cr
|
||||
\cr
|
||||
that can be specified in an inference configuration.
|
||||
|
||||
Values left as \code{NULL} will remain unchanged in the web service.
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ healthy state. Defaults to \code{FALSE}.}
|
|||
\description{
|
||||
Update a local web service with the provided properties. You can update the
|
||||
web service to use a new model, a new entry script, or new dependencies
|
||||
that can be specified in an inference configuration.\cr
|
||||
\cr
|
||||
that can be specified in an inference configuration.
|
||||
|
||||
Values left as \code{NULL} will remain unchanged in the service.
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ to \code{FALSE}.}
|
|||
\description{
|
||||
Automatically poll on the running web service deployment and
|
||||
wait for the web service to reach a terminal state. Will throw
|
||||
an exception if it reaches a non-successful terminal state.\cr
|
||||
\cr
|
||||
an exception if it reaches a non-successful terminal state.
|
||||
|
||||
Typically called after running \code{deploy_model()}.
|
||||
}
|
||||
\section{Examples}{
|
||||
|
|
Загрузка…
Ссылка в новой задаче