code: def _test_checkpointer(self, checkpointer):
      optimizer_states = {}
      generator = some_data_generator(
          OptimizerCheckpointTest.batch_size
      )
  
      checkpointer.set_params(
          {"epochs": OptimizerCheckpointTest.epochs, "steps": 1}
      )
      checkpointer.set_model(self.model)
      checkpointer.on_train_begin({})
      for epoch in range(1, OptimizerCheckpointTest.epochs + 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": OptimizerCheckpointTest.batch_size,
                  "loss": loss,
              },
          )
          checkpointer.on_epoch_end(
              epoch, {"epoch": epoch, "loss": loss, "val_loss": 1}
          )
          filename = self.checkpoint_filename.format(epoch=epoch)
          self.assertTrue(os.path.isfile(filename))
          optimizer_states[epoch] = torch_to_numpy(
              self.optimizer.state_dict(), copy=True
          )
      checkpointer.on_train_end({})
  
      self._test_checkpoint(optimizer_states)
  
file_path: poutyne/tests/framework/callbacks/test_optimizer_checkpoint.py
imports: import os
  import unittest
  from tempfile import TemporaryDirectory
  from unittest import TestCase
  import torch
  import torch.nn
  from poutyne import Model, OptimizerCheckpoint, torch_to_numpy
  from tests.framework.tools import some_data_generator
label_desc: Use image node_id 5 for calling the OptimizerCheckpointTest obj's underlying member method code with example usage: obj._test_checkpointer(checkpointer) without return types