Replies: 2 comments 7 replies
-
Nothing should have broken from 0.4 to 0.6, this is likely a bug. Could you provide a way for us to reproduce the issue? |
Beta Was this translation helpful? Give feedback.
-
Hi Awni, thank you for fixing the previous bug I can confirm that the feature works, but I've found new issues with MLX 0.7.0 and they happen when I try to save model using model.save_weights('some_array.npz') I am getting the following internal errors and they don't occur on MLX 0.4.0, as before same code new version of MLX lib 0.4.0 works without any issues and 0.7.0 throws: When saving model class inherited from class that inherits nn.Module: File ".../lib/python3.10/site-packages/mlx/nn/layers/base.py", line 231, in save_weights When saving nn.Sequential model: EDITED: For second issue it remains unresolved and we'll try migrating to numpy.savez for now |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm encountering internal MLX errors after upgrading to version 0.6.0. The same code functions properly with version 0.4.0. I attempted to address this by calling mx.eval(model.parameters()) before method for m in model.modules(), but unfortunately, it didn't resolve the issue. Are there any new global flags introduced in version 0.6.0 that I should be aware of before running the project? For instance, something akin to mx.set_default_device(set_device) that could help maintain the same behavior as in version 0.4.0.
In version 0.6.0, mx.eval(model.parameters()) by itself returns the same error:
File "/myproject/utils/torch_utils.py", line 395, in initialize_weights_mlx for m in model.modules(): File ".../venv/lib/python3.10/site-packages/mlx/nn/layers/base.py", line 439, in modules self.apply_to_modules(lambda k, m: modulelist.append(m)) File ".../venv/lib/python3.10/site-packages/mlx/nn/layers/base.py", line 429, in apply_to_modules tree_flatten(mod.children(), prefix=prefix, is_leaf=self.is_module) File ".../venv/lib/python3.10/site-packages/mlx/nn/layers/base.py", line 305, in children return self.filter_and_map( File ".../venv/lib/python3.10/site-packages/mlx/nn/layers/base.py", line 287, in filter_and_map return { File ".../venv/lib/python3.10/site-packages/mlx/nn/layers/base.py", line 288, in <dictcomp> k: _unwrap(self, k, v, filter_fn, map_fn, is_leaf_fn) File ".../venv/lib/python3.10/site-packages/mlx/nn/layers/base.py", line 23, in _unwrap for k, v in v.items(): UnboundLocalError: local variable 'v' referenced before assignment
Regards,
Marijan
Beta Was this translation helpful? Give feedback.
All reactions