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 __init__(
      self,
      n_tags: int,
      pretrained_bert: str,
      bert_config_file: Optional[str] = None,
      attention_probs_keep_prob: Optional[float] = None,
      hidden_keep_prob: Optional[float] = None,
      use_crf: bool = False,
      **kwargs,
  ) -> None:
      if pretrained_bert:
          config = AutoConfig.from_pretrained(
              pretrained_bert,
              num_labels=n_tags,
              output_attentions=False,
              output_hidden_states=False,
          )
          model = AutoModelForTokenClassification.from_pretrained(
              pretrained_bert, config=config
          )
      elif bert_config_file and Path(bert_config_file).is_file():
          bert_config = AutoConfig.from_json_file(
              str(expand_path(bert_config_file))
          )
  
          if attention_probs_keep_prob is not None:
              bert_config.attention_probs_dropout_prob = (
                  1.0 - attention_probs_keep_prob
              )
          if hidden_keep_prob is not None:
              bert_config.hidden_dropout_prob = 1.0 - hidden_keep_prob
          model = AutoModelForTokenClassification(config=bert_config)
      else:
          raise ConfigError("No pre-trained BERT model is given.")
  
      self.crf = CRF(n_tags) if use_crf else None
  
      super().__init__(model, **kwargs)
  
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 1 to create a new TorchTransformersSequenceTagger object from inherited base classes: TorchModel with example: obj = TorchTransformersSequenceTagger(n_tags, pretrained_bert, bert_config_file, attention_probs_keep_prob, hidden_keep_prob, use_crf)