i have this problem:
I have trained and registered a ml model via automated machine learning on the Azure Machine Learning studio platform
The result is an XGBoost model that i register without problem or waring in the workspace.
I need to deploy it to a batch endpoint, but with a custom scoring script:
def init():
global model
# AZUREML_MODEL_DIR is an environment variable created during deployment
# The path "model" is the name of the registered model's folder
model_path = os.environ["AZUREML_MODEL_DIR"]
model_file = glob.glob(f"{model_path}/*/*.pkl")[-1]
# load the model
with open(model_file, "rb") as file:
model = pickle.load(file)
def run(mini_batch: List[str]) -> Union[List[Any], pd.DataFrame]:
results = []
probs = []
for file in mini_batch:
rows = pd.read_csv(file)
probs = [el[1] for el in model.predict_proba(rows)]
return pd.DataFrame(probs)
I tried these ways to load the model:
- By mlflow
- By pickle
The problem is always the same:
ModuleNotFoundError: No module named 'azureml.training'
i tried to read the pkl file and the 'azureml.training' module is required by the model in the first row:
[b'\x80\x04\x958\x05\x00\x00\x00\x00\x00\x00\x8c<azureml.training.tabular.models.forecasting_pipeline_wrapper\x94\x8c\x12RegressionPipeline\x94\x93\x94)\x81\x94}\x94 ...
I tried to install all the libraries suggested by documentation:
- azureml-core
- azureml-training-core
- azureml-sdk[train]
Some hint?