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)会不会是score.R必须上传到Azure环境,而不是本地的,因为它在开发机器上?我现在的想法是,source_directory。是指本地系统(即在dev机器上)?
发布于 2021-05-17 22:13:54
source_directory指的是本地系统(即在开发机器上)?
对,是这样。并且entry_script应该是在source_directory中找到的文件。如果entry_script引用了其他文件,它们也应该在source_directory中。SDK将处理快照您的源目录,并将其上传到远程计算机。
出于这个原因,建议您将打算在远程计算机上运行的代码与项目的其余部分隔离开来,如下所示。source_directory=./scoring在deploy-to-aci.R中的位置。
dir/
deploy-to-aci.R
scoring/
score.R
sensitive_data.csvhttps://stackoverflow.com/questions/67570921
复制相似问题