Skip to content

Commit

Permalink
Fix KeyError raised in Module.update.
Browse files Browse the repository at this point in the history
e.g., load safetensors from black-forest-labs/FLUX.1-Depth-dev-lora.
  • Loading branch information
hehua2008 committed Nov 27, 2024
1 parent 211411f commit e42ac51
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/mlx/nn/layers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ def apply(dst, parameters):
elif isinstance(current_value, (dict, list)):
apply(current_value, new_value)
elif isinstance(parameters, list):
if isinstance(dst, dict):
from mlx.nn.layers.containers import Sequential
if isinstance(dst, Sequential):
dst = dst["layers"]
for i in range(len(parameters)):
current_value = dst[i]
new_value = parameters[i]
Expand Down

0 comments on commit e42ac51

Please sign in to comment.