Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
Signed-off-by: Kim, Vinnam <vinnam.kim@intel.com>
  • Loading branch information
vinnamkim committed May 27, 2024
1 parent 4d13e42 commit 7214bf5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
4 changes: 0 additions & 4 deletions docker/Dockerfile.cuda
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ RUN pip install --user --no-cache-dir --require-hashes --no-deps -r /tmp/require

FROM install_packages AS download_pretrained_weights

USER non-root
WORKDIR ${NON_ROOT_HOME}

COPY docker/download_pretrained_weights.py download_pretrained_weights.py
Expand All @@ -76,6 +75,3 @@ FROM cuda AS cuda_pretrained_ready
ARG TORCH_CACHE=/home/non-root/.cache/torch

COPY --chown=10001 --from=download_pretrained_weights ${TORCH_CACHE} ${TORCH_CACHE}

USER non-root
WORKDIR ${NON_ROOT_HOME}
2 changes: 1 addition & 1 deletion src/otx/algo/modules/base_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def _dump_init_info(self) -> None:
with_file_handler = False
# dump the information to the logger file if there is a `FileHandler`
for handler in logger.handlers:
if isinstance(handler, FileHandler):
if isinstance(handler, FileHandler) and handler.stream is not None:
handler.stream.write("Name of parameter - Initialization information\n")
for name, param in self.named_parameters():
handler.stream.write(
Expand Down
2 changes: 1 addition & 1 deletion src/otx/engine/hpo/hpo_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def execute_hpo(
engine.model.patch_optimizer_and_scheduler_for_hpo()

hpo_workdir = Path(engine.work_dir) / "hpo"
hpo_workdir.mkdir(exist_ok=True)
hpo_workdir.mkdir(parents=True, exist_ok=True)
hpo_configurator = HPOConfigurator(
engine=engine,
max_epochs=max_epochs,
Expand Down
21 changes: 17 additions & 4 deletions src/otx/hpo/search_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@

logger = logging.getLogger()

AVAILABLE_SEARCH_SPACE_TYPE = ["uniform", "quniform", "loguniform", "qloguniform", "choice"]
AVAILABLE_SEARCH_SPACE_TYPE = [
"uniform",
"quniform",
"loguniform",
"qloguniform",
"choice",
]


class SingleSearchSpace:
Expand Down Expand Up @@ -58,7 +64,9 @@ def __init__(
self._check_all_value_is_right()

@property
def type(self) -> Literal["uniform", "loguniform", "quniform", "qloguniform", "choice"]: # noqa: A003
def type( # noqa: A003
self,
) -> Literal["uniform", "loguniform", "quniform", "qloguniform", "choice"]:
"""Type of hyper parameter in search space."""
return self._type

Expand Down Expand Up @@ -309,8 +317,13 @@ def __init__(
) -> None:
self.search_space: dict[str, SingleSearchSpace] = {}

for key, val in search_space.items(): # pylint: disable=too-many-nested-blocks
self.search_space[key] = SingleSearchSpace(**val)
try:
for key, val in search_space.items(): # pylint: disable=too-many-nested-blocks
self.search_space[key] = SingleSearchSpace(**val)
except Exception:
msg = f"Failed to create SingleSearchSpace. key={key}, val={val}"
logging.exception(msg)
raise

def __getitem__(self, key: str) -> SingleSearchSpace:
"""Get search space by key."""
Expand Down

0 comments on commit 7214bf5

Please sign in to comment.