class_docstr: An MLflow Model that can support multiple model flavors. Provides APIs for implementing
  new Model flavors.
class_docstr_tok: ["An","MLflow","Model","that","can","support","multiple","model","flavors",".","Provides","APIs","for","implementing","new","Model","flavors","."]
docstr: Custom metadata dictionary passed to the model and stored in the MLmodel file.
  
  :getter: Retrieves custom metadata that have been applied to a model instance.
  :setter: Sets a dictionary of custom keys and values to be included with the model instance
  :type: Optional[Dict[str, Any]]
  
  :return: A Dictionary of user-defined metadata iff defined.
  
  .. code-block:: python
      :caption: Example
  
      # Create and log a model with metadata to the Model Registry
  
      from sklearn import datasets
      from sklearn.ensemble import RandomForestClassifier
      import mlflow
      from mlflow.models import infer_signature
  
      with mlflow.start_run():
          iris = datasets.load_iris()
          clf = RandomForestClassifier()
          clf.fit(iris.data, iris.target)
          signature = infer_signature(iris.data, iris.target)
          mlflow.sklearn.log_model(
              clf,
              "iris_rf",
              signature=signature,
              registered_model_name="model-with-metadata",
              metadata={"metadata_key": "metadata_value"},
          )
  
      # model uri for the above model
      model_uri = "models:/model-with-metadata/1"
  
      # Load the model and access the custom metadata
      model = mlflow.pyfunc.load_model(model_uri=model_uri)
      assert model.metadata.metadata["metadata_key"] == "metadata_value"
docstr_tok: ["Custom","metadata","dictionary","passed","to","the","model","and","stored","in","the","MLmodel","file",".",":","getter",":","Retrieves","custom","metadata","that","have","been","applied","to","a","model","instance",".",":","setter",":","Sets","a","dictionary","of","custom","keys","and","values","to","be","included","with","the","model","instance",":","type",":","Optional","[","Dict","[","str",",","Any","]","]",":","return",":","A","Dictionary","of","user-defined","metadata","iff","defined",".","..","code-block",":",":","python",":","caption",":","Example","#","Create","and","log","a","model","with","metadata","to","the","Model","Registry","from","sklearn","import","datasets","from","sklearn.ensemble","import","RandomForestClassifier","import","mlflow","from","mlflow.models","import","infer_signature","with","mlflow.start_run","(",")",":","iris","=","datasets.load_iris","(",")","clf","=","RandomForestClassifier","(",")","clf.fit","(","iris.data",",","iris.target",")","signature","=","infer_signature","(","iris.data",",","iris.target",")","mlflow.sklearn.log_model","(","clf",",","``","iris_rf","''",",","signature=signature",",","registered_model_name=","''","model-with-metadata","''",",","metadata=","{","``","metadata_key","''",":","``","metadata_value","''","}",",",")","#","model","uri","for","the","above","model","model_uri","=","``","models",":","\/model-with-metadata\/1","''","#","Load","the","model","and","access","the","custom","metadata","model","=","mlflow.pyfunc.load_model","(","model_uri=model_uri",")","assert","model.metadata.metadata","[","``","metadata_key","''","]","==","``","metadata_value","''"]
code: def metadata(self) -> Optional[Dict[str, Any]]:
      """
      Custom metadata dictionary passed to the model and stored in the MLmodel file.
  
      :getter: Retrieves custom metadata that have been applied to a model instance.
      :setter: Sets a dictionary of custom keys and values to be included with the model instance
      :type: Optional[Dict[str, Any]]
  
      :return: A Dictionary of user-defined metadata iff defined.
  
      .. code-block:: python
          :caption: Example
  
          # Create and log a model with metadata to the Model Registry
  
          from sklearn import datasets
          from sklearn.ensemble import RandomForestClassifier
          import mlflow
          from mlflow.models import infer_signature
  
          with mlflow.start_run():
              iris = datasets.load_iris()
              clf = RandomForestClassifier()
              clf.fit(iris.data, iris.target)
              signature = infer_signature(iris.data, iris.target)
              mlflow.sklearn.log_model(
                  clf,
                  "iris_rf",
                  signature=signature,
                  registered_model_name="model-with-metadata",
                  metadata={"metadata_key": "metadata_value"},
              )
  
          # model uri for the above model
          model_uri = "models:/model-with-metadata/1"
  
          # Load the model and access the custom metadata
          model = mlflow.pyfunc.load_model(model_uri=model_uri)
          assert model.metadata.metadata["metadata_key"] == "metadata_value"
  
      """
      return self._metadata
  
imports: import json
  import logging
  import os
  import uuid
  import warnings
  from datetime import datetime
  from typing import Any, Callable, Dict, Optional, Union
  import yaml
  import mlflow
  from mlflow.artifacts import download_artifacts
  from mlflow.exceptions import MlflowException
  from mlflow.tracking._model_registry import DEFAULT_AWAIT_MAX_SLEEP_SECONDS
  from mlflow.tracking._tracking_service.utils import _resolve_tracking_uri
  from mlflow.utils.annotations import experimental
  from mlflow.utils.databricks_utils import get_databricks_runtime
  from mlflow.utils.file_utils import TempDir
  from mlflow.utils.uri import get_uri_scheme
label_desc: Use image node_id 9 for calling the Model obj's underlying member method code with example usage: obj.metadata() and returns: self