docstr: Return the number of parameters in the model.
  For non-embedding count (default), the position embeddings get subtracted.
  The token embeddings would too, except due to the parameter sharing these
  params are actually used as weights in the final layer, so we include them.
docstr_tok: ["Return","the","number","of","parameters","in","the","model",".","For","non-embedding","count","(","default",")",",","the","position","embeddings","get","subtracted",".","The","token","embeddings","would","too",",","except","due","to","the","parameter","sharing","these","params","are","actually","used","as","weights","in","the","final","layer",",","so","we","include","them","."]
code: def get_num_params(self, non_embedding=True):
      """
      Return the number of parameters in the model.
      For non-embedding count (default), the position embeddings get subtracted.
      The token embeddings would too, except due to the parameter sharing these
      params are actually used as weights in the final layer, so we include them.
      """
      n_params = sum(p.numel() for p in self.parameters())
      if non_embedding:
          n_params -= self.transformer.wte.weight.numel()
          n_params -= self.transformer.wpe.weight.numel()
      return n_params
  
imports: import math
  from dataclasses import dataclass
  import torch
  from coqpit import Coqpit
  from torch import nn
  from torch.nn import functional
label_desc: Use image node_id 2 for calling the GPT obj's underlying member method code with example usage: obj.get_num_params(non_embedding) and returns: n_params