class_docstr: Data collator that will dynamically pad the inputs received.
  
  Args:
      processor (:class:`~transformers.Wav2Vec2Processor`)
          The processor used for proccessing the data.
      padding (:obj:`bool`, :obj:`str` or :class:`~transformers.tokenization_utils_base.PaddingStrategy`,
          `optional`, defaults to :obj:`True`):
          Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
          among:
          * :obj:`True` or :obj:`'longest'`: Pad to the longest sequence in the batch (or no padding if only a single
            sequence if provided).
          * :obj:`'max_length'`: Pad to a maximum length specified with the argument :obj:`max_length` or to the
            maximum acceptable input length for the model if that argument is not provided.
          * :obj:`False` or :obj:`'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of
            different lengths).
      max_length (:obj:`int`, `optional`):
          Maximum length of the ``input_values`` of the returned list and optionally padding length (see above).
      max_length_labels (:obj:`int`, `optional`):
          Maximum length of the ``labels`` returned list and optionally padding length (see above).
      pad_to_multiple_of (:obj:`int`, `optional`):
          If set will pad the sequence to a multiple of the provided value.
          This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability >=
          7.5 (Volta).
class_docstr_tok: ["Data","collator","that","will","dynamically","pad","the","inputs","received",".","Args",":","processor","(",":","class",":","`","~transformers.Wav2Vec2Processor","`",")","The","processor","used","for","proccessing","the","data",".","padding","(",":","obj",":","`","bool","`",",",":","obj",":","`","str","`","or",":","class",":","`","~transformers.tokenization_utils_base.PaddingStrategy","`",",","`","optional","`",",","defaults","to",":","obj",":","`","True","`",")",":","Select","a","strategy","to","pad","the","returned","sequences","(","according","to","the","model","'s","padding","side","and","padding","index",")","among",":","*",":","obj",":","`","True","`","or",":","obj",":","`","'longest","'","`",":","Pad","to","the","longest","sequence","in","the","batch","(","or","no","padding","if","only","a","single","sequence","if","provided",")",".","*",":","obj",":","`","'max_length","'","`",":","Pad","to","a","maximum","length","specified","with","the","argument",":","obj",":","`","max_length","`","or","to","the","maximum","acceptable","input","length","for","the","model","if","that","argument","is","not","provided",".","*",":","obj",":","`","False","`","or",":","obj",":","`","'do_not_pad","'","`","(","default",")",":","No","padding","(","i.e.",",","can","output","a","batch","with","sequences","of","different","lengths",")",".","max_length","(",":","obj",":","`","int","`",",","`","optional","`",")",":","Maximum","length","of","the","``","input_values","``","of","the","returned","list","and","optionally","padding","length","(","see","above",")",".","max_length_labels","(",":","obj",":","`","int","`",",","`","optional","`",")",":","Maximum","length","of","the","``","labels","``","returned","list","and","optionally","padding","length","(","see","above",")",".","pad_to_multiple_of","(",":","obj",":","`","int","`",",","`","optional","`",")",":","If","set","will","pad","the","sequence","to","a","multiple","of","the","provided","value",".","This","is","especially","useful","to","enable","the","use","of","Tensor","Cores","on","NVIDIA","hardware","with","compute","capability",">","=","7.5","(","Volta",")","."]
code: def __call__(
      self, samples: List[Dict[str, Any]]
  ) -> Dict[str, Tensor]:
      inputs = [sample[DataKeys.INPUT] for sample in samples]
      sampling_rates = [
          sample[DataKeys.METADATA]["sampling_rate"]
          for sample in samples
      ]
  
      assert (
          len(set(sampling_rates)) == 1
      ), f"Make sure all inputs have the same sampling rate of {self.processor.feature_extractor.sampling_rate}."
  
      inputs = self.processor(
          inputs, sampling_rate=sampling_rates[0]
      ).input_values
  
      # split inputs and labels since they have to be of different lengths and need
      # different padding methods
      input_features = [{"input_values": input} for input in inputs]
  
      batch = self.processor.pad(
          input_features,
          padding=self.padding,
          max_length=self.max_length,
          pad_to_multiple_of=self.pad_to_multiple_of,
          return_tensors="pt",
      )
  
      labels = [sample.get(DataKeys.TARGET, None) for sample in samples]
      # check to ensure labels exist to collate
      if None not in labels:
          with self.processor.as_target_processor():
              label_features = self.processor(labels).input_ids
              label_features = [
                  {"input_ids": feature} for feature in label_features
              ]
              labels_batch = self.processor.pad(
                  label_features,
                  padding=self.padding,
                  max_length=self.max_length_labels,
                  pad_to_multiple_of=self.pad_to_multiple_of_labels,
                  return_tensors="pt",
              )
  
          # replace padding with -100 to ignore loss correctly
          batch["labels"] = labels_batch["input_ids"].masked_fill(
              labels_batch.attention_mask.ne(1), -100
          )
  
      return batch
  
imports: from dataclasses import dataclass
  from typing import Any, Dict, List, Optional, Union
  from torch import Tensor
  from flash.core.data.io.input import DataKeys
  from flash.core.utilities.imports import _TOPIC_AUDIO_AVAILABLE
label_desc: Use image node_id 1 for calling the DataCollatorCTCWithPadding obj's underlying member method code with example usage: obj.__call__(samples) and returns: batch