code: def _create_text_dataset(
      config: ml_collections.ConfigDict,
      rng: jnp.ndarray,
      workdir: Optional[str] = None,
  ) -> dataset_utils.Dataset:
      """Creates the text dataset."""
      data_rng, rng = jax.random.split(rng)
  
      if config.checkpoint and data_rng is not None:
          # When restoring from a checkpoint, change the dataset seed to ensure
          # that the example order is new. With deterministic data, this ensures
          # enough randomization and in the future with deterministic data +
          # random access, we can feed the global step to the dataset loader to
          # always continue reading the rest of the data if we resume a job that
          # was interrupted.
          checkpoint_path = checkpoints.latest_checkpoint(workdir)
          logging.info("CHECKPOINT PATH: %s", checkpoint_path)
          if checkpoint_path is not None:
              global_step = (
                  train_utils.checkpoint_path_step(checkpoint_path) or 0
              )
              logging.info(
                  "Folding global_step %s into text dataset seed.",
                  global_step,
              )
              data_rng = jax.random.fold_in(data_rng, global_step)
  
      with (
          config_for_text := util.safe_deepcopy_config(config)
      ).unlocked():
          config_for_text.dataset_name = (
              config_for_text.text_dataset_name
          )
          config_for_text.dataset_configs = (
              config_for_text.text_dataset_configs
          )
  
          # We copy this one over also:
          config_for_text.dataset_configs.max_num_words = (
              config.dataset_configs.max_num_words
          )  # pylint: disable=g-line-too-long
  
      return train_utils.get_dataset(config_for_text, data_rng)
  
imports: from collections.abc import Callable
  from collections.abc import Mapping
  from collections.abc import MutableMapping
  import functools
  from typing import Any
  from typing import Optional
  from absl import logging
  from clu import metric_writers
  from clu import periodic_actions
  from clu import platform
  from flax import jax_utils
  from flax.training import checkpoints
  import jax
  import jax.numpy
  import ml_collections
  import optax
  from scenic.dataset_lib import dataset_utils
  from scenic.projects.baselines.bert import bert_base_model
  from scenic.projects.lang4video import util
  from scenic.projects.lang4video.model.image_text_model import ImageTextModel
  from scenic.projects.lang4video.trainer import optimizers
  from scenic.projects.lang4video.trainer.train_utils import ArgSpec
  from scenic.projects.lang4video.trainer.train_utils import axis_name_exists
  from scenic.projects.lang4video.trainer.train_utils import clip_grads
  from scenic.projects.lang4video.trainer.train_utils import compute_mask
  from scenic.projects.lang4video.trainer.train_utils import get_epoch_steps
  from scenic.projects.lang4video.trainer.train_utils import get_input_spec
  from scenic.projects.lang4video.trainer.train_utils import init_encoder
  from scenic.projects.lang4video.trainer.train_utils import is_video_input
  from scenic.projects.lang4video.trainer.train_utils import NUM_DEVICES_AXIS_NAME
  from scenic.train_lib import lr_schedules
  from scenic.train_lib import pretrain_utils
  from scenic.train_lib import train_utils
label_desc: Use image node_id 3 for calling a global function with example usage: _create_text_dataset(config, rng, workdir) and returns: train_utils