I was trying to register a model using the Run
Class like this:
model = run.register_model(
model_name=model_name,
model_path=model_path)
Errors with message: Could not locate the provided model_path ... in the set of files uploaded to the run...
CodePudding user response:
The only way I found to fix the issue was to use the Model
Class instead:
model = Model.register(
workspace=ws,
model_name=model_name,
model_path=model_path,
model_framework=Model.Framework.SCIKITLEARN,
model_framework_version=sklearn.__version__,
description='Model Deescription',
tags={'Name' : 'ModelName', 'Type' : 'Production'},
model_framework=Model.Framework.SCIKITLEARN,
model_framework_version='1.0'
)
CodePudding user response:
I think the problem is that you rely on AML background process to automatically upload content under ./outputs to AML workspace. But when the upload is not complete and we immediately call run.register_model which takes the content from AML workspace then the error will happen. To avoid that situation, you can do it like this:
- Persist model (joblib.dump) to a custom folder other than outputs
- Manually run upload_file to upload the model AML workspace. Name the destination same name with your model file.
- Then run run.register_model.