Skip to content

Log model uuid#5149

Merged
WeichenXu123 merged 8 commits into
mlflow:masterfrom
WeichenXu123:add_model_uuid
Dec 13, 2021
Merged

Log model uuid#5149
WeichenXu123 merged 8 commits into
mlflow:masterfrom
WeichenXu123:add_model_uuid

Conversation

@WeichenXu123

@WeichenXu123 WeichenXu123 commented Dec 7, 2021

Copy link
Copy Markdown
Collaborator

Signed-off-by: Weichen Xu weichen.xu@databricks.com

What changes are proposed in this pull request?

Testing code:

import numpy as np
from sklearn.linear_model import LinearRegression

import mlflow
from mlflow.tracking.artifact_utils import get_artifact_uri

import os
os.environ['MLFLOW_AUTOLOGGING_TESTING'] = 'true'
# enable autologging
mlflow.sklearn.autolog(log_models=True)

# prepare training data
X = np.array([[1, 1], [1, 2], [2, 2], [2, 3]])
y = np.dot(X, np.array([1, 2])) + 3

# train a model
model = LinearRegression()
with mlflow.start_run() as run:
    model.fit(X, y)
    print("Logged data and model in run {}".format(run.info.run_id))

model_uri = get_artifact_uri(run.info.run_id, 'model')

pymodel = mlflow.pyfunc.load_model(model_uri)
print('uuid=' + pymodel.metadata.model_uuid)

How is this patch tested?

Unit test.

Does this PR change the documentation?

  • No. You can skip the rest of this section.
  • Yes. Make sure the changed pages / sections render correctly by following the steps below.
  1. Check the status of the ci/circleci: build_doc check. If it's successful, proceed to the
    next step, otherwise fix it.
  2. Click Details on the right to open the job page of CircleCI.
  3. Click the Artifacts tab.
  4. Click docs/build/html/index.html.
  5. Find the changed pages / sections and make sure they render correctly.

Release Notes

Is this a user-facing change?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release notes for MLflow users.

Log model uuid when logging model. The uuid is randomly generated when logging model.

What component(s), interfaces, languages, and integrations does this PR affect?

Components

  • area/artifacts: Artifact stores and artifact logging
  • area/build: Build and test infrastructure for MLflow
  • 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/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

Interface

  • 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

Language

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

Integrations

  • integrations/azure: Azure and Azure ML integrations
  • integrations/sagemaker: SageMaker integrations
  • integrations/databricks: Databricks integrations

How should the PR be classified in the release notes? Choose one:

  • rn/breaking-change - The PR will be mentioned in the "Breaking Changes" section
  • rn/none - No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" section
  • rn/feature - A new user-facing feature worth mentioning in the release notes
  • rn/bug-fix - A user-facing bug fix worth mentioning in the release notes
  • rn/documentation - A user-facing documentation change worth mentioning in the release notes

@WeichenXu123 WeichenXu123 marked this pull request as draft December 7, 2021 14:59
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Comment thread mlflow/models/model.py Outdated
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
@github-actions github-actions Bot added rn/feature Mention under Features in Changelogs. area/tracking Tracking service, tracking client APIs, autologging labels Dec 8, 2021
@WeichenXu123 WeichenXu123 marked this pull request as ready for review December 8, 2021 14:18

@dbczumar dbczumar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @WeichenXu123 !

Comment thread tests/pyfunc/test_model_export_with_loader_module_and_data_path.py Outdated
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Comment thread tests/pyfunc/test_model_export_with_loader_module_and_data_path.py Outdated
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Comment thread tests/tracking/test_rest_tracking.py
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>

@harupy harupy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@WeichenXu123 WeichenXu123 merged commit 11cade0 into mlflow:master Dec 13, 2021
@harupy harupy mentioned this pull request Dec 15, 2021
29 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/tracking Tracking service, tracking client APIs, autologging rn/feature Mention under Features in Changelogs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants