class_docstr: Custom Decoder with Ladder model.
code: def build_layers(self) -> nn.ModuleList:
      # HACK: Adding vocab size to opt for use in HashLayerFFN
      self.opt["dict_size"] = self.embeddings.weight.size(0)
      layers = nn.ModuleList()
      for i in range(self.n_layers):
          layer_class = self.swappables.layer
          if self.opt["hash_layer"] == i:
              layer_class = layer_class.with_components(
                  feedforward=HashLayerFFN
              )
          layers.append(
              layer_class(
                  self.opt,
                  attention_dropout=self.opt.get(
                      "attention_dropout", 0.0
                  ),
                  relu_dropout=self.opt.get("relu_dropout", 0.0),
                  dropout=self.opt.get("dropout", 0.0),
                  activation=self.activation,
                  variant=self.variant,
              )  # type: ignore
          )
      return layers
  
imports: from __future__ import annotations
  import torch
  from typing import Dict, Optional, Tuple
  import torch.nn
  from parlai.agents.transformer.modules import TransformerDecoder, TransformerGeneratorModel
  from parlai.agents.transformer.transformer import TransformerGeneratorAgent
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  import torch.nn.functional
label_desc: Use image node_id 1 for calling the Decoder obj's underlying member method code with example usage: obj.build_layers() and returns: layers