code: def print_perf_stats(
      latency_set, config, dtype, batch_size, warmup=3
  ):
      # trim warmup queries
      latency_set = list(latency_set)
      latency_set = latency_set[warmup:]
      count = len(latency_set)
  
      if count > 0:
          latency_set.sort()
          avg = sum(latency_set) / count
          num_layers = getattr(
              config, "num_layers", config.num_hidden_layers
          )
          num_parameters = (
              num_layers * config.hidden_size * config.hidden_size * 12
          )
          if dtype == "float16":
              num_bytes = 2
          elif dtype == "float32":
              num_bytes = 4
          else:
              num_bytes = 1
          print("Avg Per Token Latency: {0:8.2f} ms".format(avg * 1000))
          print(
              "Avg BW: {0:8.2f} GB/s".format(
                  1 / avg * num_parameters * num_bytes / 1e9
              )
          )
          print(
              "Avg flops: {0:8.2f} TFlops/s".format(
                  1
                  / avg
                  * num_parameters
                  * num_bytes
                  * batch_size
                  / 1e12
              )
          )
  
file_path: deepspeedexamples/inference/huggingface/text-generation/utils.py
imports: import os
  import io
  from pathlib import Path
  import json
  import deepspeed
  import torch
  from huggingface_hub import snapshot_download
  from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, LlamaTokenizerFast
  from deepspeed.accelerator import get_accelerator
label_desc: Use image node_id 1 for calling the Performance obj's underlying member method code with example usage: obj.print_perf_stats(latency_set, config, dtype, batch_size, warmup) without return types