def __init__(self, caption_model: str, epochs: int, device: torch.device, word_map: Dict[(str, int)], rev_word_map: Dict[(int, str)], start_epoch: int, epochs_since_improvement: int, best_bleu4: float, train_loader: DataLoader, val_loader: DataLoader, encoder: nn.Module, decoder: nn.Module, encoder_optimizer: optim.Optimizer, decoder_optimizer: optim.Optimizer, loss_function: nn.Module, grad_clip: float, tau: float, fine_tune_encoder: bool, tensorboard: bool=False, log_dir: Optional[str]=None) -> None:
    self.device = device
    self.caption_model = caption_model
    self.epochs = epochs
    self.word_map = word_map
    self.rev_word_map = rev_word_map
    self.start_epoch = start_epoch
    self.epochs_since_improvement = epochs_since_improvement
    self.best_bleu4 = best_bleu4
    self.train_loader = train_loader
    self.val_loader = val_loader
    self.encoder = encoder
    self.decoder = decoder
    self.encoder_optimizer = encoder_optimizer
    self.decoder_optimizer = decoder_optimizer
    self.loss_function = loss_function
    self.tau = tau
    self.grad_clip = grad_clip
    self.fine_tune_encoder = fine_tune_encoder
    self.print_freq = 100
    self.writer = TensorboardWriter(log_dir, tensorboard)
    self.len_epoch = len(self.train_loader)
def __init__(self, caption_model: str, epochs: int, device: torch.device, word_map: Dict[(str, int)], rev_word_map: Dict[(int, str)], start_epoch: int, epochs_since_improvement: int, best_bleu4: float, train_loader: DataLoader, val_loader: DataLoader, encoder: nn.Module, decoder: nn.Module, encoder_optimizer: optim.Optimizer, decoder_optimizer: optim.Optimizer, loss_function: nn.Module, grad_clip: float, tau: float, fine_tune_encoder: bool, tensorboard: bool=False, log_dir: Optional[str]=None) -> None:
    self.device = device
    self.caption_model = caption_model
    self.epochs = epochs
    self.word_map = word_map
    self.rev_word_map = rev_word_map
    self.start_epoch = start_epoch
    self.epochs_since_improvement = epochs_since_improvement
    self.best_bleu4 = best_bleu4
    self.train_loader = train_loader
    self.val_loader = val_loader
    self.encoder = encoder
    self.decoder = decoder
    self.encoder_optimizer = encoder_optimizer
    self.decoder_optimizer = decoder_optimizer
    self.loss_function = loss_function
    self.tau = tau
    self.grad_clip = grad_clip
    self.fine_tune_encoder = fine_tune_encoder
    self.print_freq = 100
    self.writer = TensorboardWriter(log_dir, tensorboard)
    self.len_epoch = len(self.train_loader)