code: def initialise_from_same_encoder(
      params: PyTree,
      restored_params: PyTree,
      config: ml_collections.ConfigDict,
      restored_model_cfg: ml_collections.ConfigDict,
  ) -> PyTree:
      """Init MBT from "same_encoder" or "concat_and_encode" pretrained models.
  
      Because the model has a single encoder "Transformer", we can call the
      "initialise_from_vit" method then add the embeddings for both modalities.
  
      Args:
       params: PyTree of model parameters in the target model.
       restored_params: PyTree of model parameters to restore.
       config: Configuration of the target model.
       restored_model_cfg: Configuration of the restored model.
  
      Returns:
        Adapted parameters for MBT.
      """
      if len(config.model.modality_fusion) == 2:
          assert config.model.modality_fusion == (
              "rgb",
              "spectrogram",
          ), 'The modality fusion must be "rgb, spectrogram".'
  
      params = initialise_from_vit(
          params=params,
          restored_params=restored_params,
          config=config,
          restored_model_cfg=restored_model_cfg,
          mbt_transformer_key="Transformer",
          restore_output_proj=False,
          prefix_path=None,
      )
  
      # Now handle special cases.
      if "rgb" in config.model.modality_fusion:
          params["embedding"]["bias"] = restored_params[
              "embedding_rgb"
          ]["bias"]
          params["embedding"]["kernel"] = restored_params[
              "embedding_rgb"
          ]["kernel"]
  
      if "spectrogram" in config.model.modality_fusion:
          params["embedding_spec"]["bias"] = restored_params[
              "embedding_spectrogram"
          ]["bias"]
  
          if (
              "embedding_spec" in params
              and params["embedding_spec"]["kernel"].shape[2] == 3
              and restored_params["embedding_spectrogram"][
                  "kernel"
              ].shape[2]
              == 1
          ):
              value = restored_params["embedding_spectrogram"]["kernel"]
              value = np.tile(value, [1, 1, 3, 1])
              params["embedding_spec"]["kernel"] = value
          else:
              logging.info(
                  "Not inflating spectrogram embedding filter."
              )
              params["embedding_spec"]["kernel"] = restored_params[
                  "embedding_spectrogram"
              ]["kernel"]
  
      return params
  
imports: import functools
  import re
  from typing import Any, Callable, Dict, Optional, Sequence, Tuple
  from absl import logging
  import flax
  import flax.linen
  import jax
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.common_lib import debug_utils
  from scenic.model_lib.base_models import base_model
  from scenic.model_lib.base_models import classification_model
  from scenic.model_lib.base_models import model_utils
  from scenic.model_lib.base_models.classification_model import ClassificationModel
  from scenic.model_lib.layers import nn_layers
  from scenic.projects.av_mae import model_utils
  from scenic.projects.baselines import vit
  from scenic.projects.mbt import model
  from scenic.projects.vivit import model_utils
  import scipy
label_desc: Use image node_id 8 for calling a global function with example usage: initialise_from_same_encoder(params, restored_params, config, restored_model_cfg) and returns: params