Fix non-strict module update with extra weights (#3214)

Co-authored-by: Michelle DiMarco <[email protected]>
This commit is contained in:
Michelle DiMarco
2026-03-09 22:03:50 -07:00
committed by GitHub
co-authored by Michelle DiMarco
parent 6ac5280db4
commit d2702a4fc1
2 changed files with 24 additions and 0 deletions
+7
View File
@@ -340,6 +340,13 @@ class Module(dict):
raise ValueError(f'Module does not have parameter named "{k}".')
elif isinstance(parameters, list):
for i in range(len(parameters)):
if i >= len(dst):
if strict:
raise ValueError(
f"List index {i} is out of bounds for "
f"destination of length {len(dst)}."
)
continue
current_value = dst[i]
new_value = parameters[i]
if isinstance(current_value, mx.array):