Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] wrong description on load keras models error #11809

Open
2 of 23 tasks
marcoramosw opened this issue Apr 24, 2024 · 3 comments
Open
2 of 23 tasks

[BUG] wrong description on load keras models error #11809

marcoramosw opened this issue Apr 24, 2024 · 3 comments
Labels
area/artifacts Artifact stores and artifact logging bug Something isn't working

Comments

@marcoramosw
Copy link

Issues Policy acknowledgement

  • I have read and agree to submit bug reports in accordance with the issues policy

Where did you encounter this bug?

Local machine

Willingness to contribute

No. I cannot contribute a bug fix at this time.

MLflow version

  • Client: 2.11.3
  • Tracking server: 1.x.y

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Microsoft Windows 11 Enterprise 10.0.22631 Build 22631
  • Python version: 3.10.14
  • yarn version, if running the dev UI:

Describe the problem

if logging a keras model to local filesystem, and when loading the model with a missing artifact dir "models" at the end, it says that it could not find a registered artifact repository saying that currently registered schemes are: ['', 'file', 's3', 'r2', 'gs', 'wasbs', 'ftp', 'sftp', 'dbfs', 'hdfs', 'viewfs', 'runs', 'models', 'http', 'https', 'mlflow-artifacts'] although the artifact path starts indeed with 'file' and that is not the problem, it was just "models" was missing at the end of the string, so the error does not describe the problem correctly

Tracking information

REPLACE_ME

Code to reproduce issue

import mlflow
from tensorflow import keras
from tensorflow.keras.layers import Dense

if __name__=="__main__":
    mlflow.set_experiment("test")
    mlflow.start_run()
    model = keras.Sequential(
        Dense(1, input_dim=2, activation='sigmoid')
    )
    mlflow.keras.log_model(model, "models")

    #this load will throw a bug because it should be mlflow.get_artifact_uri() + "/models", but the error log is saying that the problem is at the start of the string
    mlflow.keras.load_model(mlflow.get_artifact_uri())

Stack trace

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2024.1\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_exec2.py", line 3, in Exec
    exec(exp, global_vars, local_vars)
  File "<input>", line 1, in <module>
  File "C:\Users\user\AppData\Local\miniconda3\envs\<env_name>\lib\site-packages\mlflow\tensorflow\__init__.py", line 624, in load_model
    model_conf = Model.load(model_configuration_path)
  File "C:\Users\user\AppData\Local\miniconda3\envs\<env_name>\lib\site-packages\mlflow\models\model.py", line 548, in load
    path = download_artifacts(artifact_uri=path)
  File "C:\Users\user\AppData\Local\miniconda3\envs\<env_name>\lib\site-packages\mlflow\artifacts\__init__.py", line 63, in download_artifacts
    return _download_artifact_from_uri(artifact_uri, output_path=dst_path)
  File "C:\Users\user\AppData\Local\miniconda3\envs\<env_name>\lib\site-packages\mlflow\tracking\artifact_utils.py", line 105, in _download_artifact_from_uri
    return get_artifact_repository(artifact_uri=root_uri).download_artifacts(
  File "C:\Users\user\AppData\Local\miniconda3\envs\<env_name>\lib\site-packages\mlflow\store\artifact\artifact_repository_registry.py", line 124, in get_artifact_repository
    return _artifact_repository_registry.get_artifact_repository(artifact_uri)
  File "C:\Users\user\AppData\Local\miniconda3\envs\<env_name>\lib\site-packages\mlflow\store\artifact\artifact_repository_registry.py", line 73, in get_artifact_repository
    raise MlflowException(
mlflow.exceptions.MlflowException: Could not find a registered artifact repository for: c:. Currently registered schemes are: ['', 'file', 's3', 'r2', 'gs', 'wasbs', 'ftp', 'sftp', 'dbfs', 'hdfs', 'viewfs', 'runs', 'models', 'http', 'https', 'mlflow-artifacts']

Other info / logs

REPLACE_ME

What component(s) does this bug affect?

  • area/artifacts: Artifact stores and artifact logging
  • area/build: Build and test infrastructure for MLflow
  • area/deployments: MLflow Deployments client APIs, server, and third-party Deployments integrations
  • area/docs: MLflow documentation pages
  • area/examples: Example code
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/recipes: Recipes, Recipe APIs, Recipe configs, Recipe Templates
  • area/projects: MLproject format, project running backends
  • area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • area/server-infra: MLflow Tracking server backend
  • area/tracking: Tracking Service, tracking client APIs, autologging

What interface(s) does this bug affect?

  • area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • area/docker: Docker use across MLflow's components, such as MLflow Projects and MLflow Models
  • area/sqlalchemy: Use of SQLAlchemy in the Tracking Service or Model Registry
  • area/windows: Windows support

What language(s) does this bug affect?

  • language/r: R APIs and clients
  • language/java: Java APIs and clients
  • language/new: Proposals for new client languages

What integration(s) does this bug affect?

  • integrations/azure: Azure and Azure ML integrations
  • integrations/sagemaker: SageMaker integrations
  • integrations/databricks: Databricks integrations
@marcoramosw marcoramosw added the bug Something isn't working label Apr 24, 2024
@github-actions github-actions bot added the area/artifacts Artifact stores and artifact logging label Apr 24, 2024
@marcoramosw
Copy link
Author

mlflow.get_artifact_uri()

returns:
'file:///C:/Users/users/repo/source/mlruns/340704544098555564/5a03e43832f94e30aec44bbba19e277d/artifacts'

the bug error says the problem is in "C:" part of the string, when in fact that is not the problem, the problem is that "/models" is missing from the end of the string

so if I pass 'file:///C:/Users/users/repo/source/mlruns/340704544098555564/5a03e43832f94e30aec44bbba19e277d/artifacts/models'

to mlflow.keras.load_model(), the issue is resolved

@WeichenXu123
Copy link
Collaborator

Thanks, we should refine the error message, but this is not a critical bug.

Copy link

github-actions bot commented May 2, 2024

@mlflow/mlflow-team Please assign a maintainer and start triaging this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/artifacts Artifact stores and artifact logging bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants