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: Log model using supplied flavor module. If no run is active, this method will create a new
  active run.
  
  :param artifact_path: Run relative path identifying the model.
  :param flavor: Flavor module to save the model with. The module must have
                 the ``save_model`` function that will persist the model as a valid
                 MLflow model.
  :param registered_model_name: If given, create a model version under
                                ``registered_model_name``, also creating a registered model if
                                one with the given name does not exist.
  :param signature: :py:class:`ModelSignature` describes model input
                    and output :py:class:`Schema <mlflow.types.Schema>`. The model signature
                    can be :py:func:`inferred <infer_signature>` from datasets representing
                    valid model input (e.g. the training dataset) and valid model output
                    (e.g. model predictions generated on the training dataset), for example:
  
                    .. code-block:: python
  
                      from mlflow.models import infer_signature
  
                      train = df.drop_column("target_label")
                      signature = infer_signature(train, model.predict(train))
  
  :param input_example: one or several instances of valid model input. The input example is
                      used as a hint of what data to feed the model. It will be converted to
                      a Pandas DataFrame and then serialized to json using the Pandas
                      split-oriented format, or a numpy array where the example will be
                      serialized to json by converting it to a list. If input example is a
                      tuple, then the first element must be a valid model input, and the
                      second element must be a valid params dictionary that can optionally
                      be used during model inference. Bytes are base64-encoded. When the
                      ``signature`` parameter is ``None``, the input example is used to infer
                      a model's signature. If an input example containing params is provided,
                      and signature is inferred from the input example, then params will be
                      used as default params during model inference if no extra params are
                      passed at inference time.
  
  :param await_registration_for: Number of seconds to wait for the model version to finish
                      being created and is in ``READY`` status. By default, the function
                      waits for five minutes. Specify 0 or None to skip waiting.
  
  :param metadata: Custom metadata dictionary passed to the model and stored in
                   the MLmodel file.
  
                   .. Note:: Experimental: This parameter may change or be removed in a
                                           future release without warning.
  
  :param kwargs: Extra args passed to the model flavor.
  
  :return: A :py:class:`ModelInfo <mlflow.models.model.ModelInfo>` instance that contains the
           metadata of the logged model.
docstr_tok: ["Log","model","using","supplied","flavor","module",".","If","no","run","is","active",",","this","method","will","create","a","new","active","run",".",":","param","artifact_path",":","Run","relative","path","identifying","the","model",".",":","param","flavor",":","Flavor","module","to","save","the","model","with",".","The","module","must","have","the","``","save_model","``","function","that","will","persist","the","model","as","a","valid","MLflow","model",".",":","param","registered_model_name",":","If","given",",","create","a","model","version","under","``","registered_model_name","``",",","also","creating","a","registered","model","if","one","with","the","given","name","does","not","exist",".",":","param","signature",":",":","py",":","class",":","`","ModelSignature","`","describes","model","input","and","output",":","py",":","class",":","`","Schema","<","mlflow.types.Schema",">","`",".","The","model","signature","can","be",":","py",":","func",":","`","inferred","<","infer_signature",">","`","from","datasets","representing","valid","model","input","(","e.g",".","the","training","dataset",")","and","valid","model","output","(","e.g",".","model","predictions","generated","on","the","training","dataset",")",",","for","example",":","..","code-block",":",":","python","from","mlflow.models","import","infer_signature","train","=","df.drop_column","(","``","target_label","''",")","signature","=","infer_signature","(","train",",","model.predict","(","train",")",")",":","param","input_example",":","one","or","several","instances","of","valid","model","input",".","The","input","example","is","used","as","a","hint","of","what","data","to","feed","the","model",".","It","will","be","converted","to","a","Pandas","DataFrame","and","then","serialized","to","json","using","the","Pandas","split-oriented","format",",","or","a","numpy","array","where","the","example","will","be","serialized","to","json","by","converting","it","to","a","list",".","If","input","example","is","a","tuple",",","then","the","first","element","must","be","a","valid","model","input",",","and","the","second","element","must","be","a","valid","params","dictionary","that","can","optionally","be","used","during","model","inference",".","Bytes","are","base64-encoded",".","When","the","``","signature","``","parameter","is","``","None","``",",","the","input","example","is","used","to","infer","a","model","'s","signature",".","If","an","input","example","containing","params","is","provided",",","and","signature","is","inferred","from","the","input","example",",","then","params","will","be","used","as","default","params","during","model","inference","if","no","extra","params","are","passed","at","inference","time",".",":","param","await_registration_for",":","Number","of","seconds","to","wait","for","the","model","version","to","finish","being","created","and","is","in","``","READY","``","status",".","By","default",",","the","function","waits","for","five","minutes",".","Specify","0","or","None","to","skip","waiting",".",":","param","metadata",":","Custom","metadata","dictionary","passed","to","the","model","and","stored","in","the","MLmodel","file",".","..","Note",":",":","Experimental",":","This","parameter","may","change","or","be","removed","in","a","future","release","without","warning",".",":","param","kwargs",":","Extra","args","passed","to","the","model","flavor",".",":","return",":","A",":","py",":","class",":","`","ModelInfo","<","mlflow.models.model.ModelInfo",">","`","instance","that","contains","the","metadata","of","the","logged","model","."]
code: def log(
      cls,
      artifact_path,
      flavor,
      registered_model_name=None,
      await_registration_for=DEFAULT_AWAIT_MAX_SLEEP_SECONDS,
      metadata=None,
      **kwargs,
  ):
      """
      Log model using supplied flavor module. If no run is active, this method will create a new
      active run.
  
      :param artifact_path: Run relative path identifying the model.
      :param flavor: Flavor module to save the model with. The module must have
                     the ``save_model`` function that will persist the model as a valid
                     MLflow model.
      :param registered_model_name: If given, create a model version under
                                    ``registered_model_name``, also creating a registered model if
                                    one with the given name does not exist.
      :param signature: :py:class:`ModelSignature` describes model input
                        and output :py:class:`Schema <mlflow.types.Schema>`. The model signature
                        can be :py:func:`inferred <infer_signature>` from datasets representing
                        valid model input (e.g. the training dataset) and valid model output
                        (e.g. model predictions generated on the training dataset), for example:
  
                        .. code-block:: python
  
                          from mlflow.models import infer_signature
  
                          train = df.drop_column("target_label")
                          signature = infer_signature(train, model.predict(train))
  
      :param input_example: one or several instances of valid model input. The input example is
                          used as a hint of what data to feed the model. It will be converted to
                          a Pandas DataFrame and then serialized to json using the Pandas
                          split-oriented format, or a numpy array where the example will be
                          serialized to json by converting it to a list. If input example is a
                          tuple, then the first element must be a valid model input, and the
                          second element must be a valid params dictionary that can optionally
                          be used during model inference. Bytes are base64-encoded. When the
                          ``signature`` parameter is ``None``, the input example is used to infer
                          a model's signature. If an input example containing params is provided,
                          and signature is inferred from the input example, then params will be
                          used as default params during model inference if no extra params are
                          passed at inference time.
  
      :param await_registration_for: Number of seconds to wait for the model version to finish
                          being created and is in ``READY`` status. By default, the function
                          waits for five minutes. Specify 0 or None to skip waiting.
  
      :param metadata: Custom metadata dictionary passed to the model and stored in
                       the MLmodel file.
  
                       .. Note:: Experimental: This parameter may change or be removed in a
                                               future release without warning.
  
      :param kwargs: Extra args passed to the model flavor.
  
      :return: A :py:class:`ModelInfo <mlflow.models.model.ModelInfo>` instance that contains the
               metadata of the logged model.
      """
      with TempDir() as tmp:
          local_path = tmp.path("model")
          run_id = (
              mlflow.tracking.fluent._get_or_start_run().info.run_id
          )
          mlflow_model = cls(
              artifact_path=artifact_path,
              run_id=run_id,
              metadata=metadata,
          )
          tracking_uri = _resolve_tracking_uri()
          if (
              (
                  tracking_uri == "databricks"
                  or get_uri_scheme(tracking_uri) == "databricks"
              )
              and kwargs.get("signature") is None
              and kwargs.get("input_example") is None
          ):
              _logger.warning(_LOG_MODEL_MISSING_SIGNATURE_WARNING)
          flavor.save_model(
              path=local_path, mlflow_model=mlflow_model, **kwargs
          )
          mlflow.tracking.fluent.log_artifacts(
              local_path, mlflow_model.artifact_path
          )
          try:
              mlflow.tracking.fluent._record_logged_model(mlflow_model)
          except MlflowException:
              # We need to swallow all mlflow exceptions to maintain backwards compatibility with
              # older tracking servers. Only print out a warning for now.
              _logger.warning(
                  _LOG_MODEL_METADATA_WARNING_TEMPLATE,
                  mlflow.get_artifact_uri(),
              )
              _logger.debug("", exc_info=True)
          if registered_model_name is not None:
              run_id = mlflow.tracking.fluent.active_run().info.run_id
              mlflow.tracking._model_registry.fluent._register_model(
                  f"runs:/{run_id}/{mlflow_model.artifact_path}",
                  registered_model_name,
                  await_registration_for=await_registration_for,
                  local_model_path=local_path,
              )
      return mlflow_model.get_model_info()
  
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 25 for calling the Model obj's underlying member method code with example usage: obj.log(cls, artifact_path, flavor, registered_model_name, await_registration_for, metadata) and returns: mlflow_model