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"]
docstr: Predicts tag indices for a given subword tokens batch
  
  Args:
      input_ids: indices of the subwords
      input_masks: mask that determines where to attend and where not to
      y_masks: mask which determines the first subword units in the the word
  
  Returns:
      Label indices or class probabilities for each token (not subtoken)
docstr_tok: ["Predicts","tag","indices","for","a","given","subword","tokens","batch","Args",":","input_ids",":","indices","of","the","subwords","input_masks",":","mask","that","determines","where","to","attend","and","where","not","to","y_masks",":","mask","which","determines","the","first","subword","units","in","the","the","word","Returns",":","Label","indices","or","class","probabilities","for","each","token","(","not","subtoken",")"]
code: def __call__(
      self,
      input_ids: Union[List[List[int]], np.ndarray],
      input_masks: Union[List[List[int]], np.ndarray],
      y_masks: Union[List[List[int]], np.ndarray],
  ) -> Tuple[List[List[int]], List[np.ndarray]]:
      """Predicts tag indices for a given subword tokens batch
  
      Args:
          input_ids: indices of the subwords
          input_masks: mask that determines where to attend and where not to
          y_masks: mask which determines the first subword units in the the word
  
      Returns:
          Label indices or class probabilities for each token (not subtoken)
  
      """
      b_input_ids = torch.from_numpy(input_ids).to(self.device)
      b_input_masks = torch.from_numpy(input_masks).to(self.device)
  
      with torch.no_grad():
          # Forward pass, calculate logit predictions
          logits = self.model(b_input_ids, attention_mask=b_input_masks)
  
          # Move logits and labels to CPU and to numpy arrays
          logits = token_from_subtoken(
              logits[0].detach().cpu(), torch.from_numpy(y_masks)
          )
  
      probas = torch.nn.functional.softmax(logits, dim=-1)
      probas = probas.detach().cpu().numpy()
      if self.crf is not None:
          logits = logits.transpose(1, 0).to(self.device)
          pred = self.crf.decode(logits)
      else:
          logits = logits.detach().cpu().numpy()
          pred = np.argmax(logits, axis=-1)
      seq_lengths = np.sum(y_masks, axis=1)
      pred = [p[:l] for l, p in zip(seq_lengths, pred)]
  
      return pred, probas
  
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 3 for calling the TorchTransformersSequenceTagger obj's underlying member method code with example usage: obj.__call__(input_ids, input_masks, y_masks) and returns: pred,  probas