halib 0.2.23__tar.gz → 0.2.27__tar.gz
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-0.2.23 → halib-0.2.27}/PKG-INFO +2 -2
- {halib-0.2.23 → halib-0.2.27}/README.md +1 -1
- {halib-0.2.23 → halib-0.2.27}/halib/utils/dict.py +48 -1
- {halib-0.2.23 → halib-0.2.27}/halib.egg-info/PKG-INFO +2 -2
- {halib-0.2.23 → halib-0.2.27}/setup.py +1 -1
- {halib-0.2.23 → halib-0.2.27}/.gitignore +0 -0
- {halib-0.2.23 → halib-0.2.27}/GDriveFolder.txt +0 -0
- {halib-0.2.23 → halib-0.2.27}/LICENSE.txt +0 -0
- {halib-0.2.23 → halib-0.2.27}/MANIFEST.in +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/__init__.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/common/__init__.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/common/common.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/common/rich_color.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/__init__.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/core/__init__.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/core/base_config.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/core/base_exp.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/core/param_gen.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/core/wandb_op.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/data/__init__.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/data/dataclass_util.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/data/dataset.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/data/torchloader.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/perf/__init__.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/perf/flop_calc.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/perf/gpu_mon.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/perf/perfcalc.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/perf/perfmetrics.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/perf/perftb.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/perf/profiler.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/viz/__init__.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/exp/viz/plot.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/filetype/__init__.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/filetype/csvfile.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/filetype/ipynb.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/filetype/jsonfile.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/filetype/textfile.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/filetype/videofile.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/filetype/yamlfile.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/online/__init__.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/online/gdrive.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/online/gdrive_mkdir.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/online/projectmake.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/online/tele_noti.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/system/__init__.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/system/_list_pc.csv +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/system/cmd.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/system/filesys.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/system/path.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/utils/__init__.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib/utils/list.py +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib.egg-info/SOURCES.txt +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib.egg-info/dependency_links.txt +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib.egg-info/requires.txt +0 -0
- {halib-0.2.23 → halib-0.2.27}/halib.egg-info/top_level.txt +0 -0
- {halib-0.2.23 → halib-0.2.27}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: halib
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.27
|
|
4
4
|
Summary: Small library for common tasks
|
|
5
5
|
Author: Hoang Van Ha
|
|
6
6
|
Author-email: hoangvanhauit@gmail.com
|
|
@@ -56,7 +56,7 @@ Dynamic: summary
|
|
|
56
56
|
|
|
57
57
|
## v0.2.x (Experiment & Core Updates)
|
|
58
58
|
|
|
59
|
-
### **v0.2.
|
|
59
|
+
### **v0.2.27**
|
|
60
60
|
- ✨ **New Feature:** Added `utils.dict.DictUtils` for advanced dictionary manipulations (merging, filtering, transforming).
|
|
61
61
|
|
|
62
62
|
- ✨ **New Feature:** Added `common.common.pprint_stack_trace` to print stack traces with optional custom messages and force stop capability.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## v0.2.x (Experiment & Core Updates)
|
|
4
4
|
|
|
5
|
-
### **v0.2.
|
|
5
|
+
### **v0.2.27**
|
|
6
6
|
- ✨ **New Feature:** Added `utils.dict.DictUtils` for advanced dictionary manipulations (merging, filtering, transforming).
|
|
7
7
|
|
|
8
8
|
- ✨ **New Feature:** Added `common.common.pprint_stack_trace` to print stack traces with optional custom messages and force stop capability.
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
from pygments.token import Other
|
|
1
2
|
from typing import Dict, Any, Callable, Optional
|
|
2
3
|
from rich.pretty import pprint
|
|
4
|
+
import json
|
|
5
|
+
import hashlib
|
|
6
|
+
|
|
3
7
|
|
|
4
8
|
class DictUtils:
|
|
5
9
|
"""
|
|
@@ -112,8 +116,26 @@ class DictUtils:
|
|
|
112
116
|
target = {}
|
|
113
117
|
target[parts[-1]] = value
|
|
114
118
|
|
|
119
|
+
@staticmethod
|
|
120
|
+
def get_unique_hash(input_dict, length=12):
|
|
121
|
+
"""
|
|
122
|
+
Returns a unique hash string for a dictionary.
|
|
115
123
|
|
|
116
|
-
|
|
124
|
+
:param input_dict: The dictionary params
|
|
125
|
+
:param length: The desired length of the hash string (default 12)
|
|
126
|
+
"""
|
|
127
|
+
assert length >= 12, "Hash length must be at least 12 to ensure uniqueness."
|
|
128
|
+
# 1. Sort keys to ensure {a:1, b:2} == {b:2, a:1}
|
|
129
|
+
config_str = json.dumps(input_dict, sort_keys=True)
|
|
130
|
+
|
|
131
|
+
# 2. Generate full SHA-256 hash (64 chars long)
|
|
132
|
+
full_hash = hashlib.sha256(config_str.encode("utf-8")).hexdigest()
|
|
133
|
+
|
|
134
|
+
# 3. Truncate to desired length
|
|
135
|
+
return full_hash[:length]
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def test_update():
|
|
117
139
|
# --- Setup ---
|
|
118
140
|
base_config = {
|
|
119
141
|
"model": {
|
|
@@ -154,3 +176,28 @@ if __name__ == "__main__":
|
|
|
154
176
|
# --- Deep Update (The Solution) ---
|
|
155
177
|
pprint("Deep Update Result:")
|
|
156
178
|
pprint(DictUtils.deep_update(b2, n2))
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def test_hash():
|
|
182
|
+
# --- Usage ---
|
|
183
|
+
cfg1 = {"learning_rate": 0.01, "batch_size": 32, "optimizer": "adam"}
|
|
184
|
+
cfg1_shuffle = {
|
|
185
|
+
"batch_size": 32,
|
|
186
|
+
"optimizer": "adam",
|
|
187
|
+
"learning_rate": 0.01,
|
|
188
|
+
}
|
|
189
|
+
cfg2 = {"learning_rate": 0.02, "batch_size": 32, "optimizer": "adam"}
|
|
190
|
+
hash1 = DictUtils.get_unique_hash(cfg1)
|
|
191
|
+
hash2 = DictUtils.get_unique_hash(cfg1_shuffle)
|
|
192
|
+
hash3 = DictUtils.get_unique_hash(cfg2)
|
|
193
|
+
pprint(f"Config 1 Hash: {hash1}")
|
|
194
|
+
pprint(f"Config 1_shuffle Hash: {hash2}")
|
|
195
|
+
pprint(f"Config 2 Hash: {hash3}")
|
|
196
|
+
|
|
197
|
+
assert hash1 == hash2, "Hashes should match for identical dicts."
|
|
198
|
+
assert hash1 != hash3, "Hashes should differ for different dicts."
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
if __name__ == "__main__":
|
|
202
|
+
test_update()
|
|
203
|
+
test_hash()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: halib
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.27
|
|
4
4
|
Summary: Small library for common tasks
|
|
5
5
|
Author: Hoang Van Ha
|
|
6
6
|
Author-email: hoangvanhauit@gmail.com
|
|
@@ -56,7 +56,7 @@ Dynamic: summary
|
|
|
56
56
|
|
|
57
57
|
## v0.2.x (Experiment & Core Updates)
|
|
58
58
|
|
|
59
|
-
### **v0.2.
|
|
59
|
+
### **v0.2.27**
|
|
60
60
|
- ✨ **New Feature:** Added `utils.dict.DictUtils` for advanced dictionary manipulations (merging, filtering, transforming).
|
|
61
61
|
|
|
62
62
|
- ✨ **New Feature:** Added `common.common.pprint_stack_trace` to print stack traces with optional custom messages and force stop capability.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|