code: def save_model(transformer, pb_path, hdf5_path, hdf5):
      if not hdf5:
          try:
              str_model = transformer.SerializeToString()
              print("Writing to {0}".format(pb_path))
              with tf.io.gfile.GFile(pb_path, "wb") as fout:
                  fout.write(str_model)
              return pb_path
          except:
              pass
  
      print("Writing to {0}".format(hdf5_path))
      f = h5py.File(hdf5_path, "w")
      if isinstance(transformer, Transformer):
          export_pb2hdf5(transformer, f)
      else:
          export_quant_pb2hdf5(transformer, f)
      f.close()
      return hdf5_path
  
file_path: lightseq/examples/inference/python/export/util.py
imports: import argparse
  import tensorflow
  import h5py
  from export.proto.transformer_pb2 import Transformer
  from lightseq.training import export_pb2hdf5
  from lightseq.training import export_quant_pb2hdf5
label_desc: Use image node_id 2 for calling a global function with example usage: save_model(transformer, pb_path, hdf5_path, hdf5) and returns: hdf5_path, pb_path