code: def hf_gpt2(model, inputs, tokenizer, generation_method="topk"):
      inputs = inputs.to("cuda:0")
      torch.cuda.synchronize()
      start_time = time.perf_counter()
      results = None
      if generation_method == "topk" or generation_method == "topp":
          results = model.generate(
              inputs,
              min_length=150,
              max_length=150,
              pad_token_id=tokenizer.eos_token_id,
              use_cache=True,
              top_k=1,
              early_stopping=False,
          )
      elif generation_method == "ppl":
          results = compute_hf_ppl(model, inputs)
  
      torch.cuda.synchronize()
      end_time = time.perf_counter()
      return results, end_time - start_time
  
file_path: lightseq/examples/inference/python/test/ls_gpt2_bench.py
imports: import time
  import argparse
  import torch
  import lightseq.inference
  from transformers import GPT2Tokenizer, GPT2LMHeadModel
label_desc: Use image node_id 3 for calling a global function with example usage: hf_gpt2(model, inputs, tokenizer, generation_method) and returns: results,  unknown