summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--text_recognizer/models/vqgan.py1
-rw-r--r--text_recognizer/models/vqvae.py10
2 files changed, 0 insertions, 11 deletions
diff --git a/text_recognizer/models/vqgan.py b/text_recognizer/models/vqgan.py
index 30b46a7..6e4d3fb 100644
--- a/text_recognizer/models/vqgan.py
+++ b/text_recognizer/models/vqgan.py
@@ -24,7 +24,6 @@ class VQGANLitModel(BaseLitModel):
) -> Tensor:
"""Training step."""
data, _ = batch
-
reconstructions, commitment_loss = self(data)
if optimizer_idx == 0:
diff --git a/text_recognizer/models/vqvae.py b/text_recognizer/models/vqvae.py
index 92f28ad..4898852 100644
--- a/text_recognizer/models/vqvae.py
+++ b/text_recognizer/models/vqvae.py
@@ -20,12 +20,9 @@ class VQVAELitModel(BaseLitModel):
def training_step(self, batch: Tuple[Tensor, Tensor], batch_idx: int) -> Tensor:
"""Training step."""
data, _ = batch
-
reconstructions, commitment_loss = self(data)
-
loss = self.loss_fn(reconstructions, data)
loss = loss + self.commitment * commitment_loss
-
self.log("train/commitment_loss", commitment_loss)
self.log("train/loss", loss)
return loss
@@ -33,23 +30,16 @@ class VQVAELitModel(BaseLitModel):
def validation_step(self, batch: Tuple[Tensor, Tensor], batch_idx: int) -> None:
"""Validation step."""
data, _ = batch
-
reconstructions, commitment_loss = self(data)
-
loss = self.loss_fn(reconstructions, data)
- loss = loss + self.commitment * commitment_loss
-
self.log("val/commitment_loss", commitment_loss)
self.log("val/loss", loss, prog_bar=True)
def test_step(self, batch: Tuple[Tensor, Tensor], batch_idx: int) -> None:
"""Test step."""
data, _ = batch
-
reconstructions, commitment_loss = self(data)
-
loss = self.loss_fn(reconstructions, data)
loss = loss + self.commitment * commitment_loss
-
self.log("test/commitment_loss", commitment_loss)
self.log("test/loss", loss)