code: def prepare_validation_features(examples):
      # Some of the questions have lots of whitespace on the left, which is not useful and will make the
      # truncation of the context fail (the tokenized question will take a lots of space). So we remove that
      # left whitespace
      examples[question_column_name] = [
          q.lstrip() for q in examples[question_column_name]
      ]
  
      # Tokenize our examples with truncation and maybe padding, but keep the overflows using a stride. This results
      # in one example possible giving several features when a context is long, each of those features having a
      # context that overlaps a bit the context of the previous feature.
      tokenized_examples = tokenizer(
          examples[
              question_column_name
              if pad_on_right
              else context_column_name
          ],
          examples[
              context_column_name
              if pad_on_right
              else question_column_name
          ],
          truncation="only_second" if pad_on_right else "only_first",
          max_length=max_seq_length,
          stride=args.doc_stride,
          return_overflowing_tokens=True,
          return_offsets_mapping=True,
          padding="max_length",
      )
  
      # Since one example might give us several features if it has a long context, we need a map from a feature to
      # its corresponding example. This key gives us just that.
      sample_mapping = tokenized_examples.pop(
          "overflow_to_sample_mapping"
      )
  
      # For evaluation, we will need to convert our predictions to substrings of the context, so we keep the
      # corresponding example_id and we will store the offset mappings.
      tokenized_examples["example_id"] = []
  
      for i in range(len(tokenized_examples["input_ids"])):
          # Grab the sequence corresponding to that example (to know what is the context and what is the question).
          sequence_ids = tokenized_examples.sequence_ids(i)
          context_index = 1 if pad_on_right else 0
  
          # One example can give several spans, this is the index of the example containing this span of text.
          sample_index = sample_mapping[i]
          tokenized_examples["example_id"].append(
              examples["id"][sample_index]
          )
  
          # Set to None the offset_mapping that are not part of the context so it's easy to determine if a token
          # position is part of the context or not.
          tokenized_examples["offset_mapping"][i] = [
              (o if sequence_ids[k] == context_index else None)
              for k, o in enumerate(
                  tokenized_examples["offset_mapping"][i]
              )
          ]
  
      return tokenized_examples
  
imports: import argparse
  import logging
  import os
  import time
  import timeit
  import datasets
  import numpy
  import torch
  from absl import logging
  from datasets import load_dataset, load_metric
  from torch.utils.data import DataLoader
  import pycuda.autoinit
  import pycuda.driver
  import tensorrt
  import transformers
  from accelerate import Accelerator
  from transformers import AutoTokenizer, EvalPrediction, default_data_collator, set_seed
  from transformers.trainer_pt_utils import nested_concat, nested_truncate
  from utils_qa import postprocess_qa_predictions
label_desc: Use image node_id 2 for calling a global function with example usage: prepare_validation_features(examples) and returns: tokenized_examples