class_docstr: Transformer-based model on PyTorch for text tagging. It predicts a label for every token (not subtoken)
  in the text. You can use it for sequence labeling tasks, such as morphological tagging or named entity recognition.
  
  Args:
      n_tags: number of distinct tags
      pretrained_bert: pretrained Bert checkpoint path or key title (e.g. "bert-base-uncased")
      bert_config_file: path to Bert configuration file, or None, if `pretrained_bert` is a string name
      attention_probs_keep_prob: keep_prob for Bert self-attention layers
      hidden_keep_prob: keep_prob for Bert hidden layers
      use_crf: whether to use Conditional Ramdom Field to decode tags
class_docstr_tok: ["Transformer-based","model","on","PyTorch","for","text","tagging",".","It","predicts","a","label","for","every","token","(","not","subtoken",")","in","the","text",".","You","can","use","it","for","sequence","labeling","tasks",",","such","as","morphological","tagging","or","named","entity","recognition",".","Args",":","n_tags",":","number","of","distinct","tags","pretrained_bert",":","pretrained","Bert","checkpoint","path","or","key","title","(","e.g",".","``","bert-base-uncased","''",")","bert_config_file",":","path","to","Bert","configuration","file",",","or","None",",","if","`","pretrained_bert","`","is","a","string","name","attention_probs_keep_prob",":","keep_prob","for","Bert","self-attention","layers","hidden_keep_prob",":","keep_prob","for","Bert","hidden","layers","use_crf",":","whether","to","use","Conditional","Ramdom","Field","to","decode","tags"]
code: def load(self, fname=None):
      super().load(fname)
      if self.crf is not None:
          self.crf = self.crf.to(self.device)
          if self.load_path:
              weights_path_crf = Path(f"{self.load_path}_crf").resolve()
              weights_path_crf = weights_path_crf.with_suffix(
                  ".pth.tar"
              )
              if weights_path_crf.exists():
                  checkpoint = torch.load(
                      weights_path_crf, map_location=self.device
                  )
                  self.crf.load_state_dict(
                      checkpoint["model_state_dict"], strict=False
                  )
              else:
                  log.warning(
                      f"Init from scratch. Load path {weights_path_crf} does not exist."
                  )
  
file_path: DeepPavlov/deeppavlov/models/torch_bert/torch_transformers_sequence_tagger.py
imports: from logging import getLogger
  from pathlib import Path
  from typing import List, Union, Dict, Optional, Tuple
  import numpy
  import torch
  from transformers import AutoModelForTokenClassification, AutoConfig
  from deeppavlov.core.commands.utils import expand_path
  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.crf import CRF
label_desc: Use image node_id 4 for calling the TorchTransformersSequenceTagger obj's underlying member method code with example usage: obj.load(fname) without return types