code: def _compute_stats(self, lengths):
      lengths = np.array(lengths)
      return {
          "exs": len(lengths),
          "min": np.min(lengths),
          "max": np.max(lengths),
          "mean": np.median(lengths),
          "p01": np.quantile(lengths, 0.05),
          "p05": np.quantile(lengths, 0.05),
          "p10": np.quantile(lengths, 0.10),
          "p25": np.quantile(lengths, 0.25),
          "p50": np.quantile(lengths, 0.50),
          "p75": np.quantile(lengths, 0.75),
          "p90": np.quantile(lengths, 0.90),
          "p95": np.quantile(lengths, 0.95),
          "p99": np.quantile(lengths, 0.99),
          "p@128": np.mean(lengths <= 128),
      }
  
file_path: ParlAI/parlai/scripts/token_stats.py
imports: import numpy
  from parlai.core.script import ParlaiScript, register_script
  from parlai.core.agents import create_agent
  from parlai.core.torch_agent import TorchAgent
  from parlai.core.worlds import create_task
  from parlai.core.params import ParlaiParser
  from parlai.utils.misc import TimeLogger, nice_report
  import parlai.utils.logging
label_desc: Use image node_id 2 for calling the TokenStats obj's underlying member method code with example usage: obj._compute_stats(lengths) and returns: dict