diff --git a/code2seq/model/code2class.py b/code2seq/model/code2class.py index 58910cd..43ea542 100644 --- a/code2seq/model/code2class.py +++ b/code2seq/model/code2class.py @@ -84,6 +84,7 @@ def _shared_epoch_end(self, outputs: EPOCH_OUTPUT, step: str): mean_loss = torch.stack([out[f"{step}/loss"] for out in outputs]).mean() accuracy = self.__metrics[f"{step}_acc"].compute() log = {f"{step}/loss": mean_loss, f"{step}/accuracy": accuracy} + self.__metrics[f"{step}_acc"].reset() self.log_dict(log, on_step=False, on_epoch=True) def training_epoch_end(self, outputs: EPOCH_OUTPUT): diff --git a/code2seq/model/code2seq.py b/code2seq/model/code2seq.py index 3e550db..8c7b0ad 100644 --- a/code2seq/model/code2seq.py +++ b/code2seq/model/code2seq.py @@ -140,6 +140,7 @@ def _shared_epoch_end(self, step_outputs: EPOCH_OUTPUT, step: str): f"{step}/precision": metric.precision, f"{step}/recall": metric.recall, } + self.__metrics[f"{step}_f1"].reset() self.log_dict(log, on_step=False, on_epoch=True) def training_epoch_end(self, step_outputs: EPOCH_OUTPUT): diff --git a/setup.py b/setup.py index 1023b4e..fb224f6 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = "1.0.2" +VERSION = "1.0.3" with open("README.md") as readme_file: readme = readme_file.read()