class_docstr: Classifier based on BERT implementation.
docstr: Construct the model.
docstr_tok: ["Construct","the","model","."]
code: def build_model(self):
      """
      Construct the model.
      """
      num_classes = len(self.class_list)
      bert_model = BertModel.from_pretrained(self.pretrained_path)
      if self.classifier_layers is not None:
          prev_dimension = (
              bert_model.embeddings.word_embeddings.weight.size(1)
          )
          layers, dims = self._get_layer_parameters(
              prev_dimension=prev_dimension,
              output_dimension=num_classes,
          )
          decoders = torch.nn.Sequential()
          for l, d in zip(layers, dims):
              decoders.append(self._map_layer(l, d))
          return BertWrapper(
              bert_model=bert_model, classifier_layer=decoders
          )
      return BertWrapper(bert_model=bert_model, output_dim=num_classes)
  
imports: import os
  from collections import deque
  from typing import Optional
  import torch
  from parlai.agents.bert_ranker.bert_dictionary import BertDictionaryAgent
  from parlai.agents.bert_ranker.helpers import BertWrapper, MODEL_PATH
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from parlai.core.torch_agent import History
  from parlai.core.torch_classifier_agent import TorchClassifierAgent
  from parlai.utils.io import PathManager
  from parlai.utils.misc import warn_once
  from parlai.zoo.bert.build import download
label_desc: Use image node_id 8 for calling the BertClassifierAgent obj's underlying member method code with example usage: obj.build_model() and returns: BertWrapper, BertWrapper