halib 0.2.17__py3-none-any.whl → 0.2.19__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.
- halib/exp/core/param_gen.py +170 -162
- halib-0.2.19.dist-info/METADATA +187 -0
- {halib-0.2.17.dist-info → halib-0.2.19.dist-info}/RECORD +6 -6
- halib-0.2.17.dist-info/METADATA +0 -220
- {halib-0.2.17.dist-info → halib-0.2.19.dist-info}/WHEEL +0 -0
- {halib-0.2.17.dist-info → halib-0.2.19.dist-info}/licenses/LICENSE.txt +0 -0
- {halib-0.2.17.dist-info → halib-0.2.19.dist-info}/top_level.txt +0 -0
halib/exp/core/param_gen.py
CHANGED
|
@@ -1,181 +1,189 @@
|
|
|
1
1
|
import os
|
|
2
|
-
import
|
|
2
|
+
import copy
|
|
3
3
|
import numpy as np
|
|
4
|
-
from typing import Dict, Any, List
|
|
5
|
-
|
|
6
|
-
from ...common.common import *
|
|
7
|
-
from ...filetype import yamlfile
|
|
8
4
|
from itertools import product
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"""
|
|
13
|
-
Parameter Generation Pipeline
|
|
14
|
-
|
|
15
|
-
1. Expand Values (_build):
|
|
16
|
-
Parses the YAML file and expands value generators (like ranges) into lists.
|
|
17
|
-
|
|
18
|
-
Example:
|
|
19
|
-
Input: {"p1": {"type": "range", "values": [1, 4, 1]}, "p2": {"values": ["a", "b"]}}
|
|
20
|
-
Output: {"p1": [1, 2, 3], "p2": ["a", "b"]}
|
|
21
|
-
|
|
22
|
-
2. Generate Combinations (_build_combinations):
|
|
23
|
-
Creates a Cartesian product (grid) of all parameter lists.
|
|
24
|
-
|
|
25
|
-
Example:
|
|
26
|
-
Input: {"p1": [1, 2], "p2": ["a", "b"]}
|
|
27
|
-
Output: [{"p1": 1, "p2": "a"}, {"p1": 1, "p2": "b"}, ...]
|
|
28
|
-
3. Expand Configs (expand):
|
|
29
|
-
Merges each parameter combination into a base configuration using a user-defined function.
|
|
30
|
-
Example:
|
|
31
|
-
Input: base_cfg, [{"p1": 1, "p2": "a"}, {"p1": 1, "p2": "b"}, ...], update_fn
|
|
32
|
-
Output: [cfg1, cfg2, ...] where each cfg has parameters from the combinations applied.
|
|
33
|
-
"""
|
|
5
|
+
from typing import Dict, Any, List, Iterator, Optional
|
|
6
|
+
from ...filetype import yamlfile
|
|
34
7
|
|
|
35
8
|
class ParamGen:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
9
|
+
"""
|
|
10
|
+
A flexible parameter grid generator for hyperparameter tuning and experiment management.
|
|
11
|
+
|
|
12
|
+
This class generates a Cartesian product of parameters from a "sweep configuration"
|
|
13
|
+
and optionally merges them into a "base configuration". It abstracts away the complexity
|
|
14
|
+
of handling nested dictionaries and range generation.
|
|
15
|
+
|
|
16
|
+
Key Features:
|
|
17
|
+
-----------
|
|
18
|
+
1. **Flexible Syntax**: Define parameters using standard nested dictionaries or
|
|
19
|
+
dot-notation keys (e.g., `'model.backbone.layers'`).
|
|
20
|
+
2. **Range Shortcuts**:
|
|
21
|
+
- **Choices**: Standard lists `[1, 2, 3]`.
|
|
22
|
+
- **String Ranges**: `"start:stop:step"` (e.g., `"0:10:2"` -> `[0, 2, 4, 6, 8]`).
|
|
23
|
+
- **Dict Ranges**: `{'start': 0, 'stop': 1, 'step': 0.1}`.
|
|
24
|
+
3. **Deep Merging**: Automatically updates deep keys in `base_cfg` without overwriting siblings.
|
|
25
|
+
|
|
26
|
+
Example:
|
|
27
|
+
--------
|
|
28
|
+
>>> base = {'model': {'name': 'resnet', 'dropout': 0.1}, 'seed': 42}
|
|
29
|
+
>>> sweep = {
|
|
30
|
+
... 'model.name': ['resnet', 'vit'], # Dot notation
|
|
31
|
+
... 'model.dropout': "0.1:0.3:0.1", # Range string
|
|
32
|
+
... 'seed': [42, 100] # Simple choice
|
|
33
|
+
... }
|
|
34
|
+
>>> grid = ParamGen(sweep, base)
|
|
35
|
+
>>> configs = grid.expand()
|
|
36
|
+
>>> print(len(configs)) # Outputs: 8 (2 models * 2 dropouts * 2 seeds)
|
|
37
|
+
Attributes:
|
|
38
|
+
keys (List[str]): List of flattened dot-notation keys being swept.
|
|
39
|
+
values (List[List[Any]]): List of value options for each key.
|
|
40
|
+
"""
|
|
41
|
+
def __init__(
|
|
42
|
+
self, sweep_cfg: Dict[str, Any], base_cfg: Optional[Dict[str, Any]] = None
|
|
46
43
|
):
|
|
47
|
-
cfg_ls = []
|
|
48
|
-
for combination in combination_list:
|
|
49
|
-
cfg = copy.deepcopy(base_cfg)
|
|
50
|
-
update_base_cfg_fn(cfg, combination)
|
|
51
|
-
cfg_ls.append(cfg)
|
|
52
|
-
return cfg_ls
|
|
53
|
-
|
|
54
|
-
@staticmethod
|
|
55
|
-
def expand_from_file(
|
|
56
|
-
base_cfg: Dict[str, Any],
|
|
57
|
-
params_file: str,
|
|
58
|
-
update_base_cfg_fn: callable):
|
|
59
|
-
param_gen = ParamGen.from_file(params_file)
|
|
60
|
-
return ParamGen.expand(
|
|
61
|
-
base_cfg, param_gen.combinations, update_base_cfg_fn
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
def __init__(self, params_file=None):
|
|
65
|
-
self.params = {}
|
|
66
|
-
assert os.path.isfile(params_file), f"params_file not found: {params_file}"
|
|
67
|
-
self.params = self._build_param_dict(params_file)
|
|
68
|
-
self.combinations = self._build_combinations(self.params)
|
|
69
|
-
|
|
70
|
-
def _expand_param(self, param_name: str, config: Dict[str, Any]) -> List[Any]:
|
|
71
44
|
"""
|
|
72
|
-
Validates and expands the values for a single parameter configuration.
|
|
73
|
-
|
|
74
45
|
Args:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
Returns:
|
|
79
|
-
A list of the expanded values for the parameter.
|
|
80
|
-
|
|
81
|
-
Raises:
|
|
82
|
-
TypeError: If the configuration or its values have an incorrect type.
|
|
83
|
-
ValueError: If the configuration is missing keys or has an invalid structure.
|
|
46
|
+
sweep_cfg: The dictionary defining parameters to sweep.
|
|
47
|
+
base_cfg: (Optional) The base config to merge sweep parameters into.
|
|
48
|
+
If None, expand() behaves like expand_sweep().
|
|
84
49
|
"""
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
#
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
f"All 'values' for 'range' on '{param_name}' must be numbers."
|
|
120
|
-
)
|
|
121
|
-
|
|
122
|
-
else:
|
|
123
|
-
raise ValueError(
|
|
124
|
-
f"Invalid 'type' for '{param_name}': '{gen_type}'. Must be 'list' or 'range'."
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
def _build_param_dict(self, params_file):
|
|
50
|
+
self.base_cfg = base_cfg if base_cfg is not None else {}
|
|
51
|
+
|
|
52
|
+
# Recursively flatten the nested sweep config into dot-notation keys
|
|
53
|
+
self.param_space = self._flatten_params(sweep_cfg)
|
|
54
|
+
self.keys = list(self.param_space.keys())
|
|
55
|
+
self.values = list(self.param_space.values())
|
|
56
|
+
|
|
57
|
+
def get_param_space(self) -> Dict[str, List[Any]]:
|
|
58
|
+
"""Returns the parameter space as a dictionary of dot-notation keys to value lists."""
|
|
59
|
+
return self.param_space
|
|
60
|
+
|
|
61
|
+
def __iter__(self) -> Iterator[Dict[str, Any]]:
|
|
62
|
+
"""Yields fully merged configurations one by one."""
|
|
63
|
+
for combination in product(*self.values):
|
|
64
|
+
# 1. Create the flat sweep dict (dot notation)
|
|
65
|
+
flat_params = dict(zip(self.keys, combination))
|
|
66
|
+
|
|
67
|
+
# 2. Deep copy base and update with current params
|
|
68
|
+
new_cfg = copy.deepcopy(self.base_cfg)
|
|
69
|
+
new_cfg = self._apply_updates(new_cfg, flat_params)
|
|
70
|
+
|
|
71
|
+
# 3. Store metadata (Optional)
|
|
72
|
+
# if "_meta" not in new_cfg:
|
|
73
|
+
# new_cfg["_meta"] = {}
|
|
74
|
+
# We unflatten the sweep params here so the log is readable
|
|
75
|
+
# new_cfg["_meta"]["sweep_params"] = self._unflatten(flat_params)
|
|
76
|
+
|
|
77
|
+
yield new_cfg
|
|
78
|
+
|
|
79
|
+
# ! --- Factory Methods ---
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dicts(
|
|
82
|
+
cls, sweep_cfg: Dict[str, Any], base_cfg: Optional[Dict[str, Any]] = None
|
|
83
|
+
):
|
|
128
84
|
"""
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
This function processes a dictionary where each key is a parameter name and each value
|
|
132
|
-
is a config dict specifying the 'type' ('list' or 'range') and 'values' for generation.
|
|
133
|
-
|
|
85
|
+
Load from dictionaries.
|
|
134
86
|
Args:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
{
|
|
138
|
-
"learning_rate": {"type": "range", "values": [0.01, 0.1, 0.01]},
|
|
139
|
-
"optimizer": {"type": "list", "values": ["adam", "sgd"]},
|
|
140
|
-
"epochs": {"type": "list", "values": 100}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
Returns:
|
|
144
|
-
A dictionary with parameter names mapped to their fully expanded list of values.
|
|
145
|
-
"""
|
|
146
|
-
cfg_raw_dict = yamlfile.load_yaml(params_file, to_dict=True)
|
|
147
|
-
if not isinstance(cfg_raw_dict, dict):
|
|
148
|
-
raise TypeError("The entire opt_cfg must be a dictionary.")
|
|
149
|
-
|
|
150
|
-
# Use a dictionary comprehension for a clean and efficient build
|
|
151
|
-
return {
|
|
152
|
-
param_name: self._expand_param(param_name, config)
|
|
153
|
-
for param_name, config in cfg_raw_dict.items()
|
|
154
|
-
}
|
|
155
|
-
def _build_combinations(self, params_dict: Dict[str, List[Any]]) -> List[Dict[str, Any]]:
|
|
87
|
+
sweep_cfg: The dictionary defining parameters to sweep.
|
|
88
|
+
base_cfg: (Optional) The base config to merge sweep parameters into.
|
|
156
89
|
"""
|
|
157
|
-
|
|
90
|
+
return cls(sweep_cfg, base_cfg)
|
|
158
91
|
|
|
92
|
+
@classmethod
|
|
93
|
+
def from_files(cls, sweep_yaml: str, base_yaml: Optional[str] = None):
|
|
94
|
+
"""
|
|
95
|
+
Load from files.
|
|
159
96
|
Args:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
A list of dictionaries, each representing a unique combination of parameters.
|
|
97
|
+
sweep_yaml: Path to sweep config.
|
|
98
|
+
base_yaml: (Optional) Path to base config.
|
|
163
99
|
"""
|
|
100
|
+
assert os.path.isfile(sweep_yaml), f"Sweep file not found: {sweep_yaml}"
|
|
101
|
+
sweep_dict = yamlfile.load_yaml(sweep_yaml, to_dict=True)
|
|
102
|
+
base_dict = None
|
|
103
|
+
if base_yaml:
|
|
104
|
+
base_dict = yamlfile.load_yaml(base_yaml, to_dict=True)
|
|
105
|
+
if "__base__" in base_dict:
|
|
106
|
+
del base_dict["__base__"]
|
|
164
107
|
|
|
165
|
-
|
|
166
|
-
param_names = list(params_dict.keys())
|
|
167
|
-
param_values = [params_dict[name] for name in param_names]
|
|
108
|
+
return cls(sweep_dict, base_dict)
|
|
168
109
|
|
|
169
|
-
|
|
170
|
-
|
|
110
|
+
def expand(self) -> List[Dict[str, Any]]:
|
|
111
|
+
"""Generates and returns the full list of MERGED configurations."""
|
|
112
|
+
return list(self)
|
|
171
113
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
]
|
|
176
|
-
|
|
177
|
-
return combinations_list
|
|
114
|
+
def expand_sweep_flat(self) -> List[Dict[str, Any]]:
|
|
115
|
+
"""
|
|
116
|
+
Returns a list of ONLY the sweep parameters, formatted as FLAT dot-notation dictionaries.
|
|
178
117
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
118
|
+
Returns:
|
|
119
|
+
[{'exp_params.model': 'resnet', 'exp_params.lr': 0.01}, ...]
|
|
120
|
+
"""
|
|
121
|
+
combinations = []
|
|
122
|
+
for combination in product(*self.values):
|
|
123
|
+
flat_dict = dict(zip(self.keys, combination))
|
|
124
|
+
combinations.append(flat_dict)
|
|
125
|
+
return combinations
|
|
126
|
+
|
|
127
|
+
def _unflatten(self, flat_dict: Dict[str, Any]) -> Dict[str, Any]:
|
|
128
|
+
"""Converts {'a.b': 1} back to {'a': {'b': 1}}."""
|
|
129
|
+
nested = {}
|
|
130
|
+
self._apply_updates(nested, flat_dict)
|
|
131
|
+
return nested
|
|
132
|
+
|
|
133
|
+
def _flatten_params(
|
|
134
|
+
self, cfg: Dict[str, Any], parent_key: str = ""
|
|
135
|
+
) -> Dict[str, List[Any]]:
|
|
136
|
+
"""Recursively converts nested dicts into flat dot-notation keys."""
|
|
137
|
+
flat = {}
|
|
138
|
+
for key, val in cfg.items():
|
|
139
|
+
current_key = f"{parent_key}.{key}" if parent_key else key
|
|
140
|
+
|
|
141
|
+
if self._is_sweep_leaf(val):
|
|
142
|
+
flat[current_key] = self._expand_val(val)
|
|
143
|
+
elif isinstance(val, dict):
|
|
144
|
+
flat.update(self._flatten_params(val, current_key))
|
|
145
|
+
else:
|
|
146
|
+
flat[current_key] = [val]
|
|
147
|
+
return flat
|
|
148
|
+
|
|
149
|
+
def _is_sweep_leaf(self, val: Any) -> bool:
|
|
150
|
+
if isinstance(val, list):
|
|
151
|
+
return True
|
|
152
|
+
if isinstance(val, str) and ":" in val:
|
|
153
|
+
return True
|
|
154
|
+
if isinstance(val, dict) and "start" in val and "stop" in val:
|
|
155
|
+
return True
|
|
156
|
+
return False
|
|
157
|
+
|
|
158
|
+
def _expand_val(self, val: Any) -> List[Any]:
|
|
159
|
+
if isinstance(val, list):
|
|
160
|
+
return val
|
|
161
|
+
|
|
162
|
+
if isinstance(val, str) and ":" in val:
|
|
163
|
+
try:
|
|
164
|
+
parts = [float(x) for x in val.split(":")]
|
|
165
|
+
if len(parts) == 3:
|
|
166
|
+
arr = np.arange(parts[0], parts[1], parts[2])
|
|
167
|
+
return [float(f"{x:.6g}") for x in arr]
|
|
168
|
+
except ValueError:
|
|
169
|
+
pass
|
|
170
|
+
|
|
171
|
+
if isinstance(val, dict) and "start" in val:
|
|
172
|
+
step = val.get("step", 1)
|
|
173
|
+
return np.arange(val["start"], val["stop"], step).tolist()
|
|
174
|
+
|
|
175
|
+
return [val]
|
|
176
|
+
|
|
177
|
+
def _apply_updates(
|
|
178
|
+
self, cfg: Dict[str, Any], updates: Dict[str, Any]
|
|
179
|
+
) -> Dict[str, Any]:
|
|
180
|
+
"""Deep merges dot-notation updates into cfg."""
|
|
181
|
+
for key, val in updates.items():
|
|
182
|
+
parts = key.split(".")
|
|
183
|
+
target = cfg
|
|
184
|
+
for part in parts[:-1]:
|
|
185
|
+
if part not in target:
|
|
186
|
+
target[part] = {}
|
|
187
|
+
target = target[part]
|
|
188
|
+
target[parts[-1]] = val
|
|
189
|
+
return cfg
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: halib
|
|
3
|
+
Version: 0.2.19
|
|
4
|
+
Summary: Small library for common tasks
|
|
5
|
+
Author: Hoang Van Ha
|
|
6
|
+
Author-email: hoangvanhauit@gmail.com
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE.txt
|
|
13
|
+
Requires-Dist: arrow
|
|
14
|
+
Requires-Dist: click
|
|
15
|
+
Requires-Dist: dataclass-wizard
|
|
16
|
+
Requires-Dist: enlighten
|
|
17
|
+
Requires-Dist: itables
|
|
18
|
+
Requires-Dist: kaleido
|
|
19
|
+
Requires-Dist: loguru
|
|
20
|
+
Requires-Dist: matplotlib
|
|
21
|
+
Requires-Dist: more-itertools
|
|
22
|
+
Requires-Dist: moviepy
|
|
23
|
+
Requires-Dist: networkx
|
|
24
|
+
Requires-Dist: numpy
|
|
25
|
+
Requires-Dist: omegaconf
|
|
26
|
+
Requires-Dist: opencv-python
|
|
27
|
+
Requires-Dist: pandas
|
|
28
|
+
Requires-Dist: Pillow
|
|
29
|
+
Requires-Dist: plotly
|
|
30
|
+
Requires-Dist: Pyarrow
|
|
31
|
+
Requires-Dist: pycurl
|
|
32
|
+
Requires-Dist: pygwalker
|
|
33
|
+
Requires-Dist: python-telegram-bot
|
|
34
|
+
Requires-Dist: requests
|
|
35
|
+
Requires-Dist: rich
|
|
36
|
+
Requires-Dist: scikit-learn
|
|
37
|
+
Requires-Dist: seaborn
|
|
38
|
+
Requires-Dist: tabulate
|
|
39
|
+
Requires-Dist: timebudget
|
|
40
|
+
Requires-Dist: tqdm
|
|
41
|
+
Requires-Dist: tube_dl
|
|
42
|
+
Requires-Dist: wandb
|
|
43
|
+
Requires-Dist: ipynbname
|
|
44
|
+
Requires-Dist: typed-argument-parser
|
|
45
|
+
Dynamic: author
|
|
46
|
+
Dynamic: author-email
|
|
47
|
+
Dynamic: classifier
|
|
48
|
+
Dynamic: description
|
|
49
|
+
Dynamic: description-content-type
|
|
50
|
+
Dynamic: license-file
|
|
51
|
+
Dynamic: requires-dist
|
|
52
|
+
Dynamic: requires-python
|
|
53
|
+
Dynamic: summary
|
|
54
|
+
|
|
55
|
+
# 📦 Helper Package for Coding and Automation Changelog
|
|
56
|
+
|
|
57
|
+
## v0.2.x (Experiment & Core Updates)
|
|
58
|
+
|
|
59
|
+
### **v0.2.19**
|
|
60
|
+
- ✨ **New Feature:** Added `exp.core.param_gen` to facilitate fast generation of parameter combination sweeps (grid search) using YAML configurations.
|
|
61
|
+
|
|
62
|
+
### **v0.2.17**
|
|
63
|
+
- 🚀 **Improvement:** Updated `exp.perf.profiler` with an `enabled` flag for dynamic toggling.
|
|
64
|
+
- 🚀 **Improvement:** Added a `measure` context manager to simplify performance measuring of code blocks.
|
|
65
|
+
|
|
66
|
+
### **v0.2.13**
|
|
67
|
+
- ♻️ **Refactor:** Major reorganization of packages. Renamed `research` package to `exp` (Experiment Management).
|
|
68
|
+
- 🚀 **Improvement:** Updated `exp/perfcalc.py` to allow saving computed performance metrics to CSV without explicitly calling `calc_perfs`.
|
|
69
|
+
|
|
70
|
+
### **v0.2.1**
|
|
71
|
+
- ✨ **New Feature:** Added `eval_exp` method to `exp/base_exp` for running evaluations (e.g., model testing) after experiments conclude.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## v0.1.9x (Visualization & Generators)
|
|
76
|
+
|
|
77
|
+
### **v0.1.99**
|
|
78
|
+
- ✨ **New Feature:** Added `gen_ipynb_name` to `filetype/ipynb`. Generates filenames based on the current notebook name with optional timestamps.
|
|
79
|
+
|
|
80
|
+
### **v0.1.96**
|
|
81
|
+
- ✨ **New Feature:** Added `PlotHelper` class in `research/plot` for plotting training history and image grids (dataset samples or model outputs).
|
|
82
|
+
|
|
83
|
+
### **v0.1.91**
|
|
84
|
+
- ✨ **New Feature:** Added `ParamGen` class to `research/param_gen` for parsing YAML files into parameter lists for hyperparameter searches.
|
|
85
|
+
|
|
86
|
+
### **v0.1.90**
|
|
87
|
+
- ✨ **New Feature:** Added `zProfiler` class to `research/profiler` for measuring context/step execution time, supporting dynamic color scales in plots.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## v0.1.5x - v0.1.7x (Infrastructure & Utilities)
|
|
92
|
+
|
|
93
|
+
### **v0.1.77**
|
|
94
|
+
- ✨ **New Feature:** Added `BaseExp` class in `research/base_exp` to handle common experiment tasks (performance calculation, result saving).
|
|
95
|
+
|
|
96
|
+
### **v0.1.67**
|
|
97
|
+
- 🔧 **Maintenance:** Switched to **uv** for virtual environment management.
|
|
98
|
+
- 🚀 **Improvement:** Updated `research/perfcalc` to support both `torchmetrics` and custom metrics.
|
|
99
|
+
|
|
100
|
+
### **v0.1.61**
|
|
101
|
+
- ✨ **New Feature:** Added `VideoUtils` (`util/video`) for common video handling tasks.
|
|
102
|
+
- ✨ **New Feature:** Added `GPUMonitor` (`util/gpu_mon`) for tracking GPU usage and performance.
|
|
103
|
+
|
|
104
|
+
### **v0.1.59**
|
|
105
|
+
- 🔨 **Architecture:** Added `util/perfcalc` abstract base class. This requires implementation of specific performance calculation logic.
|
|
106
|
+
|
|
107
|
+
### **v0.1.55**
|
|
108
|
+
- ✨ **New Feature:** Added `util/dataclass_util` for dynamic creation of `dataclass` objects from dictionaries or YAML (supports nested structures).
|
|
109
|
+
|
|
110
|
+
### **v0.1.52**
|
|
111
|
+
- ✨ **New Feature:** Added `research/perftb` module for managing experiment performance tables (filtering by dataset, metric, etc.).
|
|
112
|
+
|
|
113
|
+
### **v0.1.50**
|
|
114
|
+
- ✨ **New Feature:** Added `pprint_local_path` to print clickable file URIs for local paths.
|
|
115
|
+
- ✨ **New Feature:** Added `research` package containing `benchquery` for dataframe benchmarking.
|
|
116
|
+
- ✨ **New Feature:** Added `wandb` module for offline syncing and batch clearing of Weights & Biases runs.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## v0.1.4x (Display & formatting)
|
|
121
|
+
|
|
122
|
+
### **v0.1.47**
|
|
123
|
+
- ✨ **New Feature:** Added `pprint_box` to print objects or strings inside a decorative box frame.
|
|
124
|
+
|
|
125
|
+
### **v0.1.46**
|
|
126
|
+
- 🐛 **Fix:** Filtered `UserWarning: Unable to import Axes3D`.
|
|
127
|
+
- 🚀 **Improvement:** Added `auto_wrap_text` to `fn_display_df` to prevent long text overflow in tables.
|
|
128
|
+
|
|
129
|
+
### **v0.1.42**
|
|
130
|
+
- ✨ **New Feature:** Added `rich_color.py` wrapper for basic color lists.
|
|
131
|
+
|
|
132
|
+
### **v0.1.41**
|
|
133
|
+
- ✨ **New Feature:** Added `rich_color.py` to support rich color information (palettes, strings) using the `rich` library.
|
|
134
|
+
|
|
135
|
+
### **v0.1.40**
|
|
136
|
+
- 🚀 **Improvement:** Updated `csvfile.py` to use `itables` and `pygwalker` for interactive dataframe display in Jupyter notebooks.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## v0.1.3x (Data & Loading)
|
|
141
|
+
|
|
142
|
+
### **v0.1.38**
|
|
143
|
+
- ✨ **New Feature:** Added `torchloader.py` to search for optimal `DataLoader` configurations (num_workers, batch_size, pin_memory).
|
|
144
|
+
|
|
145
|
+
### **v0.1.37**
|
|
146
|
+
- ✨ **New Feature:** Added `dataset.py` for splitting classification datasets into train/val/test sets.
|
|
147
|
+
|
|
148
|
+
### **v0.1.33**
|
|
149
|
+
- ✨ **New Feature:** Added `plot.py` for plotting Deep Learning training history (accuracy/loss) using `seaborn` and `matplotlib`.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## v0.1.0 - v0.1.2x (Early Utilities)
|
|
154
|
+
|
|
155
|
+
### **v0.1.29**
|
|
156
|
+
- 🐛 **Fix:** Pinned `kaleido==0.1.*` for `tele_noti` as version `0.2.*` caused image generation hangs.
|
|
157
|
+
|
|
158
|
+
### **v0.1.24**
|
|
159
|
+
- ♻️ **Refactor:** Renamed `sys` module to `system` to avoid conflicts with Python's built-in `sys`.
|
|
160
|
+
- ✨ **New Feature:** Added `tele_noti` module for Telegram notifications regarding training progress.
|
|
161
|
+
|
|
162
|
+
### **v0.1.22**
|
|
163
|
+
- ✨ **New Feature:** Added `cuda.py` to check CUDA availability for both PyTorch and TensorFlow.
|
|
164
|
+
|
|
165
|
+
### **v0.1.21**
|
|
166
|
+
- ✨ **New Feature:** Added YAML inheritance and overriding support using `networkx` and `omegaconf`.
|
|
167
|
+
|
|
168
|
+
### **v0.1.15**
|
|
169
|
+
- ✨ **New Feature:** Added common logging library and `@console_log` decorator for function tracing.
|
|
170
|
+
|
|
171
|
+
### **v0.1.10**
|
|
172
|
+
- 🐛 **Fix:** Fixed typo `is_exit` -> `is_exist` in `filesys`.
|
|
173
|
+
- 🚀 **Improvement:** Updated `gdrive` to support uploading to specific folders and returning direct shareable links.
|
|
174
|
+
|
|
175
|
+
### **v0.1.9**
|
|
176
|
+
- 🔧 **Maintenance:** Added `requirements.txt`.
|
|
177
|
+
|
|
178
|
+
### **v0.1.6 - v0.1.8**
|
|
179
|
+
- 🚀 **Performance:** Optimized table insertion by using an in-memory `row_pool_dict` before committing to the DataFrame.
|
|
180
|
+
- ✨ **New Feature:** Added `DFCreator` for manipulating DataFrames (create, insert, display, save).
|
|
181
|
+
|
|
182
|
+
### **v0.1.4 - v0.1.5**
|
|
183
|
+
- ✨ **New Feature:** Added `cmd` module.
|
|
184
|
+
- ✨ **New Feature:** Support for creating Bitbucket Projects from templates.
|
|
185
|
+
|
|
186
|
+
### **v0.1.2**
|
|
187
|
+
- ✨ **New Feature:** Added support for uploading local files to Google Drive.
|
|
@@ -23,7 +23,7 @@ halib/exp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
23
23
|
halib/exp/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
24
|
halib/exp/core/base_config.py,sha256=Js2oVDt7qwT7eV_sOUWw6XXl569G1bX6ls-VYAx2gWY,5032
|
|
25
25
|
halib/exp/core/base_exp.py,sha256=fknJVmW6ubbapOggbkrbNWgc1ZXcUz_FE3wMyuIGX7M,5180
|
|
26
|
-
halib/exp/core/param_gen.py,sha256=
|
|
26
|
+
halib/exp/core/param_gen.py,sha256=_JjakBOr0UuJOxR11ZC-mrX7ye5kdc1SfGLZuYFmG1o,7385
|
|
27
27
|
halib/exp/core/wandb_op.py,sha256=powL2QyLBqF-6PUGAOqd60s1npHLLKJxPns3S4hKeNo,4160
|
|
28
28
|
halib/exp/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
29
|
halib/exp/data/dataclass_util.py,sha256=OPZzqmug0be4JEq0hJ68pKjnyl0PRYQMVJGhKw1kvyk,1382
|
|
@@ -102,8 +102,8 @@ halib/utils/list.py,sha256=BM-8sRhYyqF7bh4p7TQtV7P_gnFruUCA6DTUOombaZg,337
|
|
|
102
102
|
halib/utils/listop.py,sha256=Vpa8_2fI0wySpB2-8sfTBkyi_A4FhoFVVvFiuvW8N64,339
|
|
103
103
|
halib/utils/tele_noti.py,sha256=-4WXZelCA4W9BroapkRyIdUu9cUVrcJJhegnMs_WpGU,5928
|
|
104
104
|
halib/utils/video.py,sha256=zLoj5EHk4SmP9OnoHjO8mLbzPdtq6gQPzTQisOEDdO8,3261
|
|
105
|
-
halib-0.2.
|
|
106
|
-
halib-0.2.
|
|
107
|
-
halib-0.2.
|
|
108
|
-
halib-0.2.
|
|
109
|
-
halib-0.2.
|
|
105
|
+
halib-0.2.19.dist-info/licenses/LICENSE.txt,sha256=qZssdna4aETiR8znYsShUjidu-U4jUT9Q-EWNlZ9yBQ,1100
|
|
106
|
+
halib-0.2.19.dist-info/METADATA,sha256=Q-usItXuCQOXcyCGPIMdspvAIOJzmjERbegWM_TsYSg,7313
|
|
107
|
+
halib-0.2.19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
108
|
+
halib-0.2.19.dist-info/top_level.txt,sha256=7AD6PLaQTreE0Fn44mdZsoHBe_Zdd7GUmjsWPyQ7I-k,6
|
|
109
|
+
halib-0.2.19.dist-info/RECORD,,
|
halib-0.2.17.dist-info/METADATA
DELETED
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: halib
|
|
3
|
-
Version: 0.2.17
|
|
4
|
-
Summary: Small library for common tasks
|
|
5
|
-
Author: Hoang Van Ha
|
|
6
|
-
Author-email: hoangvanhauit@gmail.com
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Requires-Python: >=3.9
|
|
11
|
-
Description-Content-Type: text/markdown
|
|
12
|
-
License-File: LICENSE.txt
|
|
13
|
-
Requires-Dist: arrow
|
|
14
|
-
Requires-Dist: click
|
|
15
|
-
Requires-Dist: dataclass-wizard
|
|
16
|
-
Requires-Dist: enlighten
|
|
17
|
-
Requires-Dist: itables
|
|
18
|
-
Requires-Dist: kaleido
|
|
19
|
-
Requires-Dist: loguru
|
|
20
|
-
Requires-Dist: matplotlib
|
|
21
|
-
Requires-Dist: more-itertools
|
|
22
|
-
Requires-Dist: moviepy
|
|
23
|
-
Requires-Dist: networkx
|
|
24
|
-
Requires-Dist: numpy
|
|
25
|
-
Requires-Dist: omegaconf
|
|
26
|
-
Requires-Dist: opencv-python
|
|
27
|
-
Requires-Dist: pandas
|
|
28
|
-
Requires-Dist: Pillow
|
|
29
|
-
Requires-Dist: plotly
|
|
30
|
-
Requires-Dist: Pyarrow
|
|
31
|
-
Requires-Dist: pycurl
|
|
32
|
-
Requires-Dist: pygwalker
|
|
33
|
-
Requires-Dist: python-telegram-bot
|
|
34
|
-
Requires-Dist: requests
|
|
35
|
-
Requires-Dist: rich
|
|
36
|
-
Requires-Dist: scikit-learn
|
|
37
|
-
Requires-Dist: seaborn
|
|
38
|
-
Requires-Dist: tabulate
|
|
39
|
-
Requires-Dist: timebudget
|
|
40
|
-
Requires-Dist: tqdm
|
|
41
|
-
Requires-Dist: tube_dl
|
|
42
|
-
Requires-Dist: wandb
|
|
43
|
-
Requires-Dist: ipynbname
|
|
44
|
-
Requires-Dist: typed-argument-parser
|
|
45
|
-
Dynamic: author
|
|
46
|
-
Dynamic: author-email
|
|
47
|
-
Dynamic: classifier
|
|
48
|
-
Dynamic: description
|
|
49
|
-
Dynamic: description-content-type
|
|
50
|
-
Dynamic: license-file
|
|
51
|
-
Dynamic: requires-dist
|
|
52
|
-
Dynamic: requires-python
|
|
53
|
-
Dynamic: summary
|
|
54
|
-
|
|
55
|
-
# Helper package for coding and automation
|
|
56
|
-
|
|
57
|
-
**Version 0.2.17**
|
|
58
|
-
+ update `exp.perf.profiler`: add `enabled` flag to enable/disable profiling dynamically, also add `measure` context manager to simplify measuring code blocks.
|
|
59
|
-
|
|
60
|
-
**Version 0.2.13**
|
|
61
|
-
+ reorganize packages with most changes in `research` package; also rename `research` to `exp` (package for experiment management and utilities)
|
|
62
|
-
+ update `exp/perfcalc.py` to allow save computed performance to csv file (without explicit calling method `calc_perfs`)
|
|
63
|
-
|
|
64
|
-
**Version 0.2.1**
|
|
65
|
-
+ `research/base_exp`: add `eval_exp` method to evaluate experiment (e.g., model evaluation on test set) after experiment running is done.
|
|
66
|
-
|
|
67
|
-
**Version 0.1.99**
|
|
68
|
-
+ `filetype/ipynb`: add `gen_ipynb_name` generator to create file name based on current notebook name as prefix (with optional timestamp)
|
|
69
|
-
|
|
70
|
-
**Version 0.1.96**
|
|
71
|
-
+ `research/plot`: add `PlotHelper` class to plot train history + plot grid of images (e.g., image samples from dataset or model outputs)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
**Version 0.1.91**
|
|
75
|
-
+ `research/param_gen`: add `ParamGen` class to generate parameter list from yaml file for hyperparameter search (grid search, random search, etc.)
|
|
76
|
-
|
|
77
|
-
**Version 0.1.90**
|
|
78
|
-
|
|
79
|
-
+ `research/profiler`: add `zProfiler` class to measure execution time of contexts and steps, with support for dynamic color scales in plots.
|
|
80
|
-
|
|
81
|
-
**Version 0.1.77**
|
|
82
|
-
|
|
83
|
-
+ `research/base_exp`: add base experiment class to handle common experiment tasks, including performance calculation and saving results.
|
|
84
|
-
|
|
85
|
-
**Version 0.1.67**
|
|
86
|
-
|
|
87
|
-
+ now use `uv` for venv management
|
|
88
|
-
+ `research/perfcalc`: support both torchmetrics and custom metrics for performance calculation
|
|
89
|
-
|
|
90
|
-
**Version 0.1.61**
|
|
91
|
-
|
|
92
|
-
+ add `util/video`: add `VideoUtils` class to handle common video-related tasks
|
|
93
|
-
+ add `util/gpu_mon`: add `GPUMonitor` class to monitor GPU usage and performance
|
|
94
|
-
|
|
95
|
-
**Version 0.1.59**
|
|
96
|
-
|
|
97
|
-
+ add `util/perfcalc`: abstract class for performance calculation. This class need to be inherited and implemented with specific performance calculation logic.
|
|
98
|
-
|
|
99
|
-
**Version 0.1.55**
|
|
100
|
-
|
|
101
|
-
+ add `util/dataclass_util` to help dynamically create `dataclass` classes from dictionary or YAML file, including support for nested dataclasses. From there, we can use `dataclass_wizard` to create a list of `dataclass` classes with the help from ChatGPT.
|
|
102
|
-
|
|
103
|
-
**Version 0.1.52**
|
|
104
|
-
|
|
105
|
-
+ add `research/perftb` module to allow creating and managing performance tables for experiments, including filtering by datasets, metrics, and experiments.
|
|
106
|
-
|
|
107
|
-
**Version 0.1.50**
|
|
108
|
-
|
|
109
|
-
+ add `pprint_local_path` to print local path (file/directory) in clickable link (as file URI)
|
|
110
|
-
|
|
111
|
-
+ add `research` package to help with research tasks, including `benchquery` for benchmarking queries from dataframe
|
|
112
|
-
+ add `wandb` module to allow easy sync offline data to Weights & Biases (wandb) and batch clear wandb runs.
|
|
113
|
-
|
|
114
|
-
**Version 0.1.47**
|
|
115
|
-
+ add `pprint_box` to print object/string in a box frame (like in `inspect`)
|
|
116
|
-
|
|
117
|
-
**Version 0.1.46**
|
|
118
|
-
+ filter the warning message of `UserWarning: Unable to import Axes3D.`
|
|
119
|
-
+ auto_wrap_text for `fn_display_df` to avoid long text in the table
|
|
120
|
-
|
|
121
|
-
**Version 0.1.42**
|
|
122
|
-
+ add <rich_color.py>: add basic color list (for easy usage)
|
|
123
|
-
|
|
124
|
-
**Version 0.1.41**
|
|
125
|
-
+ add <rich_color.py> to display rich color information in <rich> python package (rcolor_str, rcolor_pallet_all, etc.)
|
|
126
|
-
|
|
127
|
-
**Version 0.1.40**
|
|
128
|
-
|
|
129
|
-
+ update <csvfile.py> to use `itables` and `pygwalker` to display dataframe in jupyter notebook.
|
|
130
|
-
|
|
131
|
-
**Version 0.1.38**
|
|
132
|
-
|
|
133
|
-
+ add <torchloader.py> to search for best cfg for torch dataloader (num_workers, batch_size, pin_memory, et.)
|
|
134
|
-
|
|
135
|
-
**Version 0.1.37**
|
|
136
|
-
|
|
137
|
-
+ add <dataset.py> to help split classification dataset into train/val(test)
|
|
138
|
-
---
|
|
139
|
-
**Version 0.1.33**
|
|
140
|
-
|
|
141
|
-
+ add `plot.py` module to plot DL model training history (with columlns: epoch, train_accuracy, val_accuracy, train_loss, val_loss) using `seaborn` and `matplotlib`
|
|
142
|
-
---
|
|
143
|
-
**Version 0.1.29**
|
|
144
|
-
|
|
145
|
-
+ for `tele_noti` module, `kaleido==0.1.*` is required for plotly since `kaleido 0.2.*` is not working (taking for ever to generate image)
|
|
146
|
-
---
|
|
147
|
-
**Version 0.1.24**
|
|
148
|
-
|
|
149
|
-
+ rename `sys` to `system` to avoid conflict with built-in `sys` module
|
|
150
|
-
+ add `tele_noti` module to send notification to telegram after a specific interval for training progress monitoring
|
|
151
|
-
---
|
|
152
|
-
**Version 0.1.22**
|
|
153
|
-
|
|
154
|
-
+ add `cuda.py` module to check CUDA availability (for both pytorch and tensorflow)
|
|
155
|
-
---
|
|
156
|
-
**Version 0.1.21**
|
|
157
|
-
|
|
158
|
-
+ using `networkx` and `omegaconf` to allow yaml file inheritance and override
|
|
159
|
-
---
|
|
160
|
-
**Version 0.1.15**
|
|
161
|
-
|
|
162
|
-
+ `__init__.py`: add common logging library; also `console_log` decorator to log function (start and end)
|
|
163
|
-
|
|
164
|
-
---
|
|
165
|
-
|
|
166
|
-
**Version 0.1.10**
|
|
167
|
-
|
|
168
|
-
+ filesys: fix typo on "is_exit" to "is_exist"
|
|
169
|
-
+ gdrive: now support uploading file to folder and return direct link (shareable link)
|
|
170
|
-
|
|
171
|
-
**Version 0.1.9**
|
|
172
|
-
|
|
173
|
-
+ add dependencies requirement.txt
|
|
174
|
-
|
|
175
|
-
**Version 0.1.8**
|
|
176
|
-
|
|
177
|
-
Fix bugs:
|
|
178
|
-
|
|
179
|
-
+ [performance] instead of inserting directly new rows into table dataframe, first insert it into in-memory `row_pool_dict`, that fill data in that dict into the actual dataframe when needed.
|
|
180
|
-
|
|
181
|
-
---
|
|
182
|
-
|
|
183
|
-
**Version 0.1.7**
|
|
184
|
-
|
|
185
|
-
Fix bugs:
|
|
186
|
-
|
|
187
|
-
+ fix insert into table so slow by allowing insert multiple rows at once
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
**Version 0.1.6**
|
|
192
|
-
|
|
193
|
-
New features:
|
|
194
|
-
|
|
195
|
-
+ add DFCreator for manipulating table (DataFrame) - create, insert row, display, write to file
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
**Version 0.1.5**
|
|
200
|
-
|
|
201
|
-
New Features
|
|
202
|
-
|
|
203
|
-
+ add cmd module
|
|
204
|
-
+ new package structure
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
**Version 0.1.4**
|
|
209
|
-
|
|
210
|
-
New Features
|
|
211
|
-
|
|
212
|
-
+ add support to create Bitbucket Project from template
|
|
213
|
-
|
|
214
|
-
---
|
|
215
|
-
|
|
216
|
-
**Version 0.1.2**
|
|
217
|
-
|
|
218
|
-
New Features
|
|
219
|
-
|
|
220
|
-
+ add support to upload local to google drive.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|