code: def export_ls_fs_transformer(model_path, pb_path, hdf5_path, hdf5):
      with open(model_path, "rb") as fin:
          ckpt_file = torch.load(fin)
      args = ckpt_file["args"]
      state_dict = ckpt_file["model"]
  
      transformer = Transformer()
      encoder_state_dict, decoder_state_dict = _extract_weight(
          state_dict
      )
      export_ls_embedding(
          transformer,
          encoder_state_dict,
          300,
          args.encoder_embed_dim,
          True,
          save_pb=True,
      )
      export_ls_embedding(
          transformer,
          decoder_state_dict,
          300,
          args.decoder_embed_dim,
          False,
          save_pb=True,
      )
      export_ls_encoder(
          transformer,
          encoder_state_dict,
          args.encoder_embed_dim,
          args.encoder_ffn_embed_dim,
          save_pb=True,
      )
      export_ls_decoder(
          transformer,
          decoder_state_dict,
          args.decoder_embed_dim,
          args.decoder_ffn_embed_dim,
          args.decoder_layers,
          save_pb=True,
      )
      export_fs_weights(transformer, state_dict, args)
      export_ls_config(
          transformer,
          args.encoder_attention_heads,
          1,
          2,
          2,
          args.encoder_layers,
          args.decoder_layers,
          save_pb=True,
      )
  
      save_path = save_model(transformer, pb_path, hdf5_path, hdf5)
      return save_path
  
file_path: lightseq/examples/inference/python/export/fairseq/ls_fs_transformer_export.py
imports: import torch
  from export.proto.transformer_pb2 import Transformer
  from lightseq.training import export_ls_config, export_ls_embedding, export_ls_encoder, export_ls_decoder
  import lightseq.inference
  from export.util import parse_args, save_model
label_desc: Use image node_id 3 for calling a global function with example usage: export_ls_fs_transformer(model_path, pb_path, hdf5_path, hdf5) and returns: save_path