class_docstr: A simple wrapper class to use HugginFace Datasets and convert them
  to AvalancheDatasets
class_docstr_tok: ["A","simple","wrapper","class","to","use","HugginFace","Datasets","and","convert","them","to","AvalancheDatasets"]
docstr: Applies a preprocessing function to the wrapped Hugging Face Datasets.
  
  Args:
  - preproc_func: A preprocessing function that will be applied to the
      dataset. See H.F. library documentation for details.
  - batched: A boolean indicating whether the preprocessing function
      should be applied to the dataset in batches.
  - columns_to_keep: A list of column names to keep in the dataset
      after the preprocessing function has been applied. If set to an
      empty list (default), ONLY columns added by the preproc_func will
      be kept.
  
  Returns:
  None
docstr_tok: ["Applies","a","preprocessing","function","to","the","wrapped","Hugging","Face","Datasets",".","Args",":","-","preproc_func",":","A","preprocessing","function","that","will","be","applied","to","the","dataset",".","See","H.F.","library","documentation","for","details",".","-","batched",":","A","boolean","indicating","whether","the","preprocessing","function","should","be","applied","to","the","dataset","in","batches",".","-","columns_to_keep",":","A","list","of","column","names","to","keep","in","the","dataset","after","the","preprocessing","function","has","been","applied",".","If","set","to","an","empty","list","(","default",")",",","ONLY","columns","added","by","the","preproc_func","will","be","kept",".","Returns",":","None"]
code: def map_preprocess_func(
      self, preproc_func, batched, columns_to_keep=[]
  ):
      """
      Applies a preprocessing function to the wrapped Hugging Face Datasets.
  
      Args:
      - preproc_func: A preprocessing function that will be applied to the
          dataset. See H.F. library documentation for details.
      - batched: A boolean indicating whether the preprocessing function
          should be applied to the dataset in batches.
      - columns_to_keep: A list of column names to keep in the dataset
          after the preprocessing function has been applied. If set to an
          empty list (default), ONLY columns added by the preproc_func will
          be kept.
  
      Returns:
      None
      """
  
      if len(columns_to_keep) == 0:
          old_f = self._all_features()
          self.dataset = self.dataset.map(preproc_func, batched=batched)
          new_f = self._all_features() - old_f
          print(
              f"The following columns are removed from dataset: {old_f}"
          )
          self.dataset = self.dataset.remove_columns(list(old_f))
          print(f"Kept columns: {new_f - old_f}")
          print(
              "If the resulting dataset has 0 columns left. Please ensure"
              "that the preprocessing phase saves the modified features in"
              "new columns or pass a list of column names"
          )
      else:
          old_f = self._all_features()
          self.dataset = self.dataset.map(preproc_func, batched=batched)
          to_remove = old_f - columns_to_keep
          self.dataset = self.dataset.remove_columns(list(to_remove))
          print(
              f"The following columns have been removed"
              "from dataset: {to_remove}"
          )
      print("Dataset features: ", self.dataset.features.keys())
  
imports: import datasets
  import numpy
  import torch
  import torch.nn
  from transformers import AutoTokenizer, DataCollatorForSeq2Seq, T5ForConditionalGeneration
  import avalanche
  import avalanche.training.templates.base
  from avalanche.benchmarks import CLExperience, CLScenario, CLStream
  from avalanche.benchmarks.utils import AvalancheDataset, ConstantSequence, DataAttribute
  from avalanche.benchmarks.utils.data import AvalancheDataset
  from avalanche.benchmarks.utils.data_attribute import DataAttribute
  from avalanche.benchmarks.utils.flat_data import ConstantSequence
  from avalanche.training.plugins import ReplayPlugin
label_desc: Use image node_id 4 for calling the HFTextDataWrapper obj's underlying member method code with example usage: obj.map_preprocess_func(preproc_func, batched, columns_to_keep) without return types