code: def main():
      parser = argparse.ArgumentParser()
      parser.add_argument("--user_input", action="store_true")
      args = parser.parse_args()
  
      print("initializing bert tokenizer...")
      tokenizer = BertTokenizer.from_pretrained("bert-base-uncased")
  
      print("creating huggingface model...")
      hf_model = BertModel.from_pretrained("bert-base-uncased")
      hf_model.cuda()
      hf_model.eval()
      hf_model.half()
  
      # print("creating lightseq model...")
      # ls_model = LightseqBertClassification("lightseq_bert_base_uncased.hdf5", hf_model)
      ls_model = None
  
      sentences = [
          "Hello, my dog is cute",
      ]
  
      print("====================START warmup====================")
      warmup(tokenizer, ls_model, hf_model, sentences)
      print("====================END warmup====================")
  
      while True:
          if args.user_input:
              sentences = [input("input the masked sentence:\n")]
  
          print("tokenizing the sentences...")
          inputs = tokenizer(
              sentences, return_tensors="pt", padding=True
          )
          inputs_id = inputs["input_ids"]
          attn_mask = inputs["attention_mask"]
          input_len = inputs_id.size()[1]
          batch_size = 1
          input_seq_len = output_seq_len = 32
          repeat_factor = (input_seq_len // input_len + 1) * input_len
  
          inputs_id = inputs_id.repeat(batch_size, repeat_factor)
          attn_mask = attn_mask.repeat(batch_size, repeat_factor)
          inputs_id = inputs_id[:, :input_seq_len]
          attn_mask = attn_mask[:, :input_seq_len]
  
          inputs_id = inputs_id.cuda()
          attn_mask = attn_mask.cuda()
          print("input size:", inputs_id.size())
          # ls_generate(ls_model, inputs_id, attn_mask)
          hf_generate(hf_model, inputs_id, attn_mask)
  
          if not args.user_input:
              break
  
file_path: lightseq/examples/inference/python/test/ls_bert_bench.py
imports: import time
  import argparse
  import torch
  import lightseq.inference
  from transformers import BertTokenizer, BertForSequenceClassification, BertModel
label_desc: Use image node_id 6 for calling a global function with example usage: main() without return types