class_docstr: Default RNNLM for `LMInterface` Implementation.
  
  Note:
      PyTorch seems to have memory leak when one GPU compute this after data parallel.
      If parallel GPUs compute this, it seems to be fine.
      See also https://github.com/espnet/espnet/issues/1075
class_docstr_tok: ["Default","RNNLM","for","`","LMInterface","`","Implementation",".","Note",":","PyTorch","seems","to","have","memory","leak","when","one","GPU","compute","this","after","data","parallel",".","If","parallel","GPUs","compute","this",",","it","seems","to","be","fine",".","See","also","https",":","\/\/github.com\/espnet\/espnet\/issues\/1075"]
docstr: Initialize class.
  
  Args:
      n_vocab (int): The size of the vocabulary
      args (argparse.Namespace): configurations. see py:method:`add_arguments`
docstr_tok: ["Initialize","class",".","Args",":","n_vocab","(","int",")",":","The","size","of","the","vocabulary","args","(","argparse.Namespace",")",":","configurations",".","see","py",":","method",":","`","add_arguments","`"]
code: def __init__(self, n_vocab, args):
      """Initialize class.
  
      Args:
          n_vocab (int): The size of the vocabulary
          args (argparse.Namespace): configurations. see py:method:`add_arguments`
  
      """
      nn.Module.__init__(self)
      # NOTE: for a compatibility with less than 0.5.0 version models
      dropout_rate = getattr(args, "dropout_rate", 0.0)
      # NOTE: for a compatibility with less than 0.6.1 version models
      embed_unit = getattr(args, "embed_unit", None)
      # NOTE: for a compatibility with less than 0.9.7 version models
      emb_dropout_rate = getattr(args, "emb_dropout_rate", 0.0)
      # NOTE: for a compatibility with less than 0.9.7 version models
      tie_weights = getattr(args, "tie_weights", False)
  
      self.model = ClassifierWithState(
          RNNLM(
              n_vocab,
              args.layer,
              args.unit,
              embed_unit,
              args.type,
              dropout_rate,
              emb_dropout_rate,
              tie_weights,
          )
      )
  
imports: import logging
  from typing import Any, List, Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  from espnet.nets.lm_interface import LMInterface
  from espnet.nets.pytorch_backend.e2e_asr import to_device
  from espnet.nets.scorer_interface import BatchScorerInterface
  from espnet.utils.cli_utils import strtobool
label_desc: Use image node_id 2 to create a new DefaultRNNLM object from inherited base classes: BatchScorerInterface, LMInterface, nn with example: obj = DefaultRNNLM(n_vocab, args)