class_docstr: A dataloader used to load :class:`AvalancheDataset`s for which
  the FFCV support was previously enabled by using :func:`enable_ffcv`.
  
  This is not a pure wrapper of a FFCV loader: this hybrid dataloader
  is in charge of both creating the FFCV loader and merging
  the Avalanche-specific info contained in the :class:`DataAttribute`
  fields of the datasets (such as task labels).
class_docstr_tok: ["A","dataloader","used","to","load",":","class",":","`","AvalancheDataset","`","s","for","which","the","FFCV","support","was","previously","enabled","by","using",":","func",":","`","enable_ffcv","`",".","This","is","not","a","pure","wrapper","of","a","FFCV","loader",":","this","hybrid","dataloader","is","in","charge","of","both","creating","the","FFCV","loader","and","merging","the","Avalanche-specific","info","contained","in","the",":","class",":","`","DataAttribute","`","fields","of","the","datasets","(","such","as","task","labels",")","."]
docstr: Creates an instance of the Avalanche-FFCV hybrid dataloader.
  
  :param dataset: The dataset to be loaded.
  :param batch_sampler: The batch sampler to use.
  :param ffcv_loader_parameters: The FFCV-specific parameters to pass to
      the FFCV loader. Should not contain the elements such as `fname`,
      `batch_size`, `order`, and all the parameters listed in the
      `ALREADY_COVERED_PARAMS` class field, as they are already set by Avalanche.
  :param device: The target device.
  :param persistent_workers: If True, this loader will not re-create the FFCV loader
      between epochs. Defaults to False.
  :param print_ffcv_summary: If True, a summary of the decoder pipeline (and additional
      useful info) will be printed. Defaults to True.
  :param start_immediately: If True, the FFCV loader should be started immediately.
      Defaults to False.
docstr_tok: ["Creates","an","instance","of","the","Avalanche-FFCV","hybrid","dataloader",".",":","param","dataset",":","The","dataset","to","be","loaded",".",":","param","batch_sampler",":","The","batch","sampler","to","use",".",":","param","ffcv_loader_parameters",":","The","FFCV-specific","parameters","to","pass","to","the","FFCV","loader",".","Should","not","contain","the","elements","such","as","`","fname","`",",","`","batch_size","`",",","`","order","`",",","and","all","the","parameters","listed","in","the","`","ALREADY_COVERED_PARAMS","`","class","field",",","as","they","are","already","set","by","Avalanche",".",":","param","device",":","The","target","device",".",":","param","persistent_workers",":","If","True",",","this","loader","will","not","re-create","the","FFCV","loader","between","epochs",".","Defaults","to","False",".",":","param","print_ffcv_summary",":","If","True",",","a","summary","of","the","decoder","pipeline","(","and","additional","useful","info",")","will","be","printed",".","Defaults","to","True",".",":","param","start_immediately",":","If","True",",","the","FFCV","loader","should","be","started","immediately",".","Defaults","to","False","."]
code: def __init__(
      self,
      dataset: AvalancheDataset,
      batch_sampler: Iterable[List[int]],
      ffcv_loader_parameters: Dict[str, Any],
      device: Optional[Union[str, torch.device]] = None,
      persistent_workers: bool = False,
      print_ffcv_summary: bool = True,
      start_immediately: bool = False,
  ):
      """
      Creates an instance of the Avalanche-FFCV hybrid dataloader.
  
      :param dataset: The dataset to be loaded.
      :param batch_sampler: The batch sampler to use.
      :param ffcv_loader_parameters: The FFCV-specific parameters to pass to
          the FFCV loader. Should not contain the elements such as `fname`,
          `batch_size`, `order`, and all the parameters listed in the
          `ALREADY_COVERED_PARAMS` class field, as they are already set by Avalanche.
      :param device: The target device.
      :param persistent_workers: If True, this loader will not re-create the FFCV loader
          between epochs. Defaults to False.
      :param print_ffcv_summary: If True, a summary of the decoder pipeline (and additional
          useful info) will be printed. Defaults to True.
      :param start_immediately: If True, the FFCV loader should be started immediately.
          Defaults to False.
      """
      from avalanche.benchmarks.utils.ffcv_support.ffcv_loader import (
          _CustomLoader,
      )
  
      self.dataset: AvalancheDataset = dataset
      self.batch_sampler = batch_sampler
      self.ffcv_loader_parameters = ffcv_loader_parameters
      self.persistent_workers: bool = persistent_workers
  
      for param_name in HybridFfcvLoader.ALREADY_COVERED_PARAMS:
          if param_name in self.ffcv_loader_parameters:
              warnings.warn(
                  f"`{param_name}` should not be passed to the ffcv loader!"
              )
  
      if print_ffcv_summary:
          print("-" * 15, "HybridFfcvLoader summary", "-" * 15)
  
      ffcv_info = self._extract_ffcv_info(
          dataset=self.dataset,
          device=device,
          print_summary=print_ffcv_summary,
      )
  
      if print_ffcv_summary:
          print("-" * 56)
  
      (
          self.ffcv_dataset_path,
          self.ffcv_decoder_dictionary,
          self.leaf_indices,
          self.get_item_dataset,
          self.device,
      ) = ffcv_info
  
      self._persistent_loader: Optional["_CustomLoader"] = None
  
      if start_immediately:
          # If persistent_workers is False, this loader will be
          # used at first __iter__ and immediately set to None
          self._persistent_loader = self._make_loader()
  
imports: from dataclasses import dataclass
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Union
  from collections import OrderedDict
  import warnings
  import numpy
  import torch
  from torch.utils.data.sampler import Sampler
  from avalanche.benchmarks.scenarios.generic_scenario import CLScenario
  from avalanche.benchmarks.utils.data import AvalancheDataset
  from avalanche.benchmarks.utils.dataset_traversal_utils import flat_datasets_from_benchmark, single_flat_dataset
  from avalanche.benchmarks.utils.utils import concat_datasets
label_desc: Use image node_id 1 to create a new HybridFfcvLoader object  with example: obj = HybridFfcvLoader(dataset, batch_sampler, ffcv_loader_parameters, device, persistent_workers, print_ffcv_summary, start_immediately)