class_docstr: A model wrapper queries a model with a list of text inputs.
  
  Classification-based models return a list of lists, where each sublist
  represents the model's scores for a given input.
  
  Text-to-text models return a list of strings, where each string is the
  output – like a translation or summarization – for a given input.
class_docstr_tok: ["A","model","wrapper","queries","a","model","with","a","list","of","text","inputs",".","Classification-based","models","return","a","list","of","lists",",","where","each","sublist","represents","the","model","'s","scores","for","a","given","input",".","Text-to-text","models","return","a","list","of","strings",",","where","each","string","is","the","output","\u2013","like","a","translation","or","summarization","\u2013","for","a","given","input","."]
docstr: :param list[Sample] data_samples: list of Samples
  :param str prefix: name prefix to add to metrics
  :return: dict obj to save metrics result
docstr_tok: [":","param","list","[","Sample","]","data_samples",":","list","of","Samples",":","param","str","prefix",":","name","prefix","to","add","to","metrics",":","return",":","dict","obj","to","save","metrics","result"]
code: def evaluate(self, data_samples, prefix=""):
      r"""
      :param list[Sample] data_samples: list of Samples
      :param str prefix: name prefix to add to metrics
      :return: dict obj to save metrics result
  
      """
      outputs = []
      labels = []
      i = 0
  
      while i < len(data_samples):
          batch_samples = data_samples[i : i + self.batch_size]
          batch_inputs, batch_labels = self.unzip_samples(batch_samples)
          labels += batch_labels
          predicts = self.__call__(*batch_inputs)
  
          if self.task in CLASSIFICATION_TASKS:
              predicts = np.argmax(predicts, axis=-1)
          outputs += predicts.tolist()
          i += self.batch_size
  
      metrics_rst = {}
      for Metric in TASK_METRICS[self.task]:
          metrics_rst[prefix + Metric["name"]] = Metric["fun"](
              outputs, np.array(labels)
          )
  
      return metrics_rst
  
file_path: textflint/textflint/input/model/flint_model/flint_model.py
imports: from abc import ABC
  import numpy
  from ..metrics.metrics import accuracy_score
  from ..metrics.metrics import POSMetric
  from ..metrics.nerspanmetric import NERSpanMetric
label_desc: Use image node_id 2 for calling the FlintModel obj's underlying member method code with example usage: obj.evaluate(data_samples, prefix) and returns: metrics_rst