AttributeError: 'EvalPrediction' object has no attribute 'prediction' // Training MiniLM
I am a beginner trying to train Minilm using Hugging FaceI have followed this tutorial:Simple Training with the 🤗 Transformers Trainer - YouTubeMy Dataset:DatasetDict({train: Dataset({features: [‘tec_name’, ‘label’, ‘sentence’],num_rows: 10356})validation: Dataset({features: [‘tec_name’, ‘label’, ‘sentence’],num_rows: 1295})test: Dataset({features: [‘tec_name’, ‘label’, ‘sentence’],num_rows: 1294})})Codes:image2560×835 101 KBfrom transformers import TrainingArgumentsbatch_size = 64logging_steps = len(ds[“train”])output_dir1=“minilm-finetuned_1”training_args = TrainingArguments(output_dir=output_dir1,num_train_epochs=5,learning_rate=2e-5,per_device_train_batch_size=batch_size,per_device_eval_batch_size=batch_size,weight_decay=0.01,evaluation_strategy=“epoch”,push_to_hub=True)trainer = WeightedLossTrainer(model=model,args=training_args,compute_metrics=compute_metrics,train_dataset=ds[“train”],eval_dataset=ds[“validation”],tokenizer=tokenizer)trainer.train()However an error was returned when I trained the model which showed the following:/usr/local/lib/python3.10/dist-packages/transformers/optimization.py:407: FutureWarning: This implementation of AdamW is deprecated and will be removed in a future version. Use the PyTorch implementation torch.optim.AdamW instead, or setno_deprecation_warning=Trueto disable this warningwarnings.warn([501/810 00:58 < 00:36, 8.47 it/s, Epoch 3.09/5]Step	Training Loss	Validation Loss[21/21 00:00]╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮│ in <cell line: 1>:1                                                                              ││                                                                                                  ││ /usr/local/lib/python3.10/dist-packages/transformers/trainer.py:1664 in train                    ││                                                                                                  ││   1661 │   │   inner_training_loop = find_executable_batch_size(                                 ││   1662 │   │   │   self._inner_training_loop, self._train_batch_size, args.auto_find_batch_size  ││   1663 │   │   )                                                                                 ││ ❱ 1664 │   │   return inner_training_loop(                                                       ││   1665 │   │   │   args=args,                                                                    ││   1666 │   │   │   resume_from_checkpoint=resume_from_checkpoint,                                ││   1667 │   │   │   trial=trial,                                                                  ││                                                                                                  ││ /usr/local/lib/python3.10/dist-packages/transformers/trainer.py:2019 in _inner_training_loop     ││                                                                                                  ││   2016 │   │   │   │   │   self.state.epoch = epoch + (step + 1 + steps_skipped) / steps_in_epo  ││   2017 │   │   │   │   │   self.control = self.callback_handler.on_step_end(args, self.state, s  ││   2018 │   │   │   │   │                                                                         ││ ❱ 2019 │   │   │   │   │   self._maybe_log_save_evaluate(tr_loss, model, trial, epoch, ignore_k  ││   2020 │   │   │   │   else:                                                                     ││   2021 │   │   │   │   │   self.control = self.callback_handler.on_substep_end(args, self.state  ││   2022                                                                                           ││                                                                                                  ││ /usr/local/lib/python3.10/dist-packages/transformers/trainer.py:2300 in _maybe_log_save_evaluate ││                                                                                                  ││   2297 │   │   │   │   │   )                                                                     ││   2298 │   │   │   │   │   metrics.update(dataset_metrics)                                       ││   2299 │   │   │   else:                                                                         ││ ❱ 2300 │   │   │   │   metrics = self.evaluate(ignore_keys=ignore_keys_for_eval)                 ││   2301 │   │   │   self._report_to_hp_search(trial, self.state.global_step, metrics)             ││   2302 │   │   │                                                                                 ││   2303 │   │   │   # Run delayed LR scheduler now that metrics are populated                     ││                                                                                                  ││ /usr/local/lib/python3.10/dist-packages/transformers/trainer.py:3029 in evaluate                 ││                                                                                                  ││   3026 │   │   start_time = time.time()                                                          ││   3027 │   │                                                                                     ││   3028 │   │   eval_loop = self.prediction_loop if self.args.use_legacy_prediction_loop else se  ││ ❱ 3029 │   │   output = eval_loop(                                                               ││   3030 │   │   │   eval_dataloader,                                                              ││   3031 │   │   │   description=“Evaluation”,                                                     ││   3032 │   │   │   # No point gathering the predictions if there are no metrics, otherwise we d  ││                                                                                                  ││ /usr/local/lib/python3.10/dist-packages/transformers/trainer.py:3318 in evaluation_loop          ││                                                                                                  ││   3315 │   │   │   │   │   EvalPrediction(predictions=all_preds, label_ids=all_labels, inputs=a  ││   3316 │   │   │   │   )                                                                         ││   3317 │   │   │   else:                                                                         ││ ❱ 3318 │   │   │   │   metrics = self.compute_metrics(EvalPrediction(predictions=all_preds, lab  ││   3319 │   │   else:                                                                             ││   3320 │   │   │   metrics = {}                                                                  ││   3321                                                                                           ││ in compute_metrics:5                                                                             │╰──────────────────────────────────────────────────────────────────────────────────────────────────╯AttributeError: ‘EvalPrediction’ object has no attribute ‘prediction’Any assistance is welcomed. Please Help