fix: deep-convert JSON lists to tuples for cached target_keys
target_key can be a nested tuple like ("key", (dim, start, size)).
JSON round-trips flatten this to ["key", [dim, start, size]].
The shallow tuple() conversion only fixed the outer level, leaving
inner lists unhashable — causing TypeError in single_lora_keys.add().
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
be1847cc37
commit
d6c8bfbf73
+9
-2
@@ -98,6 +98,13 @@ COMMUNITY_CACHE_BASE_URL = (
|
||||
|
||||
|
||||
|
||||
def _json_to_tuples(obj):
|
||||
"""Recursively convert JSON lists back to tuples (for cache round-trips)."""
|
||||
if isinstance(obj, list):
|
||||
return tuple(_json_to_tuples(x) for x in obj)
|
||||
return obj
|
||||
|
||||
|
||||
def _read_safetensors_metadata(filepath):
|
||||
"""Read metadata header from a safetensors file without loading tensors."""
|
||||
try:
|
||||
@@ -4972,7 +4979,7 @@ class LoRAOptimizer(_LoRAMergeBase):
|
||||
magnitude_samples.append(t)
|
||||
|
||||
tk = cached_prefix["target_key"]
|
||||
target_key = tuple(tk) if isinstance(tk, list) else tk
|
||||
target_key = _json_to_tuples(tk)
|
||||
|
||||
per_lora_norm_sq = {int(k): float(v) for k, v in per_lora_norm_sq_raw.items()}
|
||||
|
||||
@@ -5053,7 +5060,7 @@ class LoRAOptimizer(_LoRAMergeBase):
|
||||
# Get prefix-level metadata from any participating LoRA's entry
|
||||
first = lora_entries[min(participating)]
|
||||
tk = first["target_key"]
|
||||
target_key = tuple(tk) if isinstance(tk, list) else tk
|
||||
target_key = _json_to_tuples(tk)
|
||||
|
||||
return (
|
||||
prefix,
|
||||
|
||||
Reference in New Issue
Block a user