Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
  • Loading branch information
WeichenXu123 committed Dec 7, 2021
1 parent c630d6d commit bba6d7a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 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,8 @@ def __init__(
self.flavors = flavors if flavors is not None else {}
self.signature = signature
self.saved_input_example_info = saved_input_example_info
if self.model_uuid is None:
self.model_uuid = uuid.uuid4()
self.__dict__.update(kwargs)

def __eq__(self, other):
Expand Down Expand Up @@ -98,6 +102,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

0 comments on commit bba6d7a

Please sign in to comment.