class_docstr: Data collator that will dynamically pad the inputs received and prepare masked indices
  for self-supervised pretraining.
  
  Args:
      model (:class:`~transformers.Wav2Vec2ForPreTraining`):
          The Wav2Vec2 model used for pretraining. The data collator needs to have access
          to config and ``_get_feat_extract_output_lengths`` function for correct padding.
      feature_extractor (:class:`~transformers.Wav2Vec2FeatureExtractor`):
          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).
      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","and","prepare","masked","indices","for","self-supervised","pretraining",".","Args",":","model","(",":","class",":","`","~transformers.Wav2Vec2ForPreTraining","`",")",":","The","Wav2Vec2","model","used","for","pretraining",".","The","data","collator","needs","to","have","access","to","config","and","``","_get_feat_extract_output_lengths","``","function","for","correct","padding",".","feature_extractor","(",":","class",":","`","~transformers.Wav2Vec2FeatureExtractor","`",")",":","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",")",".","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, features: List[Dict[str, Union[List[int], torch.Tensor]]]
  ) -> Dict[str, torch.Tensor]:
      # reformat list to dict and set to pytorch format
      batch = self.feature_extractor.pad(
          features,
          padding=self.padding,
          pad_to_multiple_of=self.pad_to_multiple_of,
          return_tensors="pt",
      )
  
      device = batch["input_values"].device
      batch_size = batch["input_values"].shape[0]
  
      mask_indices_seq_length = (
          self.model._get_feat_extract_output_lengths(
              batch["input_values"].shape[-1]
          )
      )
      # make sure masked sequence length is a Python scalar
      mask_indices_seq_length = int(mask_indices_seq_length)
  
      # make sure that no loss is computed on padded inputs
      if batch.get("attention_mask") is not None:
          # compute real output lengths according to convolution formula
          batch[
              "sub_attention_mask"
          ] = self.model._get_feature_vector_attention_mask(
              mask_indices_seq_length, batch["attention_mask"]
          )
  
      features_shape = (batch_size, mask_indices_seq_length)
  
      # sample randomly masked indices
      mask_time_indices = _compute_mask_indices(
          features_shape,
          self.model.config.mask_time_prob,
          self.model.config.mask_time_length,
          attention_mask=batch.get("sub_attention_mask"),
      )
  
      # sample negative indices
      sampled_negative_indices = _sample_negative_indices(
          features_shape,
          self.model.config.num_negatives,
          mask_time_indices=mask_time_indices,
      )
      batch["mask_time_indices"] = torch.tensor(
          mask_time_indices, dtype=torch.long, device=device
      )
      batch["sampled_negative_indices"] = torch.tensor(
          sampled_negative_indices, dtype=torch.long, device=device
      )
  
      return batch
  
imports: import argparse
  import math
  import os
  from dataclasses import dataclass
  from pathlib import Path
  from typing import Dict, List, Optional, Union
  import datasets
  import torch
  from datasets import DatasetDict, concatenate_datasets, load_dataset
  from torch.utils.data.dataloader import DataLoader
  from tqdm.auto import tqdm
  import transformers
  from accelerate import Accelerator
  from accelerate.logging import get_logger
  from huggingface_hub import Repository
  from transformers import AdamW, SchedulerType, Wav2Vec2Config, Wav2Vec2FeatureExtractor, Wav2Vec2ForPreTraining, get_scheduler, is_wandb_available, set_seed
  from transformers.models.wav2vec2.modeling_wav2vec2 import _compute_mask_indices, _sample_negative_indices
  from transformers.utils import get_full_repo_name, send_example_telemetry
label_desc: Use image node_id 1 for calling the DataCollatorForWav2Vec2Pretraining obj's underlying member method code with example usage: obj.__call__(features) and returns: batch