aap-utils 0.1.8__py3-none-any.whl → 0.1.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aap_utils/__init__.py +2 -1
- aap_utils/config_loader.py +26 -0
- aap_utils/register.py +2 -12
- {aap_utils-0.1.8.dist-info → aap_utils-0.1.11.dist-info}/METADATA +1 -1
- aap_utils-0.1.11.dist-info/RECORD +7 -0
- aap_utils-0.1.8.dist-info/RECORD +0 -6
- {aap_utils-0.1.8.dist-info → aap_utils-0.1.11.dist-info}/WHEEL +0 -0
- {aap_utils-0.1.8.dist-info → aap_utils-0.1.11.dist-info}/top_level.txt +0 -0
aap_utils/__init__.py
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
from .register import register_demo
|
1
|
+
from .register import register_demo
|
2
|
+
from .config_loader import ConfigLoader
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import os
|
2
|
+
from hydra import initialize, compose
|
3
|
+
from omegaconf import DictConfig
|
4
|
+
|
5
|
+
class ConfigLoader:
|
6
|
+
def __init__(self):
|
7
|
+
self.kcn_params = "config.yaml"
|
8
|
+
self.config_path = "configs/"
|
9
|
+
self.overrides = []
|
10
|
+
|
11
|
+
def _load_env_variables(self):
|
12
|
+
"""Load environment variables for config parameters and overrides."""
|
13
|
+
if os.environ.get("KCN_PARAMS"):
|
14
|
+
full_path = os.getenv("KCN_PARAMS")
|
15
|
+
self.kcn_params = os.path.basename(full_path) # Extract the filename
|
16
|
+
|
17
|
+
if os.environ.get("KCN_OVERRIDES"):
|
18
|
+
overrides_env = os.getenv("KCN_OVERRIDES")
|
19
|
+
self.overrides = overrides_env.split("|") if overrides_env else []
|
20
|
+
|
21
|
+
def get_args(self) -> DictConfig:
|
22
|
+
"""Load and return the Hydra configuration."""
|
23
|
+
self._load_env_variables()
|
24
|
+
with initialize(version_base=None, config_path=self.config_path):
|
25
|
+
args = compose(config_name=self.kcn_params, overrides=self.overrides)
|
26
|
+
return args
|
aap_utils/register.py
CHANGED
@@ -63,28 +63,18 @@ def create_url(domain_name = "aiplatform.vcntt.tech"):
|
|
63
63
|
|
64
64
|
def get_args():
|
65
65
|
kcn_params = "config.yaml"
|
66
|
-
|
67
|
-
# Get the directory of run.py (assuming run.py is executed from its own location)
|
68
|
-
run_py_path = os.getcwd() # This gets the directory where run.py is executed
|
69
|
-
|
70
|
-
# Relative path to configs directory
|
71
|
-
config_path = "configs" # Hydra requires a relative path
|
72
|
-
|
66
|
+
config_path="configs/"
|
73
67
|
overrides = []
|
74
68
|
|
75
69
|
if os.environ.get('KCN_PARAMS') and os.environ.get('KCN_PARAMS') != '':
|
76
70
|
full_path = os.getenv('KCN_PARAMS')
|
71
|
+
config_path = os.path.join(config_path, kcn_params)
|
77
72
|
kcn_params = os.path.basename(full_path) # Extract the filename
|
78
73
|
|
79
74
|
if os.environ.get('KCN_OVERRIDES') and os.environ.get('KCN_OVERRIDES') != '':
|
80
75
|
overrides_env = os.getenv("KCN_OVERRIDES")
|
81
76
|
overrides = overrides_env.split('|') if overrides_env else []
|
82
77
|
|
83
|
-
# Ensure the config directory exists
|
84
|
-
if not os.path.exists(os.path.join(run_py_path, config_path)):
|
85
|
-
raise FileNotFoundError(f"Config directory not found: {os.path.join(run_py_path, config_path)}")
|
86
|
-
|
87
78
|
with initialize(version_base=None, config_path=config_path):
|
88
79
|
args = compose(config_name=kcn_params)
|
89
|
-
|
90
80
|
return args
|
@@ -0,0 +1,7 @@
|
|
1
|
+
aap_utils/__init__.py,sha256=MiN8qoJdlw-cI6OLAfz1JuTOaIb0uEwngJrzCes6Zcg,75
|
2
|
+
aap_utils/config_loader.py,sha256=RfYrBVnli7Jd1zPonpOhMd8kJC6zhaMPIq8QYKxYSfw,1001
|
3
|
+
aap_utils/register.py,sha256=JxMfbfzc8qs3Z0QlbX7PiLgJexY2P0Zdq6fqdly6zsI,3058
|
4
|
+
aap_utils-0.1.11.dist-info/METADATA,sha256=8gZpkUMOfsR5-10ONYs0_v19fk3qenYmMFBVQEuC9TU,347
|
5
|
+
aap_utils-0.1.11.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
+
aap_utils-0.1.11.dist-info/top_level.txt,sha256=Qt5xmL8_0_jhMl9uA3lg-xnvs4nCEyVj1tBE4vnp36M,10
|
7
|
+
aap_utils-0.1.11.dist-info/RECORD,,
|
aap_utils-0.1.8.dist-info/RECORD
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
aap_utils/__init__.py,sha256=UB0P2cVBboRNY4SE__iGw0Nscwv9KJFTINuwydrWv4M,45
|
2
|
-
aap_utils/register.py,sha256=-TGFMUjgv8aIZBMZ6h9VkYoLqXAkAoi5_VJZyhcJ6Ys,3460
|
3
|
-
aap_utils-0.1.8.dist-info/METADATA,sha256=14ly6dglTdHhGDF6jXnpeFCeGlCB8Ucx8MH_RZSfXpA,346
|
4
|
-
aap_utils-0.1.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
5
|
-
aap_utils-0.1.8.dist-info/top_level.txt,sha256=Qt5xmL8_0_jhMl9uA3lg-xnvs4nCEyVj1tBE4vnp36M,10
|
6
|
-
aap_utils-0.1.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|