def run_train(self) -> None:
    for epoch in range(self.start_epoch, self.epochs):
        if (self.epochs_since_improvement == 20):
            break
        if ((self.epochs_since_improvement > 0) and ((self.epochs_since_improvement % 8) == 0)):
            adjust_learning_rate(self.decoder_optimizer, 0.8)
            if self.fine_tune_encoder:
                adjust_learning_rate(self.encoder_optimizer, 0.8)
        self.train(epoch=epoch)
        recent_bleu4 = self.validate()
        is_best = (recent_bleu4 > self.best_bleu4)
        self.best_bleu4 = max(recent_bleu4, self.best_bleu4)
        if (not is_best):
            self.epochs_since_improvement += 1
            print(('\nEpochs since last improvement: %d\n' % (self.epochs_since_improvement,)))
        else:
            self.epochs_since_improvement = 0
        save_checkpoint(epoch=epoch, epochs_since_improvement=self.epochs_since_improvement, encoder=self.encoder, decoder=self.decoder, encoder_optimizer=self.encoder_optimizer, decoder_optimizer=self.decoder_optimizer, caption_model=self.caption_model, bleu4=recent_bleu4, is_best=is_best)
def run_train(self) -> None:
    for epoch in range(self.start_epoch, self.epochs):
        if (self.epochs_since_improvement == 20):
            break
        if ((self.epochs_since_improvement > 0) and ((self.epochs_since_improvement % 8) == 0)):
            adjust_learning_rate(self.decoder_optimizer, 0.8)
            if self.fine_tune_encoder:
                adjust_learning_rate(self.encoder_optimizer, 0.8)
        self.train(epoch=epoch)
        recent_bleu4 = self.validate()
        is_best = (recent_bleu4 > self.best_bleu4)
        self.best_bleu4 = max(recent_bleu4, self.best_bleu4)
        if (not is_best):
            self.epochs_since_improvement += 1
            print(('\nEpochs since last improvement: %d\n' % (self.epochs_since_improvement,)))
        else:
            self.epochs_since_improvement = 0
        save_checkpoint(epoch=epoch, epochs_since_improvement=self.epochs_since_improvement, encoder=self.encoder, decoder=self.decoder, encoder_optimizer=self.encoder_optimizer, decoder_optimizer=self.decoder_optimizer, caption_model=self.caption_model, bleu4=recent_bleu4, is_best=is_best)