Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 3 additions & 20 deletions code/register/register_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import json
import sys
from azureml.core import Run
from azureml.core.model import Model
import argparse

from azureml.core.authentication import AzureCliAuthentication
Expand Down Expand Up @@ -90,33 +89,17 @@
names = run.get_file_names
names()
print("Run ID for last run: {}".format(run_id))
model_local_dir = "model"
os.makedirs(model_local_dir, exist_ok=True)

# Download Model to Project root directory
# model_name = "sklearn_regression_model.pkl"
run.download_file(
name="./outputs/" + model_name, output_file_path="./model/" + model_name
)
print("Downloaded model {} to Project root directory".format(model_name))
os.chdir("./model")
model = Model.register(
model_path=model_name, # this points to a local file
model_name=model_name, # this is the name the model is registered as
tags={"area": "diabetes", "type": "regression", "run_id": run_id},
description="Regression model for diabetes dataset",
workspace=ws,
)
model = run.register_model(model_name=model_name,
model_path="./outputs/" + model_name,
tags={"area": "diabetes", "type": "regression"})
os.chdir("..")
print(
"Model registered: {} \nModel Description: {} \nModel Version: {}".format(
model.name, model.description, model.version
)
)

# Remove the evaluate.json as we no longer need it
# os.remove("aml_config/evaluate.json")

# Writing the registered model details to /aml_config/model.json
model_json = {}
model_json["model_name"] = model.name
Expand Down