code: def compute_n_params(model, return_str=True):
      tot = 0
      for p in model.parameters():
          w = 1
          for x in p.shape:
              w *= x
          tot += w
      if return_str:
          if tot >= 1e6:
              return "{:.1f}M".format(tot / 1e6)
          else:
              return "{:.1f}K".format(tot / 1e3)
      else:
          return tot
  
imports: import math
  import numpy
  import io
  import os
  import time
  from collections import defaultdict, deque
  import datetime
  import torch
  import torch.distributed
label_desc: Use image node_id 5 for calling a global function with example usage: compute_n_params(model, return_str) and returns: tot, str, str