code: def get_hf_bart_dec_enc_atten_kv(layers, params_list, nlayer):
      init_ws, init_bs = [], []
      for i in range(nlayer):
          layer = layers[i]
          modules_list = []
          exec(
              f"modules_list.append(layer.{params_list.encoder_attn_k_proj})"
          )
          exec(
              f"modules_list.append(layer.{params_list.encoder_attn_v_proj})"
          )
          for module in modules_list:
              w, b = get_weight_and_bias(module)
              init_ws.append(w)
              init_bs.append(b)
      enc_attn_kvw = torch.cat([ele for ele in init_ws], dim=0)
      enc_attn_kvb = torch.cat([ele for ele in init_bs], dim=0)
      return enc_attn_kvw, enc_attn_kvb
  
imports: import torch
  from torch import nn
  from dataclasses import dataclass
  from lightseq.training.ops.pytorch.transformer_encoder_layer import LSTransformerEncoderLayer
  from lightseq.training.ops.pytorch.transformer_decoder_layer import LSTransformerDecoderLayer
  from lightseq.training.ops.pytorch.quantization import weight_quant_config, act_quant_config, relu_quant_config
  from transformers import BartPretrainedModel, BartForConditionalGeneration, BartForSequenceClassification, BartForQuestionAnswering
  from transformers.models.bart.modeling_bart import BartEncoderLayer, BartDecoderLayer
label_desc: Use image node_id 2 for calling a global function with example usage: get_hf_bart_dec_enc_atten_kv(layers, params_list, nlayer) and returns: enc_attn_kvw,  enc_attn_kvb