class_docstr: Base Anomalib data module.
  
  Args:
      train_batch_size (int): Batch size used by the train dataloader.
      test_batch_size (int): Batch size used by the val and test dataloaders.
      num_workers (int): Number of workers used by the train, val and test dataloaders.
      test_split_mode (Optional[TestSplitMode], optional): Determines how the test split is obtained.
          Options: [none, from_dir, synthetic]
      test_split_ratio (float): Fraction of the train images held out for testing.
      val_split_mode (ValSplitMode): Determines how the validation split is obtained. Options: [none, same_as_test,
          from_test, synthetic]
      val_split_ratio (float): Fraction of the train or test images held our for validation.
      seed (int | None, optional): Seed used during random subset splitting.
class_docstr_tok: ["Base","Anomalib","data","module",".","Args",":","train_batch_size","(","int",")",":","Batch","size","used","by","the","train","dataloader",".","test_batch_size","(","int",")",":","Batch","size","used","by","the","val","and","test","dataloaders",".","num_workers","(","int",")",":","Number","of","workers","used","by","the","train",",","val","and","test","dataloaders",".","test_split_mode","(","Optional","[","TestSplitMode","]",",","optional",")",":","Determines","how","the","test","split","is","obtained",".","Options",":","[","none",",","from_dir",",","synthetic","]","test_split_ratio","(","float",")",":","Fraction","of","the","train","images","held","out","for","testing",".","val_split_mode","(","ValSplitMode",")",":","Determines","how","the","validation","split","is","obtained",".","Options",":","[","none",",","same_as_test",",","from_test",",","synthetic","]","val_split_ratio","(","float",")",":","Fraction","of","the","train","or","test","images","held","our","for","validation",".","seed","(","int","|","None",",","optional",")",":","Seed","used","during","random","subset","splitting","."]
docstr: Set up the datasets and perform dynamic subset splitting.
  
  This method may be overridden in subclass for custom splitting behaviour.
  
  Note: The stage argument is not used here. This is because, for a given instance of an AnomalibDataModule
  subclass, all three subsets are created at the first call of setup(). This is to accommodate the subset
  splitting behaviour of anomaly tasks, where the validation set is usually extracted from the test set, and
  the test set must therefore be created as early as the `fit` stage.
docstr_tok: ["Set","up","the","datasets","and","perform","dynamic","subset","splitting",".","This","method","may","be","overridden","in","subclass","for","custom","splitting","behaviour",".","Note",":","The","stage","argument","is","not","used","here",".","This","is","because",",","for","a","given","instance","of","an","AnomalibDataModule","subclass",",","all","three","subsets","are","created","at","the","first","call","of","setup","(",")",".","This","is","to","accommodate","the","subset","splitting","behaviour","of","anomaly","tasks",",","where","the","validation","set","is","usually","extracted","from","the","test","set",",","and","the","test","set","must","therefore","be","created","as","early","as","the","`","fit","`","stage","."]
code: def _setup(self, _stage: str | None = None) -> None:
      """Set up the datasets and perform dynamic subset splitting.
  
      This method may be overridden in subclass for custom splitting behaviour.
  
      Note: The stage argument is not used here. This is because, for a given instance of an AnomalibDataModule
      subclass, all three subsets are created at the first call of setup(). This is to accommodate the subset
      splitting behaviour of anomaly tasks, where the validation set is usually extracted from the test set, and
      the test set must therefore be created as early as the `fit` stage.
      """
      assert self.train_data is not None
      assert self.test_data is not None
  
      self.train_data.setup()
      self.test_data.setup()
  
      self._create_test_split()
      self._create_val_split()
  
imports: from __future__ import annotations
  import logging
  from abc import ABC
  from typing import Any
  from pandas import DataFrame
  from pytorch_lightning import LightningDataModule
  from pytorch_lightning.utilities.types import EVAL_DATALOADERS, TRAIN_DATALOADERS
  from torch.utils.data.dataloader import DataLoader, default_collate
  from anomalib.data.base.dataset import AnomalibDataset
  from anomalib.data.synthetic import SyntheticAnomalyDataset
  from anomalib.data.utils import TestSplitMode, ValSplitMode, random_split, split_by_label
label_desc: Use image node_id 3 for calling the AnomalibDataModule obj's underlying member method code with example usage: obj._setup(_stage) without return types