class_docstr: The metadata of a logged MLflow Model.
class_docstr_tok: ["The","metadata","of","a","logged","MLflow","Model","."]
docstr: User defined metadata added to the model.
  
  :getter: Gets the user-defined metadata about a model
  :type: Optional[Dict[str, Any]]
  
  .. code-block:: python
      :caption: Example usage of Model Metadata
  
      # 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 from its ModelInfo object
      model = mlflow.pyfunc.load_model(model_uri=model_uri)
      assert model.metadata.get_model_info().metadata["metadata_key"] == "metadata_value"
  
      # Load the ModelInfo and access the custom metadata
      model_info = mlflow.models.get_model_info(model_uri=model_uri)
      assert model_info.metadata["metadata_key"] == "metadata_value"
docstr_tok: ["User","defined","metadata","added","to","the","model",".",":","getter",":","Gets","the","user-defined","metadata","about","a","model",":","type",":","Optional","[","Dict","[","str",",","Any","]","]","..","code-block",":",":","python",":","caption",":","Example","usage","of","Model","Metadata","#","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","from","its","ModelInfo","object","model","=","mlflow.pyfunc.load_model","(","model_uri=model_uri",")","assert","model.metadata.get_model_info","(",")",".metadata","[","``","metadata_key","''","]","==","``","metadata_value","''","#","Load","the","ModelInfo","and","access","the","custom","metadata","model_info","=","mlflow.models.get_model_info","(","model_uri=model_uri",")","assert","model_info.metadata","[","``","metadata_key","''","]","==","``","metadata_value","''"]
code: def metadata(self) -> Optional[Dict[str, Any]]:
      """
      User defined metadata added to the model.
  
      :getter: Gets the user-defined metadata about a model
      :type: Optional[Dict[str, Any]]
  
      .. code-block:: python
          :caption: Example usage of Model Metadata
  
          # 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 from its ModelInfo object
          model = mlflow.pyfunc.load_model(model_uri=model_uri)
          assert model.metadata.get_model_info().metadata["metadata_key"] == "metadata_value"
  
          # Load the ModelInfo and access the custom metadata
          model_info = mlflow.models.get_model_info(model_uri=model_uri)
          assert model_info.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 12 for calling the ModelInfo obj's underlying member method code with example usage: obj.metadata() and returns: self