code: def test_checkpoint_saving_during_training(
      self, vae, trainer, training_configs
  ):
      #
      target_saving_epoch = training_configs.steps_saving
  
      dir_path = training_configs.output_dir
  
      model = deepcopy(trainer.model)
  
      trainer.train()
  
      training_dir = os.path.join(
          dir_path, f"VAE_LinNF_training_{trainer._training_signature}"
      )
      assert os.path.isdir(training_dir)
  
      checkpoint_dir = os.path.join(
          training_dir, f"checkpoint_epoch_{target_saving_epoch}"
      )
  
      assert os.path.isdir(checkpoint_dir)
  
      files_list = os.listdir(checkpoint_dir)
  
      # check files
      assert set(
          ["model.pt", "optimizer.pt", "training_config.json"]
      ).issubset(set(files_list))
  
      # check pickled custom decoder
      if not vae.model_config.uses_default_decoder:
          assert "decoder.pkl" in files_list
  
      else:
          assert not "decoder.pkl" in files_list
  
      # check pickled custom encoder
      if not vae.model_config.uses_default_encoder:
          assert "encoder.pkl" in files_list
  
      else:
          assert not "encoder.pkl" in files_list
  
      model_rec_state_dict = torch.load(
          os.path.join(checkpoint_dir, "model.pt")
      )["model_state_dict"]
  
      assert not all(
          [
              torch.equal(
                  model_rec_state_dict[key], model.state_dict()[key]
              )
              for key in model.state_dict().keys()
          ]
      )
  
imports: import os
  from copy import deepcopy
  import pytest
  import torch
  from pydantic import ValidationError
  from pythae.customexception import BadInheritanceError
  from pythae.models import AutoModel, VAE_LinNF, VAE_LinNF_Config
  from pythae.models.base.base_utils import ModelOutput
  from pythae.pipelines import GenerationPipeline, TrainingPipeline
  from pythae.samplers import GaussianMixtureSamplerConfig, IAFSamplerConfig, MAFSamplerConfig, NormalSamplerConfig, TwoStageVAESamplerConfig
  from pythae.trainers import BaseTrainer, BaseTrainerConfig
  from tests.data.custom_architectures import Decoder_AE_Conv, Encoder_VAE_Conv, NetBadInheritance
label_desc: Use image node_id 10 for calling the Test_VAE_Training obj's underlying member method code with example usage: obj.test_checkpoint_saving_during_training(vae, trainer, training_configs) without return types