class_docstr: BERT model for multiple choice,sequence labeling, ner, classification or regression
  This module is composed of the BERT model with a linear layer on top of
  the pooled output.
  Params:
  task_num_classes
  task_types
  backbone_model - na
class_docstr_tok: ["BERT","model","for","multiple","choice",",","sequence","labeling",",","ner",",","classification","or","regression","This","module","is","composed","of","the","BERT","model","with","a","linear","layer","on","top","of","the","pooled","output",".","Params",":","task_num_classes","task_types","backbone_model","-","na"]
code: def __init__(
      self,
      tasks_num_classes,
      multilabel,
      task_types,
      weights,
      backbone_model="bert_base_uncased",
      dropout=None,
      new_model=False,
      focal=False,
      max_seq_len=320,
      model_takes_token_type_ids=True,
  ):
      super(BertForMultiTask, self).__init__()
      config = AutoConfig.from_pretrained(
          backbone_model,
          output_hidden_states=True,
          output_attentions=True,
      )
      self.bert = AutoModel.from_pretrained(
          pretrained_model_name_or_path=backbone_model, config=config
      )
      self.classes = tasks_num_classes  # classes for every task
      self.weights = weights
      self.multilabel = multilabel
      self.new_model = new_model
      self.model_takes_token_type_ids = model_takes_token_type_ids
      if dropout is not None:
          self.dropout = nn.Dropout(dropout)
      elif hasattr(config, "hidden_dropout_prob"):
          self.dropout = nn.Dropout(config.hidden_dropout_prob)
      elif hasattr(config, "seq_classif_dropout"):
          self.dropout = nn.Dropout(config.seq_classif_dropout)
      elif hasattr(config, "dropout"):
          self.dropout = nn.Dropout(config.dropout)
      else:
          self.dropout = nn.Dropout(0)
      self.max_seq_len = max_seq_len
      self.activation = nn.Tanh()
      self.task_types = task_types
      self.focal = focal
      OUT_DIM = config.hidden_size
      if self.new_model and self.new_model != 2:
          OUT_DIM = OUT_DIM * 2
      self.bert.final_classifier = nn.ModuleList(
          [
              nn.Linear(OUT_DIM, num_labels)
              if self.task_types[i]
              not in ["multiple_choice", "regression", "binary_head"]
              else nn.Linear(OUT_DIM, 1)
              for i, num_labels in enumerate(self.classes)
          ]
      )
      if self.new_model:  # or True:
          self.bert.pooling_layer = nn.Linear(OUT_DIM, OUT_DIM)
      else:
          self.bert.pooler = nn.Linear(OUT_DIM, OUT_DIM)
  
imports: from collections.abc import Iterable
  from logging import getLogger
  from pathlib import Path
  from typing import Dict, Optional
  import numpy
  import torch
  import torch.nn
  from torch.nn import CrossEntropyLoss, MSELoss, BCEWithLogitsLoss
  from transformers import AutoConfig, AutoModel
  from deeppavlov.core.common.errors import ConfigError
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.models.torch_model import TorchModel
  from deeppavlov.models.torch_bert.torch_transformers_sequence_tagger import token_from_subtoken, token_labels_to_subtoken_labels
label_desc: Use image node_id 1 to create a new BertForMultiTask object from inherited base classes: nn with example: obj = BertForMultiTask(tasks_num_classes, multilabel, task_types, weights, backbone_model, dropout, new_model, focal, max_seq_len, model_takes_token_type_ids)