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

Log model uuid #5149

Merged
merged 8 commits into from Dec 13, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions mlflow/models/model.py
Expand Up @@ -4,6 +4,7 @@

import yaml
import os
import uuid

from typing import Any, Dict, Optional

Expand Down Expand Up @@ -41,6 +42,7 @@ def __init__(
flavors=None,
signature=None, # ModelSignature
saved_input_example_info: Dict[str, Any] = None,
model_uuid=None,
**kwargs,
):
# store model id instead of run_id and path to avoid confusion when model gets exported
Expand All @@ -52,6 +54,10 @@ def __init__(
self.flavors = flavors if flavors is not None else {}
self.signature = signature
self.saved_input_example_info = saved_input_example_info
if model_uuid is None:
self.model_uuid = str(uuid.uuid4())
else:
self.model_uuid = model_uuid
WeichenXu123 marked this conversation as resolved.
Show resolved Hide resolved
self.__dict__.update(kwargs)

def __eq__(self, other):
Expand Down Expand Up @@ -98,6 +104,8 @@ def to_dict(self):
res["signature"] = self.signature.to_dict()
if self.saved_input_example_info is not None:
res["saved_input_example_info"] = self.saved_input_example_info

res["model_uuid"] = self.model_uuid
return res

def to_yaml(self, stream=None):
Expand Down