code: def check_weights_different(
      initialisation: PyTree, loaded: PyTree, ignore_key_bias: bool
  ) -> bool:
      """Check all leaves are different in two PyTrees."""
      init_flat = flax.traverse_util.flatten_dict(
          initialisation, sep="/"
      )
      loaded_flat = flax.traverse_util.flatten_dict(loaded, sep="/")
  
      for name in init_flat:
          if name not in loaded_flat:
              print(f"Variable {name} not in loaded model parameters.")
              continue
          if init_flat[name].shape != loaded_flat[name].shape:
              print(f"Variable {name} has incorrect shapes.")
              continue
          if np.allclose(init_flat[name], loaded_flat[name]):
              if (
                  "MultiHeadDotProductAttention" in name
                  and "key/bias" in name
                  and ignore_key_bias
              ):
                  # Include this special case, as the biases for the key projections are
                  # often not used in PyTorch self-attention implementations.
                  logging.info(
                      "Parameter %s did not change for initialisation",
                      name,
                  )
                  continue
              print(f"Variable {name} unchanged from initialisation.")
  
      return True
  
imports: import pickle
  from typing import Any, Dict, Union
  from absl import app
  from absl import flags
  from absl import logging
  import flax
  import jax
  from jax import random
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.projects.objectvivit import model
  from scenic.train_lib import train_utils
label_desc: Use image node_id 6 for calling a global function with example usage: check_weights_different(initialisation, loaded, ignore_key_bias) and returns: True