class_docstr: Base class for all adapter methods that support composition.
  
  Make sure the 'adapter_modules_name' and 'supported_compositions' attributes as well as all abstract methods are
  overriden in derived classes. 'allow_multi_parallelize' can be set to True to allow inputs to be parallelized
  independently multiple times. This is useful when there are multiple parallel input flows through an adapter layer
  (e.g. in LoRA).
class_docstr_tok: ["Base","class","for","all","adapter","methods","that","support","composition",".","Make","sure","the","'adapter_modules_name","'","and","'supported_compositions","'","attributes","as","well","as","all","abstract","methods","are","overriden","in","derived","classes",".","'allow_multi_parallelize","'","can","be","set","to","True","to","allow","inputs","to","be","parallelized","independently","multiple","times",".","This","is","useful","when","there","are","multiple","parallel","input","flows","through","an","adapter","layer","(","e.g",".","in","LoRA",")","."]
docstr: For splitting to multiple adapters along the batch size dimension.
docstr_tok: ["For","splitting","to","multiple","adapters","along","the","batch","size","dimension","."]
code: def compose_batch_split(
      self, adapter_setup: BatchSplit, state: NamedTuple, lvl: int = 0
  ):
      """
      For splitting to multiple adapters along the batch size dimension.
      """
      if sum(adapter_setup.batch_sizes) != self._bsz(state):
          raise IndexError(
              "The given batch has a size of {} which is not equal to the sum of batch_sizes {}".format(
                  self._bsz(state), adapter_setup.batch_sizes
              )
          )
  
      state = self.pre_block(adapter_setup, state)
  
      # sequentially feed different parts of the blown-up batch into different adapters
      children_states = []
      for i, child in enumerate(adapter_setup):
          # compute ids of sequences that should be passed to the ith adapter
          batch_idx = (
              sum(adapter_setup.batch_sizes[:i]),
              sum(adapter_setup.batch_sizes[: i + 1]),
          )
          if isinstance(child, AdapterCompositionBlock):
              self.check_composition_valid(adapter_setup, child, lvl)
              composition_func = self.composition_to_func_map[
                  type(child)
              ]
              child_state = composition_func(
                  child,
                  self.vslice(state, slice(*batch_idx)),
                  lvl=lvl + 1,
              )
              children_states.append(child_state)
          elif child in self.adapter_modules:
              child_state = self.compose_single(
                  child,
                  self.vslice(state, slice(*batch_idx)),
                  lvl=lvl + 1,
              )
              children_states.append(child_state)
          else:
              children_states.append(
                  self.vslice(state, slice(*batch_idx))
              )
  
      # concatenate all outputs and return
      state = self.pad_and_concat(children_states)
      return state
  
imports: from abc import ABCMeta, abstractmethod
  from typing import Collection, Dict, List, NamedTuple, Union
  import numpy
  import torch
  from torch import nn
  from ..composition import ALLOWED_NESTINGS, AdapterCompositionBlock, Average, BatchSplit, Fuse, Parallel, Split, Stack
  from ..context import AdapterSetup, ForwardContext
label_desc: Use image node_id 14 for calling the ComposableAdapterLayerBase obj's underlying member method code with example usage: obj.compose_batch_split(adapter_setup, state, lvl) and returns: state