def backup_models(self, i):
    'Save the current best models.\n\n        Save CER model, the best loss model and the best WER model. This occurs\n        at a specified period.\n\n        Args:\n            i: no. of iterations.\n        '
    self.worker_trainer.save(model_path=self.model_path, token='latest', config=self.config['server_config'])
    if ((i % self.model_backup_freq) == 0):
        self.worker_trainer.save(model_path=self.model_path, token='epoch{}'.format(i), config=self.config['server_config'])
        for bodyname in ['best_val_acc', 'best_val_loss', 'best_test_acc']:
            src_model_path = os.path.join(self.model_path, '{}_model.tar'.format(bodyname))
            if os.path.exists(src_model_path):
                dst_model_path = os.path.join(self.model_path, 'epoch{}_{}_model.tar'.format(i, bodyname))
                shutil.copyfile(src_model_path, dst_model_path)
                print_rank('Saved {}'.format(dst_model_path))
Save the current best models.

Save CER model, the best loss model and the best WER model. This occurs
at a specified period.

Args:
    i: no. of iterations.
def backup_models(self, i):
    'Save the current best models.\n\n        Save CER model, the best loss model and the best WER model. This occurs\n        at a specified period.\n\n        Args:\n            i: no. of iterations.\n        '
    self.worker_trainer.save(model_path=self.model_path, token='latest', config=self.config['server_config'])
    if ((i % self.model_backup_freq) == 0):
        self.worker_trainer.save(model_path=self.model_path, token='epoch{}'.format(i), config=self.config['server_config'])
        for bodyname in ['best_val_acc', 'best_val_loss', 'best_test_acc']:
            src_model_path = os.path.join(self.model_path, '{}_model.tar'.format(bodyname))
            if os.path.exists(src_model_path):
                dst_model_path = os.path.join(self.model_path, 'epoch{}_{}_model.tar'.format(i, bodyname))
                shutil.copyfile(src_model_path, dst_model_path)
                print_rank('Saved {}'.format(dst_model_path))