code: def _test_restore_with_val_losses(
      self, checkpointer, val_losses, best_epoch
  ):
      generator = some_data_generator(BestModelRestoreTest.batch_size)
  
      best_epoch_weights = None
      checkpointer.set_params({"epochs": len(val_losses), "steps": 1})
      checkpointer.set_model(self.model)
      checkpointer.on_train_begin({})
      for epoch, val_loss in enumerate(val_losses, 1):
          checkpointer.on_epoch_begin(epoch, {})
          checkpointer.on_train_batch_begin(1, {})
          loss = self._update_model(generator)
          checkpointer.on_train_batch_end(
              1,
              {
                  "batch": 1,
                  "size": BestModelRestoreTest.batch_size,
                  "loss": loss,
              },
          )
          checkpointer.on_epoch_end(
              epoch,
              {"epoch": epoch, "loss": loss, "val_loss": val_loss},
          )
          if epoch == best_epoch:
              best_epoch_weights = torch_to_numpy(
                  self.model.get_weight_copies()
              )
      checkpointer.on_train_end({})
  
      final_weights = torch_to_numpy(self.model.get_weight_copies())
      self.assertEqual(best_epoch_weights, final_weights)
  
file_path: poutyne/tests/framework/callbacks/test_best_model_restore.py
imports: import unittest
  from unittest import TestCase
  import torch
  import torch.nn
  from poutyne import BestModelRestore, Model, torch_to_numpy
  from tests.framework.tools import some_data_generator
label_desc: Use image node_id 7 for calling the BestModelRestoreTest obj's underlying member method code with example usage: obj._test_restore_with_val_losses(checkpointer, val_losses, best_epoch) without return types