class_docstr: Container module with an encoder, a recurrent module, and a decoder.
class_docstr_tok: ["Container","module","with","an","encoder",",","a","recurrent","module",",","and","a","decoder","."]
code: def __getstate__(self):
      # "document_delimiter" property may be missing in some older pre-trained models
      self.document_delimiter = getattr(
          self, "document_delimiter", "\n"
      )
  
      # serialize the language models and the constructor arguments (but nothing else)
      model_state = {
          "state_dict": self.state_dict(),
          "dictionary": self.dictionary,
          "is_forward_lm": self.is_forward_lm,
          "hidden_size": self.hidden_size,
          "nlayers": self.nlayers,
          "embedding_size": self.embedding_size,
          "nout": self.nout,
          "document_delimiter": self.document_delimiter,
          "dropout": self.dropout,
          "recurrent_type": self.recurrent_type,
          "has_decoder": self.decoder is not None,
      }
  
      return model_state
  
imports: import math
  from pathlib import Path
  from typing import List, Optional, Tuple, Union
  import torch
  from torch import logsumexp, nn
  from torch.optim import Optimizer
  import flair
  from flair.data import Dictionary
  from flair.nn.recurrent import create_recurrent_layer
label_desc: Use image node_id 16 for calling the LanguageModel obj's underlying member method code with example usage: obj.__getstate__() and returns: model_state