code: def initialize_from_clip_model(
      config: ml_collections.ConfigDict,
      train_state: train_utils.TrainState,
      restored_params: Dict[str, Any],
      load_image_tower: bool = True,
      load_text_tower: bool = True,
      video_modality_name: str = "video",
      text_encoder_name: str = "text_encoder",
  ) -> train_utils.TrainState:
      """Initializes a video-text model from an pretrained image-text model."""
      params = flax.core.unfreeze(train_state.params)
      if load_image_tower:
          if config.init_from.get("video_encoder"):
              load_image_tower_projection = (
                  config.init_from.video_encoder.get("load_projection")
                  and config.model.video_tower_config.get(
                      "projection_size"
                  )
              )
          else:
              load_image_tower_projection = (
                  config.init_from.video_encoders[
                      video_modality_name
                  ].get("load_projection")
                  and config.model.video_tower_config.modality_configs[
                      video_modality_name
                  ].get("projection_size")
              )
          initialize_video_encoder_from_clip_params(
              config,
              params,
              restored_params["params"]["visual"],
              load_projection=False,
              video_modality_name=video_modality_name,
              model_prefix_path=[f"{video_modality_name}_encoder"],
          )
          if load_image_tower_projection:
              params[
                  f"{video_modality_name}_projection"
              ] = restored_params["params"]["visual"]["proj"]
      if load_text_tower:
          load_text_tower_projection = (
              config.init_from.text_encoder.get("load_projection")
              and config.model.text_tower_config.get("projection_size")
          )
          initialize_text_encoder_from_clip_params(
              params,
              restored_params["params"]["text"],
              load_projection=False,
              model_prefix_path=[text_encoder_name],
          )
          if load_text_tower_projection:
              params["text_projection"] = restored_params["params"][
                  "text"
              ]["text_projection"]
      return train_state.replace(params=flax.core.freeze(params))
  
imports: from typing import Any, Dict, List, Mapping, Optional, Sequence, Union
  from absl import logging
  import flax
  import jax
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.projects.vivit import model_utils
  from scenic.train_lib import train_utils
label_desc: Use image node_id 14 for calling a global function with example usage: initialize_from_clip_model(config, train_state, restored_params, load_image_tower, load_text_tower, video_modality_name, text_encoder_name) and returns: train_state