I have registered a model to mlflow model registry.
When I call ‘load_model’ function to try to fetch the model from model registry and try to make prediction, mlflow cannot find the model from the artifact path I provided:
model_name = "sample-ann-1"
version = 1
loaded_model = mlflow.pyfunc.load_model("models:/{}/{}".format(model_name, version))
And return the following error:
"mlflow.exceptions.MlflowException: The following failures occurred while downloading one or more artifacts from s3://{bucket}/5/8429aef5d8304990ae035c638db093e7/artifacts/../saved-model/model20/: {'': "ClientError('An error occurred (404) when calling the HeadObject operation: Not Found')"}"
When I open s3 browser to check the file in artifact path (s3://{bucket}/5/8429aef5d8304990ae035c638db093e7/artifacts/../saved-model/model20/), I found the model is in the path, not sure why mlflow return 404 not found error

There are multiple ways of creating model's uri, including cloud paths (in your case: S3 bucket) or name/version pairs (your approach). Both ways work fine, for example on my Google Cloud I can do both:
## load from bucket (here: Google Cloud)
model_uri = "gs://mlflow_experiments/test/3/467677aff0074955a4e75492085d52f9/artifacts/models"
mlflow.pyfunc.load_model(model_uri)
## load by name/version
model_uri = 'models:/toy-model/10'
mlflow.pyfunc.load_model(model_uri)
I would suggest to confirm that the model is properly registered, not only visible on Cloud. Test this (adapting appropriately):
client = MlflowClient(mlflow.get_tracking_uri()
client.get_model_version_download_uri('toy-model','10')
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With