class_docstr: The `UserTokenizer` class is required to be defined when a non-default model is used.
  
  The user's defined tokenizer is expected to return either token IDs or token embeddings that are fed into the model.
  The tokenizer vocabulary should contain some special tokens, such as a `<pad>` token so that a tokenization will run
  successfully in batches.
class_docstr_tok: ["The","`","UserTokenizer","`","class","is","required","to","be","defined","when","a","non-default","model","is","used",".","The","user","'s","defined","tokenizer","is","expected","to","return","either","token","IDs","or","token","embeddings","that","are","fed","into","the","model",".","The","tokenizer","vocabulary","should","contain","some","special","tokens",",","such","as","a","`","<","pad",">","`","token","so","that","a","tokenization","will","run","successfully","in","batches","."]
docstr: Call method to tokenize user input.
  
  The `__call__` method must be defined for this class. To ensure the functionality, the `__call__` method
  should obey the input/output arguments structure described below.
  
  Args:
      sentences:
          Input text. `Union[str, List[str]]`
      max_len:
          Maximum length of pre-processed text. `int`
  
  Return:
      Python dictionary containing the keys `input_ids` and `attention_mask` with corresponding values.
docstr_tok: ["Call","method","to","tokenize","user","input",".","The","`","__call__","`","method","must","be","defined","for","this","class",".","To","ensure","the","functionality",",","the","`","__call__","`","method","should","obey","the","input\/output","arguments","structure","described","below",".","Args",":","sentences",":","Input","text",".","`","Union","[","str",",","List","[","str","]","]","`","max_len",":","Maximum","length","of","pre-processed","text",".","`","int","`","Return",":","Python","dictionary","containing","the","keys","`","input_ids","`","and","`","attention_mask","`","with","corresponding","values","."]
code: def __call__(
      self, sentences: Union[str, List[str]], max_len: int = _MAX_LEN
  ) -> Dict[str, Tensor]:
      """Call method to tokenize user input.
  
      The `__call__` method must be defined for this class. To ensure the functionality, the `__call__` method
      should obey the input/output arguments structure described below.
  
      Args:
          sentences:
              Input text. `Union[str, List[str]]`
          max_len:
              Maximum length of pre-processed text. `int`
  
      Return:
          Python dictionary containing the keys `input_ids` and `attention_mask` with corresponding values.
  
      """
      output_dict: Dict[str, Tensor] = {}
      if isinstance(sentences, str):
          sentences = [sentences]
      # Add special tokens
      sentences = [
          " ".join([self.CLS_TOKEN, sentence, self.SEP_TOKEN])
          for sentence in sentences
      ]
      # Tokennize sentence
      tokenized_sentences = [
          sentence.lower().split()[:max_len]
          + [self.PAD_TOKEN] * (max_len - len(sentence.lower().split()))
          for sentence in sentences
      ]
      output_dict["input_ids"] = torch.cat(
          [
              torch.cat(
                  [self.word2vec[word] for word in sentence]
              ).unsqueeze(0)
              for sentence in tokenized_sentences
          ]
      )
      output_dict["attention_mask"] = torch.cat(
          [
              torch.tensor(
                  [
                      1 if word != self.PAD_TOKEN else 0
                      for word in sentence
                  ]
              ).unsqueeze(0)
              for sentence in tokenized_sentences
          ]
      ).long()
  
      return output_dict
  
file_path: torchmetrics/examples/bert_score-own_model.py
imports: from pprint import pprint
  from typing import Dict, List, Union
  import torch
  from torch import Tensor, nn
  from torch.nn import Module
  from torchmetrics.text.bert import BERTScore
label_desc: Use image node_id 2 for calling the UserTokenizer obj's underlying member method code with example usage: obj.__call__(sentences, max_len) and returns: output_dict