code: def init_text_encoder_from_clip_checkpoint(
      config: ml_collections.ConfigDict,
      train_state: train_utils.TrainState,
  ) -> train_utils.TrainState:
      """Initializes the text encoder with a CLIP model."""
      checkpoint_path = config.init_from.text_encoder.checkpoint_path
      clip_params = clip_model.load_model_vars("", checkpoint_path)
      clip_params = jax.tree_util.tree_map(jnp.float32, clip_params)
      return unloc_model_utils.initialize_from_clip_model(
          config,
          train_state,
          clip_params,
          load_image_tower=False,
          load_text_tower=True,
      )
  
imports: import collections.abc
  import functools
  import re
  from typing import Any, Callable, Dict, Mapping, Optional, Sequence, Tuple, Union
  from absl import logging
  import flax
  import flax.linen
  import jax
  from jax.example_libraries.optimizers import clip_grads
  import jax.numpy
  import ml_collections
  import optax
  from scenic.common_lib import debug_utils
  from scenic.dataset_lib import dataset_utils
  from scenic.projects.baselines.clip import model
  from scenic.projects.unloc import eval_utils
  from scenic.projects.unloc import model_utils
  from scenic.projects.vivit import model_utils
  from scenic.train_lib import pretrain_utils
  from scenic.train_lib import train_utils
  import scipy.ndimage
label_desc: Use image node_id 7 for calling a global function with example usage: init_text_encoder_from_clip_checkpoint(config, train_state) and returns: unloc_model_utils