code: def log_model(
      fastai_learner,
      artifact_path,
      conda_env=None,
      code_paths=None,
      registered_model_name=None,
      signature: ModelSignature = None,
      input_example: ModelInputExample = None,
      await_registration_for=DEFAULT_AWAIT_MAX_SLEEP_SECONDS,
      pip_requirements=None,
      extra_pip_requirements=None,
      metadata=None,
      **kwargs,
  ):
      """Log a fastai model as an MLflow artifact for the current run.
  
      Args:
          fastai_learner: Fastai model (an instance of `fastai.Learner`_) to be saved.
          artifact_path: Run-relative artifact path.
          conda_env: {{ conda_env }}
          code_paths: A list of local filesystem paths to Python file dependencies (or directories
              containing file dependencies). These files are *prepended* to the system
              path when the model is loaded.
          registered_model_name: This argument may change or be removed in a
              future release without warning. If given, create a model
              version under ``registered_model_name``, also creating a
              registered model if one with the given name does not exist.
          signature: Describes model input and output Schema. The model signature can be inferred
              from datasets with valid model input (e.g. the training dataset with target
              column omitted) 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")
                predictions = ...  # compute model predictions
                signature = infer_signature(train, predictions)
  
          input_example: {{ input_example }}
          kwargs: kwargs to pass to `fastai.Learner.export`_ method.
          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.
          pip_requirements: {{ pip_requirements }}
          extra_pip_requirements: {{ extra_pip_requirements }}
          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.
  
      Returns:
          A ModelInfo instance that contains the metadata of the logged model.
  
      .. code-block:: python
          :caption: Example
  
          import fastai.vision as vis
          import mlflow.fastai
          from mlflow import MlflowClient
  
  
          def main(epochs=5, learning_rate=0.01):
              # Download and untar the MNIST data set
              path = vis.untar_data(vis.URLs.MNIST_SAMPLE)
              # Prepare, transform, and normalize the data
              data = vis.ImageDataBunch.from_folder(
                  path, ds_tfms=(vis.rand_pad(2, 28), []), bs=64
              )
              data.normalize(vis.imagenet_stats)
              # Create the CNN Learner model
              model = vis.cnn_learner(data, vis.models.resnet18, metrics=vis.accuracy)
              # Start MLflow session and log model
              with mlflow.start_run() as run:
                  model.fit(epochs, learning_rate)
                  mlflow.fastai.log_model(model, "model")
              # fetch the logged model artifacts
              artifacts = [
                  f.path for f in MlflowClient().list_artifacts(run.info.run_id, "model")
              ]
              print(f"artifacts: {artifacts}")
  
  
          main()
  
      .. code-block:: text
          :caption: Output
  
          artifacts: ['model/MLmodel', 'model/conda.yaml', 'model/model.fastai']
      """
      return Model.log(
          artifact_path=artifact_path,
          flavor=mlflow.fastai,
          registered_model_name=registered_model_name,
          fastai_learner=fastai_learner,
          conda_env=conda_env,
          code_paths=code_paths,
          signature=signature,
          input_example=input_example,
          await_registration_for=await_registration_for,
          pip_requirements=pip_requirements,
          extra_pip_requirements=extra_pip_requirements,
          metadata=metadata,
          **kwargs,
      )
  
imports: import logging
  import os
  import tempfile
  from pathlib import Path
  from typing import Any, Dict, Optional
  import numpy
  import pandas
  import yaml
  import mlflow.tracking
  from mlflow import pyfunc
  from mlflow.models import Model, ModelInputExample, ModelSignature
  from mlflow.models.model import MLMODEL_FILE_NAME
  from mlflow.models.utils import _save_example
  from mlflow.tracking._model_registry import DEFAULT_AWAIT_MAX_SLEEP_SECONDS
  from mlflow.tracking.artifact_utils import _download_artifact_from_uri
  from mlflow.utils.autologging_utils import autologging_integration, batch_metrics_logger, log_fn_args_as_params, safe_patch
  from mlflow.utils.docstring_utils import LOG_MODEL_PARAM_DOCS, format_docstring
  from mlflow.utils.environment import _CONDA_ENV_FILE_NAME, _CONSTRAINTS_FILE_NAME, _PYTHON_ENV_FILE_NAME, _REQUIREMENTS_FILE_NAME, _mlflow_conda_env, _process_conda_env, _process_pip_requirements, _PythonEnv, _validate_env_arguments
  from mlflow.utils.file_utils import get_total_file_size, write_to
  from mlflow.utils.model_utils import _add_code_from_conf_to_system_path, _get_flavor_configuration, _validate_and_copy_code_paths, _validate_and_prepare_target_save_path
  from mlflow.utils.requirements_utils import _get_pinned_requirement
label_desc: Use image node_id 4 for calling a global function with example usage: log_model(fastai_learner, artifact_path, conda_env, code_paths, registered_model_name, signature, input_example, await_registration_for, pip_requirements, extra_pip_requirements, metadata) and returns: Model