code: def __iter__(self):
      ids = np.argsort(self.lengths)
      if self.drop_last:
          ids = ids[: len(ids) // self.batch_size * self.batch_size]
  
      batches = [
          ids[i : i + self.batch_size]
          for i in range(0, len(ids), self.batch_size)
      ]
  
      if self.shuffle:
          random.shuffle(batches)
  
      for b in batches:
          yield b
  
file_path: llama-recipes/src/llama_recipes/data/sampler.py
imports: import random
  from itertools import islice
  import numpy
  import torch
label_desc: Use image node_id 2 for calling the LengthBasedBatchSampler obj's underlying member method code with example usage: obj.__iter__() without return types