class_docstr: Style Evaluator. Now, we support metrics `'style'`
      
class_docstr_tok: ["Style","Evaluator",".","Now",",","we","support","metrics","`","'style","'","`"]
docstr: get metrics result
  
  Args:
      generate_corpus: the generated corpus
      reference_corpus: the referenced corpus
  
  Returns:
      dict: a dict of metrics <metric> which record the results according to self.ngrams
docstr_tok: ["get","metrics","result","Args",":","generate_corpus",":","the","generated","corpus","reference_corpus",":","the","referenced","corpus","Returns",":","dict",":","a","dict","of","metrics","<","metric",">","which","record","the","results","according","to","self.ngrams"]
code: def _calc_metrics_info(self, generate_corpus, reference_corpus):
      r"""get metrics result
  
      Args:
          generate_corpus: the generated corpus
          reference_corpus: the referenced corpus
  
      Returns:
          dict: a dict of metrics <metric> which record the results according to self.ngrams
      """
      results = {}
      num = 0
      with torch.no_grad():
          for i in range(
              ceil(len(generate_corpus.text) / self.batch_size)
          ):
              texts = generate_corpus.text[
                  i * self.batch_size : (i + 1) * self.batch_size
              ]
              input_ids = self.tokenizer(
                  texts,
                  max_length=self.max_len,
                  padding=True,
                  truncation=True,
                  return_tensors="pt",
              )["input_ids"].to(self.device)
              logits = self.model(input_ids)
              num += logits.argmax(dim=-1).sum().item()
      results["style"] = num / len(generate_corpus.text) * 100
      return results
  
file_path: TextBox/textbox/evaluator/style_evaluator.py
imports: from .abstract_evaluator import AbstractEvaluator
  import torch
  import torch.nn
  import torch.nn.functional
  from math import ceil
  from transformers import BartTokenizerFast
label_desc: Use image node_id 2 for calling the StyleEvaluator obj's underlying member method code with example usage: obj._calc_metrics_info(generate_corpus, reference_corpus) and returns: results