def quick_save(self, model, save_name, optimizer=None): save_path = os.path.join(self.save_dir, save_name + '_weights.pth') if optimizer: opt_weights = optimizer.get_weights() np.save(os.path.join(self.save_dir, save_name + '_opt_weights'), opt_weights) model.save_weights(save_path, save_format='h5')