class_docstr: TODO
code: def tie_weights(
      self,
  ):
      pos_idx = 0
  
      if self.mcore_gpt:
          if self.cfg.megatron_amp_O2:
              layers = self.model.module.decoder.layers
          else:
              layers = self.model.decoder.layers
      else:
          if self.cfg.megatron_amp_O2:
              layers = self.model.module.language_model.encoder.layers
          else:
              layers = self.model.language_model.encoder.layers
  
      layer0 = layers[0]
      for adapter_name in layer0.adapter_layer:
          adapter = layer0.get_adapter_module(adapter_name)
          print(adapter_name, pos_idx)
          adapter.set_position(pos_idx)
          pos_idx += 1
  
      for layer in layers[1:]:
          for adapter_name in layer.adapter_layer:
              print(adapter_name, pos_idx)
              adapter_l = layer.get_adapter_module(adapter_name)
              adapter_0 = layer0.get_adapter_module(adapter_name)
              if hasattr(adapter_0, "layer_norm"):
                  lnorm = adapter_0.layer_norm
              else:
                  lnorm = None
              adapter_l.tie_weights(pos_idx, adapter_0)
              pos_idx += 1
  
imports: from omegaconf.dictconfig import DictConfig
  from pytorch_lightning.trainer.trainer import Trainer
  from nemo.collections.nlp.models.language_modeling.megatron_gpt_sft_model import MegatronGPTSFTModel
  from nemo.collections.nlp.modules.common.megatron.adapters.mcore_mixins import MCoreGPTEmbeddingMixin, MCoreSelfAttentionMixin, MCoreTransformerLayerMixin, swap_mcore_mixin
  from nemo.collections.nlp.modules.common.megatron.adapters.parallel_adapters import AdapterName, InfusedAdapterConfig, LoraKQVAdapterConfig, LoraKQVAdapterWeightTyingConfig, MLPInfusedAdapterConfig, ParallelLinearAdapterConfig, ParallelLinearAdapterWeightTyingConfig, PromptEncoderAdapterConfig
  from nemo.core.classes.mixins import adapter_mixins
  from nemo.utils import logging, model_utils
  from nemo.utils.decorators import deprecated
label_desc: Use image node_id 2 for calling the MegatronGPTAdapterModelWeightTying obj's underlying member method code with example usage: obj.tie_weights() without return types