code: def calc_stats(examples, tokenizer=None, is_tokenize=False):
      avg_src_len = []
      avg_trg_len = []
      avg_src_len_tokenize = []
      avg_trg_len_tokenize = []
      for ex in examples:
          if is_tokenize:
              avg_src_len.append(len(ex.source.split()))
              avg_trg_len.append(len(str(ex.target).split()))
              avg_src_len_tokenize.append(
                  len(tokenizer.tokenize(ex.source))
              )
              avg_trg_len_tokenize.append(
                  len(tokenizer.tokenize(str(ex.target)))
              )
          else:
              avg_src_len.append(len(ex.source.split()))
              avg_trg_len.append(len(str(ex.target).split()))
      if is_tokenize:
          logger.info(
              "Read %d examples, avg src len: %d, avg trg len: %d, max src len: %d, max trg len: %d",
              len(examples),
              np.mean(avg_src_len),
              np.mean(avg_trg_len),
              max(avg_src_len),
              max(avg_trg_len),
          )
          logger.info(
              "[TOKENIZE] avg src len: %d, avg trg len: %d, max src len: %d, max trg len: %d",
              np.mean(avg_src_len_tokenize),
              np.mean(avg_trg_len_tokenize),
              max(avg_src_len_tokenize),
              max(avg_trg_len_tokenize),
          )
      else:
          logger.info(
              "Read %d examples, avg src len: %d, avg trg len: %d, max src len: %d, max trg len: %d",
              len(examples),
              np.mean(avg_src_len),
              np.mean(avg_trg_len),
              max(avg_src_len),
              max(avg_trg_len),
          )
  
file_path: codet5/CodeT5/utils.py
imports: from torch.utils.data import TensorDataset
  import numpy
  import logging
  import os
  import random
  import torch
  import time
  from tqdm import tqdm
  from _utils import *
label_desc: Use image node_id 7 for calling a global function with example usage: calc_stats(examples, tokenizer, is_tokenize) without return types