简体   繁体   中英

score/entry file for azure machine learning web services using azuremlsdk

Looking at this example :

library(azuremlsdk)
library(jsonlite)

ws <- load_workspace_from_config()

# Register the model
model <- register_model(ws, model_path = "model.rds", model_name = "model.rds")

# Create environment
r_env <- r_environment(name = "r_env")

# Create inference config
inference_config <- inference_config(
  entry_script = "score.R",
  source_directory = ".",
  environment = r_env)

# Create ACI deployment config
deployment_config <- aci_webservice_deployment_config(cpu_cores = 1,
                                                      memory_gb = 1)

# Deploy the web service
service_name <- paste0('aciwebservice-', sample(1:100, 1, replace=TRUE))
service <- deploy_model(ws, 
                        service_name, 
                        list(model), 
                        inference_config, 
                        deployment_config)
wait_for_deployment(service, show_output = TRUE)

Could it be that score.R has to be uploaded to the Azure environment and is not local as in the sense that it is on the dev machine? My current thinking is, that source_directory. refers to the local system (ie on the dev machine)?

source_directory refers to the local system (ie on the dev machine)?

Correct. And the entry_script should be a file found in the source_directory . If the entry_script refers to other files, they should also be in the source_directory . The SDK will handle snapshotting your source directory and uploading it to the remote compute.

For this reason, it is advised that you isolate code meant to run on the remote compute from the rest of your project like below. Where source_directory=./scoring in the deploy-to-aci.R .

dir/
    deploy-to-aci.R
    scoring/
        score.R
    sensitive_data.csv

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM