code: def autolog(
      log_every_n_epoch=1,
      log_every_n_step=None,
      log_models=True,
      log_datasets=True,
      disable=False,
      exclusive=False,
      disable_for_unsupported_versions=False,
      silent=False,
      registered_model_name=None,
      extra_tags=None,
  ):  # pylint: disable=unused-argument
      """
      Enables (or disables) and configures autologging from `PyTorch Lightning
      <https://pytorch-lightning.readthedocs.io/en/latest>`_ to MLflow.
  
      Autologging is performed when you call the `fit` method of
      `pytorch_lightning.Trainer() \
      <https://pytorch-lightning.readthedocs.io/en/latest/trainer.html#>`_.
  
      Explore the complete `PyTorch MNIST \
      <https://github.com/mlflow/mlflow/tree/master/examples/pytorch/MNIST>`_ for
      an expansive example with implementation of additional lightening steps.
  
      **Note**: Full autologging is only supported for PyTorch Lightning models,
      i.e., models that subclass
      `pytorch_lightning.LightningModule \
      <https://pytorch-lightning.readthedocs.io/en/latest/lightning_module.html>`_.
      Autologging support for vanilla PyTorch (ie models that only subclass
      `torch.nn.Module <https://pytorch.org/docs/stable/generated/torch.nn.Module.html>`_)
      only autologs calls to
      `torch.utils.tensorboard.SummaryWriter <https://pytorch.org/docs/stable/tensorboard.html>`_'s
      ``add_scalar`` and ``add_hparams`` methods to mlflow. In this case, there's also
      no notion of an "epoch".
  
      .. Note:: Only pytorch-lightning modules between versions MIN_REQ_VERSION and
          MAX_REQ_VERSION are known to be compatible with mlflow's autologging.
  
      :param log_every_n_epoch: If specified, logs metrics once every `n` epochs. By default, metrics
          are logged after every epoch.
      :param log_every_n_step: If specified, logs batch metrics once every `n` training step.
          By default, metrics are not logged for steps. Note that setting this to 1 can cause
          performance issues and is not recommended. Metrics are logged against Lightning's global
          step number, and when multiple optimizers are used it is assumed that all optimizers
          are stepped in each training step.
      :param log_models: If ``True``, trained models are logged as MLflow model artifacts.
          If ``False``, trained models are not logged.
      :param log_datasets: If ``True``, dataset information is logged to MLflow Tracking.
          If ``False``, dataset information is not logged.
      :param disable: If ``True``, disables the PyTorch Lightning autologging integration.
          If ``False``, enables the PyTorch Lightning autologging integration.
      :param exclusive: If ``True``, autologged content is not logged to user-created fluent runs.
          If ``False``, autologged content is logged to the active fluent run, which may be
          user-created.
      :param disable_for_unsupported_versions: If ``True``, disable autologging for versions of
          pytorch and pytorch-lightning that have not been tested against this version
          of the MLflow client or are incompatible.
      :param silent: If ``True``, suppress all event logs and warnings from MLflow during PyTorch
          Lightning autologging. If ``False``, show all events and warnings during PyTorch Lightning
          autologging.
      :param registered_model_name: If given, each time a model is trained, it is registered as a
          new model version of the registered model with this name. The registered model is created if
          it does not already exist.
      :param extra_tags: A dictionary of extra tags to set on each managed run created by autologging.
  
      .. testcode:: python
          :caption: Example
  
          import os
  
          import lightning as L
          import torch
          from torch.nn import functional as F
          from torch.utils.data import DataLoader, Subset
          from torchmetrics import Accuracy
          from torchvision import transforms
          from torchvision.datasets import MNIST
  
          import mlflow.pytorch
          from mlflow import MlflowClient
  
  
          class MNISTModel(L.LightningModule):
              def __init__(self):
                  super().__init__()
                  self.l1 = torch.nn.Linear(28 * 28, 10)
                  self.accuracy = Accuracy("multiclass", num_classes=10)
  
              def forward(self, x):
                  return torch.relu(self.l1(x.view(x.size(0), -1)))
  
              def training_step(self, batch, batch_nb):
                  x, y = batch
                  logits = self(x)
                  loss = F.cross_entropy(logits, y)
                  pred = logits.argmax(dim=1)
                  acc = self.accuracy(pred, y)
  
                  # PyTorch `self.log` will be automatically captured by MLflow.
                  self.log("train_loss", loss, on_epoch=True)
                  self.log("acc", acc, on_epoch=True)
                  return loss
  
              def configure_optimizers(self):
                  return torch.optim.Adam(self.parameters(), lr=0.02)
  
  
          def print_auto_logged_info(r):
              tags = {k: v for k, v in r.data.tags.items() if not k.startswith("mlflow.")}
              artifacts = [f.path for f in MlflowClient().list_artifacts(r.info.run_id, "model")]
              print(f"run_id: {r.info.run_id}")
              print(f"artifacts: {artifacts}")
              print(f"params: {r.data.params}")
              print(f"metrics: {r.data.metrics}")
              print(f"tags: {tags}")
  
  
          # Initialize our model.
          mnist_model = MNISTModel()
  
          # Load MNIST dataset.
          train_ds = MNIST(
              os.getcwd(), train=True, download=True, transform=transforms.ToTensor()
          )
          # Only take a subset of the data for faster training.
          indices = torch.arange(32)
          train_ds = Subset(train_ds, indices)
          train_loader = DataLoader(train_ds, batch_size=8)
  
          # Initialize a trainer.
          trainer = L.Trainer(max_epochs=3)
  
          # Auto log all MLflow entities
          mlflow.pytorch.autolog()
  
          # Train the model.
          with mlflow.start_run() as run:
              trainer.fit(mnist_model, train_loader)
  
          # Fetch the auto logged parameters and metrics.
          print_auto_logged_info(mlflow.get_run(run_id=run.info.run_id))
      """
      try:
          import pytorch_lightning as pl
      except ImportError:
          pass
      else:
          from mlflow.pytorch._lightning_autolog import patched_fit
  
          safe_patch(
              FLAVOR_NAME,
              pl.Trainer,
              "fit",
              patched_fit,
              manage_run=True,
              extra_tags=extra_tags,
          )
  
      try:
          import lightning as L
      except ImportError:
          pass
      else:
          from mlflow.pytorch._lightning_autolog import patched_fit
  
          safe_patch(
              FLAVOR_NAME,
              L.Trainer,
              "fit",
              patched_fit,
              manage_run=True,
              extra_tags=extra_tags,
          )
  
      try:
          import torch.utils.tensorboard.writer
      except ImportError:
          pass
      else:
          from mlflow.pytorch._pytorch_autolog import (
              flush_metrics_queue,
              patched_add_event,
              patched_add_hparams,
              patched_add_summary,
          )
  
          safe_patch(
              FLAVOR_NAME,
              torch.utils.tensorboard.writer.FileWriter,
              "add_event",
              partial(
                  patched_add_event,
                  mlflow_log_every_n_step=log_every_n_step,
              ),
              manage_run=True,
              extra_tags=extra_tags,
          )
          safe_patch(
              FLAVOR_NAME,
              torch.utils.tensorboard.writer.FileWriter,
              "add_summary",
              patched_add_summary,
              manage_run=True,
              extra_tags=extra_tags,
          )
          safe_patch(
              FLAVOR_NAME,
              torch.utils.tensorboard.SummaryWriter,
              "add_hparams",
              patched_add_hparams,
              manage_run=True,
              extra_tags=extra_tags,
          )
  
          atexit.register(flush_metrics_queue)
  
imports: import atexit
  import importlib
  import logging
  import os
  import posixpath
  import shutil
  import warnings
  from functools import partial
  from typing import Any, Dict, Optional
  import numpy
  import pandas
  import yaml
  from packaging.version import Version
  import mlflow
  from mlflow import pyfunc
  from mlflow.environment_variables import MLFLOW_DEFAULT_PREDICTION_DEVICE
  from mlflow.exceptions import MlflowException
  from mlflow.ml_package_versions import _ML_PACKAGE_VERSIONS
  from mlflow.models import Model, ModelSignature
  from mlflow.models.model import MLMODEL_FILE_NAME
  from mlflow.models.signature import _infer_signature_from_input_example
  from mlflow.models.utils import ModelInputExample, _save_example
  from mlflow.protos.databricks_pb2 import RESOURCE_DOES_NOT_EXIST
  from mlflow.pytorch import pickle_module
  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, 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 TempDir, 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 11 for calling a global function with example usage: autolog(log_every_n_epoch, log_every_n_step, log_models, log_datasets, disable, exclusive, disable_for_unsupported_versions, silent, registered_model_name, extra_tags) without return types