Designing and Implementing a Data Science Solution on Azure | DP-100 Exam Question

Real-time Inferencing Web Service Configuration | DP-100 Exam Question

Question

You have successfully trained your ML model and now it is ready to be deployed as a real-time inferencing web service.

You've just started writing the script which configures the deployment including the model to deploy, the compute environment etc.

Related to this task, which two of the following statements are true?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

Answers: B and D.

Option A is incorrect because the path to the registered model (or models) you want to deploy must be defined in the entry script (in the init() section) rather than in the inference_config.

The rest of the statement is true.

Option B is CORRECT because it is the entry script which is used to define the path to the model(s) to be deployed; the inference configuration links the entry script and its runtime configuration together, and the deployment configuration describes all the attributes of the deployment's target compute.

Option C is incorrect because all the compute parameters (including number of cores, size of memory, autoscaling limits etc.) must be set in the deployment_config.

The rest of the statement is true.

Option D is CORRECT because it is actually the inference_config which is used to connect the script to be run with its run environment.

Sample inferencec_config:

<pre class="brush:java;">inference_config = InferenceConfig(runtime= "python",

entry_script=script_file, # entry script.

conda_file=env_file) # reference to environment definition</pre>Option E is incorrect because it is the init() section of the entry script which is used to load a registered model in the initialization phase of the service deployment.

The run() function handles requests while the model is running.

Reference:

When deploying an ML model as a real-time inferencing web service on Azure, there are several configurations that need to be set up. The following statements are provided as options to choose from:

A. You define the path to your registered model in the inference_config; call model to make predictions in the run() section of the entry script; set the compute memory size in deployment_config B. You define the path to your model in the entry script; add reference to your entry script into inference_config; define the size of the compute in deployment_config C. You define the environment and the compute size in the inference_config; define the path to your model in the init() section of the entry script. D. The inference_config links the model script and the run environment together E. It is the run() section of the entry script which loads a registered model from a designated folder.

Out of these statements, A and D are true. Let's discuss them in detail.

A. You define the path to your registered model in the inference_config; call model to make predictions in the run() section of the entry script; set the compute memory size in deployment_config.

This statement is true because:

  • The inference_config file is used to define the environment needed for inferencing. It includes information such as the entry script and the location of the model file. The path to the registered model should be defined in the inference_config file.
  • The run() section of the entry script is where you make predictions using the loaded model. This involves calling the predict method on the loaded model.
  • The deployment_config file is used to define the compute resources needed for deployment. This includes setting the memory size of the compute resources.

B. You define the path to your model in the entry script; add reference to your entry script into inference_config; define the size of the compute in deployment_config.

This statement is not entirely accurate because:

  • While you can define the path to the model in the entry script, it is recommended to define it in the inference_config file to avoid hardcoding the path.
  • The reference to the entry script is added in the deployment_config file, not the inference_config file.
  • The size of the compute is defined in the deployment_config file, which is true.

C. You define the environment and the compute size in the inference_config; define the path to your model in the init() section of the entry script.

This statement is not entirely accurate because:

  • While you can define the environment and compute size in the inference_config file, it is not recommended to define the path to the model in the init() section of the entry script.
  • The recommended location to define the path to the model is in the inference_config file.

D. The inference_config links the model script and the run environment together.

This statement is true because:

  • The inference_config file is used to define the environment needed for inferencing. This includes information such as the entry script and the location of the model file. It links the model script and the run environment together.

E. It is the run() section of the entry script which loads a registered model from a designated folder.

This statement is not entirely accurate because:

  • While the run() section of the entry script is where you make predictions using the loaded model, it is not responsible for loading the model from the designated folder.
  • The loading of the model typically happens in the init() section of the entry script or in a separate script that is called from the entry script.