code: def get_config(run_local: str = "") -> ml_collections.ConfigDict:
      """Returns the experiment configuration."""
      run_local = bool(run_local)
  
      config = ml_collections.ConfigDict()
      config.experiment_name = "lang4video"
      config.rng_seed = 0
  
      config.init_from = ml_collections.ConfigDict()
      config.init_from.checkpoint_path = ""
  
      config.batch_size_per_device_memory_gb = 16
      config.device_memory_gbs = 16
  
      if run_local:
          config.batch_size_per_device = 8
      else:
          config.batch_size_per_device = _batch_size_per_device(
              batch_size_per_device_memory_gb=config.get_ref(
                  "batch_size_per_device_memory_gb"
              ),
              device_memory_gbs=config.get_ref("device_memory_gbs"),
          )
      config.device_count = 1
  
      config.batch_size = _batch_size(
          batch_size_per_device=config.get_ref("batch_size_per_device"),
          device_count=config.get_ref("device_count"),
      )
      config.eval_batch_size = config.get_ref("batch_size")
  
      config.steps_per_eval = 10 if run_local else 0
  
      # We set different dtypes for the data and the model because we may want a
      # mix.
      #
      # We leave it empty, so we use the default values from the models.
      config.model_dtype_str = ""
  
      config.model = ml_collections.ConfigDict()
      config.model.load_pretrained_vars = True
      config.model.loss = "nce"
      config.model.similarity = "cosine"
      config.model.gather_scores = True
  
      config.model.encoder = ml_collections.ConfigDict()
  
      config.data_dtype_str = "float32"
  
      config.retrieval_batch_size = 0  # For the retrieval evaluation.
  
      config.dataset_configs = ml_collections.ConfigDict()
      config.dataset_configs.prefetch_to_host = "autotune"
      config.dataset_configs.prefetch_to_device = 2
  
      config.dataset_configs.readahead = True
  
      config.dataset_configs.load_train = True
      config.dataset_configs.load_val = True
      config.dataset_configs.load_test = False
  
      # The following configurations are meant to be used by the DMVR datasets but
      # also as input to other parts of the config.
  
      # Given fps = 25, this means we are roughly sampling 1 frame per second.
      config.dataset_configs.num_frames = 16
      config.dataset_configs.stride = 14
      config.dataset_configs.zero_centering = False
      config.dataset_configs.resize_method = "bicubic"
      config.dataset_configs.min_resize = 256
      config.dataset_configs.crop_size = 224
      config.dataset_configs.normalization_mean = (0, 0, 0)
      config.dataset_configs.normalization_std = (1, 1, 1)
      config.dataset_configs.tokenizer = ml_collections.ConfigDict()
      config.dataset_configs.tokenizer.tokenizer_type = ""
      config.dataset_configs.tokenizer.tokenizer_vocab = ""
      config.dataset_configs.tokenizer.prepend_bos = True
      config.dataset_configs.tokenizer.append_eos = True
      config.dataset_configs.max_num_words = 77
  
      # The following configurations are not used by the DMVR datasets, but we
      # control them for here.
  
      config.dataset_configs.visual_key = "image"
      config.dataset_configs.is_video = False
      config.dataset_configs.text_in_key = "texts"
      config.dataset_configs.text_out_key = "labels"
      config.dataset_configs.is_classification = False
      config.dataset_configs.tokenizer_type = ""
      config.dataset_configs.vocab_size = -2
      config.dataset_configs.lowercase = False
      config.dataset_configs.pad_value = 0
  
      # For the datasets from Big Transfer (that use pp ops from):
      # (note we can't put these params in the mixin because the refs don't exist)
  
      config.dataset_configs.feature_key = (
          config.dataset_configs.get_ref("visual_key")
      )
      ops_kwargs = {
          "visual_key": config.dataset_configs.visual_key,
          "is_video": config.dataset_configs.is_video,
          "num_frames": config.dataset_configs.num_frames,
          "stride": config.dataset_configs.stride,
          "min_resize": config.dataset_configs.min_resize,
          "crop_size": config.dataset_configs.crop_size,
          "normalization_mean": config.dataset_configs.normalization_mean,
          "normalization_std": config.dataset_configs.normalization_std,
          "text_in_key": config.dataset_configs.text_in_key,
          "text_out_key": config.dataset_configs.text_out_key,
          "tokenizer_type": config.dataset_configs.tokenizer_type,
          "is_classification": config.dataset_configs.is_classification,
          "tokenizer_name": config.dataset_configs.tokenizer.tokenizer_type,
          "vocab_name_or_path": config.dataset_configs.tokenizer.tokenizer_vocab,
          "prepend_bos": config.dataset_configs.tokenizer.prepend_bos,
          "append_eos": config.dataset_configs.tokenizer.append_eos,
          "lowercase": config.dataset_configs.lowercase,
          "max_num_tokens": config.dataset_configs.max_num_words,
          "pad_value": config.dataset_configs.pad_value,
      }
      config.dataset_configs.pp_train = get_train_ops(**ops_kwargs)
      config.dataset_configs.pp_eval = get_eval_ops(**ops_kwargs)
      config.dataset_configs.shuffle_buffer_size = (
          5 if run_local else 250_000
      )
      config.dataset_configs.num_classes = (
          -1
      )  # To avoid a warning message.
      config.dataset_configs.extra_meta_data = _metadata(
          vocab_size=config.dataset_configs.get_ref("vocab_size"),
          max_num_tokens=config.dataset_configs.get_ref(
              "max_num_words"
          ),
      )
  
      config.checkpoint = (
          True  # Whether to load a checkpoint if available.
      )
      config.overwrite_checkpoint = run_local
      config.debug_train = False
      config.debug_eval = False
      config.enable_pmap_and_jit = True
      config.use_jax_compilation_cache = False
      if run_local:
          config.count_flops = False
  
      return config
  
file_path: scenic/scenic/projects/lang4video/configs/base.py
imports: from collections.abc import Sequence
  from typing import Literal
  from typing import Union
  import ml_collections
label_desc: Use image node_id 7 for calling a global function with example usage: get_config(run_local) and returns: config