Datasets:
Rebuild: layer-bits path normalization
Browse files- kit_manifest.json +2 -2
- scripts/rht_int4_convert.py +14 -2
kit_manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"built_from_commit": "
|
| 3 |
"capabilities": [
|
| 4 |
"rht_int4_convert.layer_filter",
|
| 5 |
"eval_quantized.dtype",
|
|
@@ -17,7 +17,7 @@
|
|
| 17 |
"attention.mesh_context"
|
| 18 |
],
|
| 19 |
"files": {
|
| 20 |
-
"scripts/rht_int4_convert.py": "
|
| 21 |
"scripts/rewrite_lalamo_hybrid_spec.py": "154564c88391f81b5c24f64125d99abc15d81bd082a8264e36d43a00d4c47a04",
|
| 22 |
"scripts/normalize_lalamo_config.py": "248a5a07d0829c9e383eeba1a5204e88abdc065f78737d1191d376a1f37476c4",
|
| 23 |
"scripts/make_lalamo_eval_copy.py": "5563e8542ef51e57cc6ed5cff48fcc81d58fb6487d75350df8273cfad948a500",
|
|
|
|
| 1 |
{
|
| 2 |
+
"built_from_commit": "975fe2a602250e608ef8ab9307845d0639bb1c65",
|
| 3 |
"capabilities": [
|
| 4 |
"rht_int4_convert.layer_filter",
|
| 5 |
"eval_quantized.dtype",
|
|
|
|
| 17 |
"attention.mesh_context"
|
| 18 |
],
|
| 19 |
"files": {
|
| 20 |
+
"scripts/rht_int4_convert.py": "c8e97f238d0ab8daf8e2c2cb5a7c371c929d6bb283ee2216d5f3182b421fad1e",
|
| 21 |
"scripts/rewrite_lalamo_hybrid_spec.py": "154564c88391f81b5c24f64125d99abc15d81bd082a8264e36d43a00d4c47a04",
|
| 22 |
"scripts/normalize_lalamo_config.py": "248a5a07d0829c9e383eeba1a5204e88abdc065f78737d1191d376a1f37476c4",
|
| 23 |
"scripts/make_lalamo_eval_copy.py": "5563e8542ef51e57cc6ed5cff48fcc81d58fb6487d75350df8273cfad948a500",
|
scripts/rht_int4_convert.py
CHANGED
|
@@ -147,11 +147,23 @@ def should_quantize(path: str, filters: list[str]) -> bool:
|
|
| 147 |
return any(item in path for item in filters)
|
| 148 |
|
| 149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
def resolve_bits(path: str, rules: list[dict], default: int) -> int:
|
| 151 |
"""First rule whose ``match`` substring appears in the layer path wins."""
|
|
|
|
| 152 |
for rule in rules:
|
| 153 |
-
match = str(rule.get("match", ""))
|
| 154 |
-
if match and match in
|
| 155 |
return int(rule["bits"])
|
| 156 |
return default
|
| 157 |
|
|
|
|
| 147 |
return any(item in path for item in filters)
|
| 148 |
|
| 149 |
|
| 150 |
+
def _normalize_path(path: str) -> str:
|
| 151 |
+
"""Drop the leading dots lalamo uses per component.
|
| 152 |
+
|
| 153 |
+
Site paths look like ``.decoder/.transformer/.layers/[0]/.mlp/.down_projection``
|
| 154 |
+
while the lane spec writes ``mlp/down_projection``, so a naive substring
|
| 155 |
+
test never matched and every layer stayed at the default bits (measured:
|
| 156 |
+
uniform4 and down-out6 produced identical PPL).
|
| 157 |
+
"""
|
| 158 |
+
return path.replace(".", "")
|
| 159 |
+
|
| 160 |
+
|
| 161 |
def resolve_bits(path: str, rules: list[dict], default: int) -> int:
|
| 162 |
"""First rule whose ``match`` substring appears in the layer path wins."""
|
| 163 |
+
normalized = _normalize_path(path)
|
| 164 |
for rule in rules:
|
| 165 |
+
match = _normalize_path(str(rule.get("match", "")))
|
| 166 |
+
if match and match in normalized:
|
| 167 |
return int(rule["bits"])
|
| 168 |
return default
|
| 169 |
|