From 2b85f789cf3b53c54a4e778bb8431a1393b50c37 Mon Sep 17 00:00:00 2001 From: JaiDhyani Date: Fri, 5 Apr 2024 08:44:36 -0700 Subject: [PATCH] CR --- .gitignore | 5 +++- .vscode/launch.json | 42 -------------------------------- scripts/run_training.py | 2 +- src/delphi/train/config/utils.py | 3 +-- 4 files changed, 6 insertions(+), 46 deletions(-) delete mode 100644 .vscode/launch.json diff --git a/.gitignore b/.gitignore index 0bce421a..5bb13566 100644 --- a/.gitignore +++ b/.gitignore @@ -174,4 +174,7 @@ cython_debug/ notebooks/scratch.ipynb # dsstore -.DS_Store \ No newline at end of file +.DS_Store + +# vscode debug configs +**/launch.json \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index d4402391..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - - { - "name": "run_training debug", - "type": "debugpy", - "request": "launch", - "program": "scripts/run_training.py", - "console": "integratedTerminal", - "args": "--config_files src/delphi/static/configs/debug.json" - }, - { - "name": "run_training custom", - "type": "debugpy", - "request": "launch", - "program": "scripts/run_training.py", - "console": "integratedTerminal", - "args": "${command:pickArgs}" - }, - { - "name": "run_training --help", - "type": "debugpy", - "request": "launch", - "program": "scripts/run_training.py", - "console": "integratedTerminal", - "args": "--help" - //"args": "${command:pickArgs}" - }, - { - "name": "run training with debug plus custom args", - "type": "debugpy", - "request": "launch", - "program": "scripts/run_training.py", - "console": "integratedTerminal", - "args": "--config_files src/delphi/static/configs/debug.json ${command:pickArgs}" - } - ] -} \ No newline at end of file diff --git a/scripts/run_training.py b/scripts/run_training.py index e44908f0..6f4cb1e5 100755 --- a/scripts/run_training.py +++ b/scripts/run_training.py @@ -81,7 +81,7 @@ def setup_parser() -> argparse.ArgumentParser: def overrides_to_dict(overrides: list[str]) -> dict[str, Any]: - # {"--overrides a.b.c=4 foo=false} to {"a": {"b": {"c": 4}}, "foo": False} + # ["a.b.c=4", "foo=false"] to {"a": {"b": {"c": 4}}, "foo": False} config_vars = {k: v for k, v in [x.split("=") for x in overrides if "=" in x]} return dot_notation_to_dict(config_vars) diff --git a/src/delphi/train/config/utils.py b/src/delphi/train/config/utils.py index 47c26490..b67ef5b2 100644 --- a/src/delphi/train/config/utils.py +++ b/src/delphi/train/config/utils.py @@ -2,14 +2,13 @@ import json import logging import os +from collections.abc import Iterable from dataclasses import fields, is_dataclass from datetime import datetime from pathlib import Path from typing import _GenericAlias # type: ignore from typing import Any, Type, TypeVar, Union -import platformdirs -from beartype.typing import Any, Iterable from dacite import from_dict from delphi.constants import CONFIG_PRESETS_DIR