

def    __lowercase (       _A = 1000     )       ->  int:
      SCREAMING_SNAKE_CASE	: str					       =				0
      for i in range(_A     ):
            if i % 3 == 0 or i % 5 == 0:
                  result += i
      return result


if __name__ == "__main__":
  print(F"""{solution() = }""")







import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer, Trainer, TrainingArguments

import datasets


UpperCAmelCase__	:       Tuple			      =      """\
@article{eddine2021frugalscore,
  title={FrugalScore: Learning Cheaper, Lighter and Faster Evaluation Metrics for Automatic Text Generation},
  author={Eddine, Moussa Kamal and Shang, Guokan and Tixier, Antoine J-P and Vazirgiannis, Michalis},
  journal={arXiv preprint arXiv:2110.08559},
  year={2021}
}
"""

UpperCAmelCase__	:       Union[str, Any]			      =      """\
FrugalScore is a reference-based metric for NLG models evaluation. It is based on a distillation approach that allows to learn a fixed, low cost version of any expensive NLG metric, while retaining most of its original performance.
"""


UpperCAmelCase__	:       str			      =      """
Calculates how good are predictions given some references, using certain scores.
Args:
    predictions (list of str): list of predictions to score. Each predictions
        should be a string.
    references (list of str): list of reference for each prediction. Each
        reference should be a string.
    batch_size (int): the batch size for predictions.
    max_length (int): maximum sequence length.
    device (str): either gpu or cpu
Returns:
    scores (list of int): list of scores.
Examples:
    >>> frugalscore = datasets.load_metric(\"frugalscore\")
    >>> results = frugalscore.compute(predictions=['hello there', 'huggingface'], references=['hello world', 'hugging face'])
    >>> print([round(s, 3) for s in results[\"scores\"]])
    [0.631, 0.645]
"""







@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION		,     _KWARGS_DESCRIPTION    )
class     a__    (				datasets.Metric    ):







  """simple docstring"""




  def 	_lowercase (     self      :	Any						)   ->Optional[int]:
        """simple docstring"""







        return datasets.MetricInfo(
            description=_DESCRIPTION			,			citation=_CITATION			,			inputs_description=_KWARGS_DESCRIPTION			,			features=datasets.Features(
                {
                    """predictions""": datasets.Value("""string"""						),
                    """references""": datasets.Value("""string"""						),
                }						)			,			homepage="""https://github.com/moussaKam/FrugalScore"""			,			)


  def 	_lowercase (     self      :	Dict			,			UpperCAmelCase__      :	Tuple						)   ->Any:
        """simple docstring"""







        if self.config_name == "default":
              SCREAMING_SNAKE_CASE	: int					       =				"""moussaKam/frugalscore_tiny_bert-base_bert-score"""
        else:
              SCREAMING_SNAKE_CASE	: Union[str, Any]					       =				self.config_name
        SCREAMING_SNAKE_CASE	: Tuple					       =				AutoModelForSequenceClassification.from_pretrained(UpperCAmelCase__						)
        SCREAMING_SNAKE_CASE	: Tuple					       =				AutoTokenizer.from_pretrained(UpperCAmelCase__						)




  def 	_lowercase (     self      :	Union[str, Any]			,			UpperCAmelCase__      :	str			,			UpperCAmelCase__      :	Optional[Any]			,			UpperCAmelCase__      :	str=3_2			,			UpperCAmelCase__      :	Optional[int]=1_2_8			,			UpperCAmelCase__      :	Optional[int]=None			,			)   ->Any:
        """simple docstring"""







        assert len(UpperCAmelCase__						) == len(
            UpperCAmelCase__						), "predictions and references should have the same number of sentences."
        if device is not None:
              assert device in ["gpu", "cpu"], "device should be either gpu or cpu."
        else:
              SCREAMING_SNAKE_CASE	: List[str]					       =				"""gpu""" if torch.cuda.is_available() else """cpu"""
        SCREAMING_SNAKE_CASE	: Optional[Any]					       =				TrainingArguments(
            """trainer"""			,			fpaa=(device == """gpu""")			,			per_device_eval_batch_size=UpperCAmelCase__			,			report_to="""all"""			,			no_cuda=(device == """cpu""")			,			log_level="""warning"""			,			)
        SCREAMING_SNAKE_CASE	: int					       =				{"""sentence1""": predictions, """sentence2""": references}
        SCREAMING_SNAKE_CASE	: List[str]					       =				datasets.Dataset.from_dict(UpperCAmelCase__						)

        def tokenize_function(UpperCAmelCase__      :	Any						):
              return self.tokenizer(
                  data["""sentence1"""]			,			data["""sentence2"""]			,			max_length=UpperCAmelCase__			,			truncation=UpperCAmelCase__			,			padding=UpperCAmelCase__						)

        SCREAMING_SNAKE_CASE	: Dict					       =				raw_datasets.map(UpperCAmelCase__			,			batched=UpperCAmelCase__						)
        tokenized_datasets.remove_columns(["""sentence1""", """sentence2"""]						)
        SCREAMING_SNAKE_CASE	: Optional[Any]					       =				Trainer(self.model			,			UpperCAmelCase__			,			tokenizer=self.tokenizer						)
        SCREAMING_SNAKE_CASE	: Tuple					       =				trainer.predict(UpperCAmelCase__						)
        return {"scores": list(predictions.predictions.squeeze(-1						)						)}




