|
27 | 27 | import json
|
28 | 28 | import sys
|
29 | 29 | from azureml.core import Run
|
30 |
| -from azureml.core.model import Model |
31 | 30 | import argparse
|
32 | 31 |
|
33 | 32 | from azureml.core.authentication import AzureCliAuthentication
|
|
90 | 89 | names = run.get_file_names
|
91 | 90 | names()
|
92 | 91 | print("Run ID for last run: {}".format(run_id))
|
93 |
| -model_local_dir = "model" |
94 |
| -os.makedirs(model_local_dir, exist_ok=True) |
95 | 92 |
|
96 |
| -# Download Model to Project root directory |
97 |
| -# model_name = "sklearn_regression_model.pkl" |
98 |
| -run.download_file( |
99 |
| - name="./outputs/" + model_name, output_file_path="./model/" + model_name |
100 |
| -) |
101 |
| -print("Downloaded model {} to Project root directory".format(model_name)) |
102 |
| -os.chdir("./model") |
103 |
| -model = Model.register( |
104 |
| - model_path=model_name, # this points to a local file |
105 |
| - model_name=model_name, # this is the name the model is registered as |
106 |
| - tags={"area": "diabetes", "type": "regression", "run_id": run_id}, |
107 |
| - description="Regression model for diabetes dataset", |
108 |
| - workspace=ws, |
109 |
| -) |
| 93 | +model = run.register_model(model_name=model_name, |
| 94 | + model_path="./outputs/" + model_name, |
| 95 | + tags={"area": "diabetes", "type": "regression"}) |
110 | 96 | os.chdir("..")
|
111 | 97 | print(
|
112 | 98 | "Model registered: {} \nModel Description: {} \nModel Version: {}".format(
|
113 | 99 | model.name, model.description, model.version
|
114 | 100 | )
|
115 | 101 | )
|
116 | 102 |
|
117 |
| -# Remove the evaluate.json as we no longer need it |
118 |
| -# os.remove("aml_config/evaluate.json") |
119 |
| - |
120 | 103 | # Writing the registered model details to /aml_config/model.json
|
121 | 104 | model_json = {}
|
122 | 105 | model_json["model_name"] = model.name
|
|
0 commit comments