Use prod version of label instead of hardcoded one. (#2826)

* Use prod version of label instead of hardcoded one

* Fix line breaks

* Use pickle instead of joblib

* Fix
This commit is contained in:
nick863 2023-11-10 11:40:21 -08:00 коммит произвёл GitHub
Родитель fd9676da33
Коммит cb0b942d92
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 4 добавлений и 5 удалений

Просмотреть файл

@ -17,7 +17,7 @@ outputs:
type: uri_folder
code: ./infer_src/
# The environment needs to be the same as the one in the AutoML training part.
environment: azureml:AzureML-AutoML:129
environment: azureml:AzureML-AutoML@prod
command: >-
python infer.py
--model_path ${{inputs.model_path}}

Просмотреть файл

@ -1,12 +1,12 @@
import argparse
from datetime import datetime
import os
import pickle
import uuid
import numpy as np
import pandas as pd
from pandas.tseries.frequencies import to_offset
from sklearn.externals import joblib
from sklearn.metrics import mean_absolute_error, mean_squared_error
from azureml.data.dataset_factory import TabularDatasetFactory
@ -25,7 +25,6 @@ except ImportError:
def infer_forecasting_dataset(
X_test, y_test, model, output_dataset, output_dataset_name="results"
):
y_pred, df_all = model.forecast(X_test, y_test, ignore_data_errors=True)
df_all.reset_index(inplace=True, drop=False)
df_all.to_csv(
@ -52,7 +51,8 @@ def get_model(model_path, model_file_name):
fitted_model = torch.load(fh, map_location=map_location)
else:
# Load the sklearn pipeline.
fitted_model = joblib.load(model_full_path)
with open(model_full_path, "rb") as f:
fitted_model = pickle.load(f)
return fitted_model
@ -94,7 +94,6 @@ def get_args():
def get_data(target_column_name, test_dataset):
dfs = []
for fle in filter(lambda x: x.endswith(".csv"), os.listdir(test_dataset)):
dfs.append(pd.read_csv(os.path.join(test_dataset, fle)))