docstr: Initializes BERT Joint Intent and Slot model.
  
  Args: 
      cfg: configuration object
      trainer: trainer for Pytorch Lightning
docstr_tok: ["Initializes","BERT","Joint","Intent","and","Slot","model",".","Args",":","cfg",":","configuration","object","trainer",":","trainer","for","Pytorch","Lightning"]
code: def __init__(self, cfg: DictConfig, trainer: Trainer = None):
      """
      Initializes BERT Joint Intent and Slot model.
  
      Args:
          cfg: configuration object
          trainer: trainer for Pytorch Lightning
      """
      self.max_seq_length = cfg.language_model.max_seq_length
  
      # Optimal Threshold
      self.threshold = 0.5
      self.max_f1 = 0
  
      # Check the presence of data_dir.
      if not cfg.data_dir or not os.path.exists(cfg.data_dir):
          # Set default values of data_desc.
          self._set_defaults_data_desc(cfg)
      else:
          self.data_dir = cfg.data_dir
          # Update configuration of data_desc.
          self._set_data_desc_to_cfg(
              cfg, cfg.data_dir, cfg.train_ds, cfg.validation_ds
          )
  
      # init superclass
      super().__init__(cfg=cfg, trainer=trainer)
  
      # Initialize Classifier.
      self._reconfigure_classifier()
  
imports: import os
  from typing import List, Optional, Tuple
  import numpy
  import numpy.typing
  import torch
  from omegaconf import DictConfig, OmegaConf
  from pytorch_lightning import Trainer
  from sklearn.metrics import f1_score, precision_score, recall_score
  from torch.utils.data import DataLoader
  from nemo.collections.common.losses import AggregatorLoss, BCEWithLogitsLoss, CrossEntropyLoss
  from nemo.collections.nlp.data.intent_slot_classification import MultiLabelIntentSlotClassificationDataset, MultiLabelIntentSlotDataDesc
  from nemo.collections.nlp.metrics.classification_report import ClassificationReport, MultiLabelClassificationReport
  from nemo.collections.nlp.models.intent_slot_classification import IntentSlotClassificationModel
  from nemo.collections.nlp.modules.common import SequenceTokenClassifier
  from nemo.collections.nlp.parts.utils_funcs import tensor2list
  from nemo.core.classes.common import PretrainedModelInfo
  from nemo.utils import logging
label_desc: Use image node_id 1 to create a new MultiLabelIntentSlotClassificationModel object from inherited base classes: IntentSlotClassificationModel with example: obj = MultiLabelIntentSlotClassificationModel(cfg, trainer)