Skip to content

Commit

Permalink
Merge pull request #3774 from harimkang/harimkan/override-task-config…
Browse files Browse the repository at this point in the history
…-converter

Add task overriding for ConfigConverter
  • Loading branch information
harimkang authored Jul 30, 2024
2 parents e74e5e6 + 5015f79 commit 3fbbeb7
Show file tree
Hide file tree
Showing 3 changed files with 641 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/otx/tools/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,12 @@ class ConfigConverter:
"""

@staticmethod
def convert(config_path: str) -> dict:
def convert(config_path: str, task: OTXTaskType | None = None) -> dict:
"""Convert a configuration file to a default configuration dictionary.
Args:
config_path (str): The path to the configuration file.
task (OTXTaskType | None): Value to override the task.
Returns:
dict: The default configuration dictionary.
Expand All @@ -197,6 +198,8 @@ def convert(config_path: str) -> dict:
task_info = TEMPLATE_ID_DICT[template_config["model_template_id"]]
if param_dict.get("enable_tiling", None) and not task_info["model_name"].endswith("_tile"):
task_info["model_name"] += "_tile"
if task is not None:
task_info["task"] = task
default_config = ConfigConverter._get_default_config(task_info)
ConfigConverter._update_params(default_config, param_dict)
ConfigConverter._remove_unused_key(default_config)
Expand Down
Loading

0 comments on commit 3fbbeb7

Please sign in to comment.