class_docstr: Buketized BatchSampler for sequential data with different lengths to reduce number of paddings.
  
  Args:
      lengths (List[int]): The lengths of the samples in the dataset.
      num_buckets (int): The number of buckets to split the data samples.
      min_len (int, optional): The minimum sample lengths to keep.
          (Default: 0)
      max_len (int or None, optional): The maximum sample lengths to keep. Inferred if not provided.
          (Default ``None``)
      max_token_count (int or None, optional): The max number of tokens in one mini-batch.
          (Default: ``None``)
      batch_size (int or None, optional): The number of samples in one mini-batch.
          (Default: ``None``)
      shuffle (bool, optional): Whether to shuffle buckets for non-monotonic length sampling.
          (Default: True)
      seed (int, optional): The seed for initialzing RNG. Only used when `shuffle` is True. (Default: 0)
      drop_last (bool, optional): If ``True``, the sampler will drop the last batch if
          its size would be less than ``batch_size``
          (Default: False)
  
  Note:
      ``max_token_count`` and ``batch_size`` are mutually exclusive. Only one argument of the two
      should have value.
  
  Note:
      ``drop_last`` is only valid when ``batch_size`` argument is given.
  
  Note:
      if ``shuffle`` is True, it will only shuffle the data once. Please set ``reload_dataloaders_every_n_epochs=1``
      in pytorch_lightning Trainer and set ``seed`` to ``self.trainer.current_epoch`` to enable shuffling every epoch.
class_docstr_tok: ["Buketized","BatchSampler","for","sequential","data","with","different","lengths","to","reduce","number","of","paddings",".","Args",":","lengths","(","List","[","int","]",")",":","The","lengths","of","the","samples","in","the","dataset",".","num_buckets","(","int",")",":","The","number","of","buckets","to","split","the","data","samples",".","min_len","(","int",",","optional",")",":","The","minimum","sample","lengths","to","keep",".","(","Default",":","0",")","max_len","(","int","or","None",",","optional",")",":","The","maximum","sample","lengths","to","keep",".","Inferred","if","not","provided",".","(","Default","``","None","``",")","max_token_count","(","int","or","None",",","optional",")",":","The","max","number","of","tokens","in","one","mini-batch",".","(","Default",":","``","None","``",")","batch_size","(","int","or","None",",","optional",")",":","The","number","of","samples","in","one","mini-batch",".","(","Default",":","``","None","``",")","shuffle","(","bool",",","optional",")",":","Whether","to","shuffle","buckets","for","non-monotonic","length","sampling",".","(","Default",":","True",")","seed","(","int",",","optional",")",":","The","seed","for","initialzing","RNG",".","Only","used","when","`","shuffle","`","is","True",".","(","Default",":","0",")","drop_last","(","bool",",","optional",")",":","If","``","True","``",",","the","sampler","will","drop","the","last","batch","if","its","size","would","be","less","than","``","batch_size","``","(","Default",":","False",")","Note",":","``","max_token_count","``","and","``","batch_size","``","are","mutually","exclusive",".","Only","one","argument","of","the","two","should","have","value",".","Note",":","``","drop_last","``","is","only","valid","when","``","batch_size","``","argument","is","given",".","Note",":","if","``","shuffle","``","is","True",",","it","will","only","shuffle","the","data","once",".","Please","set","``","reload_dataloaders_every_n_epochs=1","``","in","pytorch_lightning","Trainer","and","set","``","seed","``","to","``","self.trainer.current_epoch","``","to","enable","shuffling","every","epoch","."]
code: def __len__(self):
      if self.batch_size or (self.max_token_count and not self.shuffle):
          return len(self.iter_list)
  
imports: import math
  import os
  import sys
  from pathlib import Path
  from typing import Dict, Iterator, List, Optional, Tuple, Union
  import numpy
  import torch
  import torch.distributed
  import torchaudio
  from torch import Tensor
  from torch.utils.data import BatchSampler, Dataset, DistributedSampler
  from utils import _get_label2id
label_desc: Use image node_id 5 for calling the BucketizeBatchSampler obj's underlying member method code with example usage: obj.__len__() and returns: len