Skip to content

Commit

Permalink
change input_size type to Any to solve omegaconf issue
Browse files Browse the repository at this point in the history
  • Loading branch information
eunwoosh committed Jul 24, 2024
1 parent 080932b commit 096f3d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/otx/core/config/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/otx/core/data/transform_libs/torchvision.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 096f3d1

Please sign in to comment.