docstr: The `ActiveLearning Loop` describes the following training procedure. This loop is connected with the
  `ActiveLearningTrainer`
  
  Example::
  
      while unlabelled data or budget criteria not reached:
  
          if labelled data
              trainer.fit(model, labelled data)
  
          if unlabelled data:
              predictions = trainer.predict(model, unlabelled data)
              uncertainties = heuristic(predictions)
              request labellelisation for the sample with highest uncertainties under a given budget
  
  Args:
      label_epoch_frequency: Number of epoch to train on before requesting labellisation.
      inference_iteration: Number of inference to perform to compute uncertainty.
code: def __init__(
      self,
      label_epoch_frequency: int,
      inference_iteration: int = 2,
      should_reset_weights: bool = True,
  ):
      """The `ActiveLearning Loop` describes the following training procedure. This loop is connected with the
      `ActiveLearningTrainer`
  
      Example::
  
          while unlabelled data or budget criteria not reached:
  
              if labelled data
                  trainer.fit(model, labelled data)
  
              if unlabelled data:
                  predictions = trainer.predict(model, unlabelled data)
                  uncertainties = heuristic(predictions)
                  request labellelisation for the sample with highest uncertainties under a given budget
  
      Args:
          label_epoch_frequency: Number of epoch to train on before requesting labellisation.
          inference_iteration: Number of inference to perform to compute uncertainty.
  
      """
      super().__init__()
      self.label_epoch_frequency = label_epoch_frequency
      self.inference_iteration = inference_iteration
      self.should_reset_weights = should_reset_weights
      self.fit_loop: Optional[FitLoop] = None
      self.progress = Progress()
      self._model_state_dict: Optional[Dict[str, Tensor]] = None
      self._datamodule_state_dict: Optional[Dict[str, Any]] = None
      self._lightning_module: Optional[flash.Task] = None
  
imports: import contextlib
  from copy import deepcopy
  from typing import Any, Dict, Optional
  from pytorch_lightning import LightningModule
  from pytorch_lightning.loops import Loop
  from pytorch_lightning.loops.fit_loop import FitLoop
  from pytorch_lightning.trainer.connectors.data_connector import _DataLoaderSource
  from pytorch_lightning.trainer.progress import Progress
  from pytorch_lightning.trainer.states import TrainerFn, TrainerStatus
  from pytorch_lightning.utilities.model_helpers import is_overridden
  from torch import Tensor
  import flash
  from flash.core.data.utils import _STAGES_PREFIX
  from flash.core.utilities.imports import requires
  from flash.core.utilities.stability import beta
  from flash.core.utilities.stages import RunningStage
  from flash.image.classification.integrations.baal.data import ActiveLearningDataModule
  from flash.image.classification.integrations.baal.dropout import InferenceMCDropoutTask
label_desc: Use image node_id 1 to create a new ActiveLearningLoop object from inherited base classes: Loop with example: obj = ActiveLearningLoop(label_epoch_frequency, inference_iteration, should_reset_weights)