code: def export_pb(state_dict, pb_path, pad_id, start_id, end_id, config):
      encoder_state_dict, decoder_state_dict = _extract_weight(
          state_dict
      )
      ls_infer_model = QuantTransformer()
  
      export_ls_embedding_ptq(
          ls_infer_model,
          encoder_state_dict,
          config.max_seq_len,
          config.hidden_size,
          True,
      )
      export_ls_embedding_ptq(
          ls_infer_model,
          decoder_state_dict,
          config.max_seq_len,
          config.hidden_size,
          is_encoder=False,
      )
      export_ls_encoder_ptq(
          ls_infer_model,
          encoder_state_dict,
          config.hidden_size,
          config.intermediate_size,
          act_clip_max=global_act_clip_max,
      )
      export_ls_decoder_ptq(
          ls_infer_model,
          decoder_state_dict,
          config.hidden_size,
          config.intermediate_size,
          config.num_decoder_layer,
          act_clip_max=global_act_clip_max,
      )
      export_other_weights(
          ls_infer_model, state_dict, config.vocab_size
      )
      export_ls_config(
          ls_infer_model,
          config.nhead,
          pad_id,
          start_id,
          end_id,
          config.num_encoder_layer,
          config.num_decoder_layer,
          beam_size=1,
      )
  
      with open(pb_path, "wb") as fout:
          fout.write(ls_infer_model.SerializeToString())
  
file_path: lightseq/examples/inference/python/export/ls_transformer_ptq_export.py
imports: import argparse
  import time
  import numpy
  import torch
  from transformers import BertTokenizer
  from proto.quant_transformer_pb2 import QuantTransformer
  from lightseq.training import export_ls_config, export_ls_embedding_ptq, export_ls_encoder_ptq, export_ls_decoder_ptq, LSTransformer
  import lightseq.inference
label_desc: Use image node_id 3 for calling a global function with example usage: export_pb(state_dict, pb_path, pad_id, start_id, end_id, config) without return types