code: def create_classifier_dataset(
      file_path,
      seq_length,
      batch_size,
      is_training=True,
      repeats=None,
      input_pipeline_context=None,
      label_type=tf.int64,
      include_sample_weights=False,
      num_samples=None,
  ):
      """Creates input dataset from (tf)records files for train/eval."""
      name_to_features = {
          "input_ids": tf.io.FixedLenFeature([seq_length], tf.int64),
          "input_mask": tf.io.FixedLenFeature([seq_length], tf.int64),
          "segment_ids": tf.io.FixedLenFeature([seq_length], tf.int64),
          "label_ids": tf.io.FixedLenFeature([], label_type),
      }
      if include_sample_weights:
          name_to_features["weight"] = tf.io.FixedLenFeature(
              [], tf.float32
          )
      dataset = input_pipeline.single_file_dataset(
          file_path, name_to_features, num_samples=num_samples
      )
  
      # The dataset is always sharded by number of hosts.
      # num_input_pipelines is the number of hosts rather than number of cores.
      if (
          input_pipeline_context
          and input_pipeline_context.num_input_pipelines > 1
      ):
          dataset = dataset.shard(
              input_pipeline_context.num_input_pipelines,
              input_pipeline_context.input_pipeline_id,
          )
  
      def _select_data_from_record(record):
          x = {
              "input_word_ids": record["input_ids"],
              "input_mask": record["input_mask"],
              "input_type_ids": record["segment_ids"],
          }
          y = record["label_ids"]
          if include_sample_weights:
              w = record["weight"]
              return (x, y, w)
          return (x, y)
  
      if is_training:
          # The correct way would be to repeat and then shuffle but this is how it is
          # done in:
          # https://github.com/tensorflow/models/blob/master/official/nlp/bert/input_pipeline.py#L190
          dataset = dataset.shuffle(100)
          dataset = dataset.repeat(repeats)
  
      dataset = dataset.map(
          _select_data_from_record,
          num_parallel_calls=tf.data.experimental.AUTOTUNE,
      )
      dataset = dataset.batch(batch_size, drop_remainder=is_training)
  
      if not is_training:
          dataset = dataset.repeat(repeats)
      return dataset
  
file_path: scenic/scenic/projects/baselines/bert/datasets/bert_glue_dataset.py
imports: import functools
  import json
  from typing import Optional
  from absl import logging
  from flax import jax_utils
  import jax
  import jax.numpy
  from scenic.dataset_lib import dataset_utils
  from scenic.dataset_lib import datasets
  import tensorflow
  from official.nlp.data.bert import input_pipeline
label_desc: Use image node_id 1 for calling a global function with example usage: create_classifier_dataset(file_path, seq_length, batch_size, is_training, repeats, input_pipeline_context, label_type, include_sample_weights, num_samples) and returns: dataset, x,  y, x,  y,  w