From fe43389ad26559cc09f2fd00441c02556ff674c3 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Sun, 21 Nov 2021 21:35:50 +0100 Subject: Format files --- text_recognizer/models/base.py | 1 + text_recognizer/models/transformer.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'text_recognizer/models') diff --git a/text_recognizer/models/base.py b/text_recognizer/models/base.py index cc54de4..821cb69 100644 --- a/text_recognizer/models/base.py +++ b/text_recognizer/models/base.py @@ -46,6 +46,7 @@ class BaseLitModel(LightningModule): optimizer: Type[torch.optim.Optimizer], optimizer_idx: int, ) -> None: + """Optimal way to set grads to zero.""" optimizer.zero_grad(set_to_none=True) def _configure_optimizer(self) -> List[Type[torch.optim.Optimizer]]: diff --git a/text_recognizer/models/transformer.py b/text_recognizer/models/transformer.py index d8cb665..369361b 100644 --- a/text_recognizer/models/transformer.py +++ b/text_recognizer/models/transformer.py @@ -60,8 +60,8 @@ class TransformerLitModel(BaseLitModel): # pred = self(data) # self.val_cer(pred, targets) # self.log("val/cer", self.val_cer, on_step=False, on_epoch=True, prog_bar=True) - # self.test_acc(pred, targets) - # self.log("val/acc", self.test_acc, on_step=False, on_epoch=True) + # self.val_acc(pred, targets) + # self.log("val/acc", self.val_acc, on_step=False, on_epoch=True) def test_step(self, batch: Tuple[Tensor, Tensor], batch_idx: int) -> None: """Test step.""" -- cgit v1.2.3-70-g09d2