class_docstr: NMTModel Class
  Currently TransformerLMDecoder is the only LM decoder implemented
  
  Args:
      decoder (onmt.decoders.TransformerLMDecoder): a transformer decoder
class_docstr_tok: ["NMTModel","Class","Currently","TransformerLMDecoder","is","the","only","LM","decoder","implemented","Args",":","decoder","(","onmt.decoders.TransformerLMDecoder",")",":","a","transformer","decoder"]
docstr: Count number of parameters in model (& print with `log` callback).
  
  Returns: (int, int)
      encoder side parameter count
      decoder side parameter count
docstr_tok: ["Count","number","of","parameters","in","model","(","&","print","with","`","log","`","callback",")",".","Returns",":","(","int",",","int",")","encoder","side","parameter","count","decoder","side","parameter","count"]
code: def count_parameters(self, log=print):
      """Count number of parameters in model (& print with `log` callback).
  
      Returns: (int, int)
          encoder side parameter count
          decoder side parameter count"""
  
      enc, dec = 0, 0
      for name, param in self.named_parameters():
          if "decoder" in name:
              dec += param.nelement()
  
      if callable(log):
          # No encoder in LM, seq2seq count formatting kept
          log("encoder: {}".format(enc))
          log("decoder: {}".format(dec))
          log("* number of parameters: {}".format(enc + dec))
      return enc, dec
  
imports: import torch
  import torch.nn
  from glob import glob
label_desc: Use image node_id 4 for calling the LanguageModel obj's underlying member method code with example usage: obj.count_parameters(log) and returns: enc,  dec