summaryrefslogtreecommitdiff
path: root/text_recognizer/models/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'text_recognizer/models/base.py')
-rw-r--r--text_recognizer/models/base.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/text_recognizer/models/base.py b/text_recognizer/models/base.py
index f4df3f3..3c1919e 100644
--- a/text_recognizer/models/base.py
+++ b/text_recognizer/models/base.py
@@ -2,7 +2,7 @@
from typing import Any, Dict, List, Union, Tuple, Type
import madgrad
-from omegaconf import OmegaConf
+from omegaconf import DictConfig, OmegaConf
import pytorch_lightning as pl
import torch
from torch import nn
@@ -16,9 +16,9 @@ class LitBaseModel(pl.LightningModule):
def __init__(
self,
network: Type[nn.Module],
- optimizer: Union[OmegaConf, Dict],
- lr_scheduler: Union[OmegaConf, Dict],
- criterion: Union[OmegaConf, Dict],
+ optimizer: Union[DictConfig, Dict],
+ lr_scheduler: Union[DictConfig, Dict],
+ criterion: Union[DictConfig, Dict],
monitor: str = "val_loss",
) -> None:
super().__init__()
@@ -34,7 +34,7 @@ class LitBaseModel(pl.LightningModule):
self.test_acc = torchmetrics.Accuracy()
@staticmethod
- def configure_criterion(criterion: Union[OmegaConf, Dict]) -> Type[nn.Module]:
+ def configure_criterion(criterion: Union[DictConfig, Dict]) -> Type[nn.Module]:
"""Returns a loss functions."""
criterion = OmegaConf.create(criterion)
args = {} or criterion.args