Emil L
Emil L

Reputation: 21111

Include additional scripts when deploying a Azure ML experimentation service

When training my model the data I start with consist of rows of json data and the expected values I would like to predict from that json data. The json data follows the schema I my deployed service will receive the input as. Before training I run a number of python functions to transform the data and extract features calculated from the raw json data. It is that transformed data which my model is trained on.

I have extracted the code to transform the json data into the input my model expects into a separate python file. Now I would like to have my scoring script use that python script to prepare the input sent to the service before feeding it into my trained model.

Is there a way to include the data transformation script with the scoring script when deploying my service using the cli command:

az ml service create realtime 
    -f <scoring-script>.py 
    --model-file model.pkl 
    -s service_schema.json 
    -n <some-name> 
    -r python 
    --collect-model-data true 
    -c aml_config\conda_dependencies.yml

(the new lines in the above command added for clarity)

The two ways I've come up with is to either:

Is there another way to achive my goal of having a separate data transformation script used both in training and in scoring?

Upvotes: 1

Views: 425

Answers (1)

Dan Ciborowski - MSFT
Dan Ciborowski - MSFT

Reputation: 7237

So running az ml service create realtime -h provides information about the -d flag.

-d : Files and directories required by the service. Multiple dependencies can be specified with additional -d arguments.

Please try using this flag and provide the additional python file that you would like to call too from your score.py

Upvotes: 1

Related Questions