0

我在使用自定义 docker 映像部署模型时遇到问题。部署失败,因为所需的包不在“默认”环境中,我需要指定一个自定义的。("/miniconda/envs/py37/bin/python")

I am using the same image to run the training, and with the estimator class I do have a way to specify the environment. Is it possible to something similar with the InferenceConfig?

    est = Estimator(source_directory=script_folder,
                    script_params=script_params,
                    inputs=inputs,
                    compute_target=gpu_compute_target,
                    entry_script='train.py',
                    image_registry_details = my_registry,
                    custom_docker_image='omr:latest',
                    use_gpu=True,
                    user_managed=True)
    est.run_config.environment.python.user_managed_dependencies = True
    est.run_config.environment.python.interpreter_path = "/miniconda/envs/py37/bin/python"



    #establish container configuration using custom base image
    privateRegistry = aml_utils.getContainerRegistryDetails()
    inference_config = InferenceConfig(source_directory="./detect",
                                       runtime= "python", 
                                       entry_script="aml_score.py",
                                       enable_gpu=False,
                                       base_image="amlworkspaceom3760145996.azurecr.io/omr:latest",
                                       base_image_registry = privateRegistry)

    #deploy model via AKS deployment target
    deployment_config = AksWebservice.deploy_configuration(gpu_cores = 1, memory_gb = 1, auth_enabled = False)
    targetcluster = aml_utils.getGpuDeploymentTarget(ws)

    model_service = Model.deploy(workspace = ws,
                               name = "model_name,
                               models = [model],
                               inference_config = inference_config, 
                               deployment_config = deployment_config,
                               deployment_target = targetcluster)
4

1 回答 1

0

我们尚未更新我们的文档,但您可以在 InferenceConfig 中使用环境 :)

SDK 文档:https ://docs.microsoft.com/en-us/python/api/azureml-core/azureml.core.model.inferenceconfig?view=azure-ml-py#definition

environment环境

用于部署的环境对象。不必注册。用户应提供此参数或其他参数,而不是两者。各个参数不会用作环境对象的覆盖。例外情况包括 entry_script、source_directory 和 description。

环境参数用于代替 runtime/baseimage/baseregistry

于 2019-08-09T01:02:27.907 回答