code: def __iter__(self):
      iterator = iter(self.dataset)
      more_examples = True
      while more_examples:
          buffer, buffer_len = [], 0
          while True:
              if buffer_len >= self.input_characters:
                  break
              try:
                  buffer.append(next(iterator)["content"])
                  buffer_len += len(buffer[-1])
              except StopIteration:
                  more_examples = False
                  break
          tokenized_inputs = tokenizer(buffer, truncation=False)[
              "input_ids"
          ]
          all_token_ids = []
          for tokenized_input in tokenized_inputs:
              all_token_ids.extend(
                  tokenized_input + [self.concat_token_id]
              )
          for i in range(0, len(all_token_ids), self.seq_length):
              input_ids = all_token_ids[i : i + self.seq_length]
              if len(input_ids) == self.seq_length:
                  yield torch.tensor(input_ids)
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/examples/research_projects/codeparrot/scripts/validation_loss.py
imports: import logging
  import torch
  from datasets import load_dataset
  from torch.utils.data import IterableDataset
  from torch.utils.data.dataloader import DataLoader
  from accelerate import Accelerator
  from arguments import EvaluationArguments
  from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentParser, set_seed
label_desc: Use image node_id 2 for calling the ConstantLengthDataset obj's underlying member method code with example usage: obj.__iter__() without return types