After successfully training your ML model and after selecting the best run, you are about to deploy it as a web service to the production environment.
Because you anticipate a massive amount of requests to be handled by the service, you choose AKS as a compute target.
You want to use the following script to deploy your model:
# deploy model from azureml.core.model import Model service = Model.deploy(workspace=ws, name = 'my-inference-service', models = [classification_model], inference_config = my_inference_config, deployment_config = my_deploy_config, deployment_target = my_production_cluster) service.wait_for_deployment(show_output = True)After running the deployment script, you receive an error.
After a short investigation you find that an important setting is missing from the inference_config definition:
# inference config from azureml.core.model import InferenceConfig inference_config = InferenceConfig(runtime= "python", source_directory = 'my_files', <insert code here>, conda_file="environment.yml")You decide to add <entry_script="my_scoring.py"> Does this solve the problem??
Click on the arrows to vote for the correct answer
A. B.Answer: A.
Option A is CORRECT because the InferenceConfig object is used to combine two important things: the entry script and the environment definition.
The entry_script defines the path to the file that contains the ML code to execute, therefore it must be set.
Option B is incorrect because the entry_script parameter is actually missing from the InferenceConfig definition.
Adding it does solve the problem.
Reference:
Adding the entry_script parameter to the InferenceConfig definition is necessary for the successful deployment of the ML model as a web service, as it specifies the script that will be used for scoring or predicting. Therefore, the correct answer is A. Yes.
When deploying a machine learning model as a web service on AKS, you need to provide an InferenceConfig object that defines how the model will be executed. This includes specifying the runtime environment, the location of the scoring script, and any dependencies required for the script to run.
The runtime parameter in the InferenceConfig specifies the language in which the scoring script is written. In this case, it is set to "python". The source_directory parameter specifies the directory containing the scoring script and any other required files.
The entry_script parameter specifies the name of the scoring script to be used when the web service is called. This script should have a function that takes input data, applies the model to it, and returns the results. This function is typically named "run" and is defined in the scoring script.
If the entry_script parameter is missing or not set correctly, the deployment will fail with an error message indicating that the scoring script could not be found. Therefore, adding the entry_script parameter with the correct value, in this case "my_scoring.py", should solve the problem and allow the deployment to complete successfully.