From 096f3d14078875d19feec02d89a244a01d901b33 Mon Sep 17 00:00:00 2001 From: "Shin, Eunwoo" Date: Wed, 24 Jul 2024 13:08:50 +0900 Subject: [PATCH] change input_size type to Any to solve omegaconf issue --- src/otx/core/config/data.py | 4 +++- src/otx/core/data/transform_libs/torchvision.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/otx/core/config/data.py b/src/otx/core/config/data.py index 1905df6ac4f..6ddc24f63c2 100644 --- a/src/otx/core/config/data.py +++ b/src/otx/core/config/data.py @@ -60,7 +60,9 @@ class SubsetConfig: num_workers: int = 2 sampler: SamplerConfig = field(default_factory=lambda: SamplerConfig()) to_tv_image: bool = True - input_size: int | tuple[int, int] | None = None + input_size: ( + Any + ) = None # type is `int | tuple[int, int] | None` TODO (eunwoosh): Revisit after error above is solved @dataclass diff --git a/src/otx/core/data/transform_libs/torchvision.py b/src/otx/core/data/transform_libs/torchvision.py index cd76aa53790..eb5a20910b5 100644 --- a/src/otx/core/data/transform_libs/torchvision.py +++ b/src/otx/core/data/transform_libs/torchvision.py @@ -3168,7 +3168,9 @@ def check_type(value: Any, expected_type: Any) -> bool: # noqa: ANN401 val.replace("$(input_size)", str(_input_size)), ) elif check_type(_input_size[0], available_types): # pass int - cfg_transform["init_args"][key] = cls._eval_input_size_str(val.replace("$(input_size)", str(_input_size[0]))) + cfg_transform["init_args"][key] = cls._eval_input_size_str( + val.replace("$(input_size)", str(_input_size[0])), + ) else: msg = f"{key} argument should be able to get int or tuple[int, int], but it can get {available_types}" raise RuntimeError(msg)