Skip to content

Fix tree_map_with_path for namedtuples#3674

Open
chrismicah wants to merge 2 commits into
ml-explore:mainfrom
chrismicah:codex/fix-tree-map-with-path-namedtuple
Open

Fix tree_map_with_path for namedtuples#3674
chrismicah wants to merge 2 commits into
ml-explore:mainfrom
chrismicah:codex/fix-tree-map-with-path-namedtuple

Conversation

@chrismicah

Copy link
Copy Markdown

Summary\n- preserve namedtuple reconstruction in tree_map_with_path, matching tree_map behavior\n- add tree utils coverage for namedtuple tree_map_with_path paths and return type\n\n## Tests\n- python -m black --check python/mlx/utils.py python/tests/test_tree.py\n- PYTHONPATH=/private/tmp/mlx-upstream-pr-work/python python - <<'PY' ... pure namedtuple tree_map_with_path repro passed\n\nNote: python python/tests/test_tree.py could not run in this sandbox because importing mlx.nn aborts with no Metal device available before reaching the tree tests.

@chrismicah

Copy link
Copy Markdown
Author

Added one more regression in chrismicah/codex/fix-tree-map-with-path-namedtuple@243b1c94 covering tree_map_with_path over a NamedTuple with a matching rest tree, so the fix is not only single-tree reconstruction.\n\nVerification:\n- Passed a Metal-free pure-Python import of python/mlx/utils.py exercising NamedTuple single-tree and rest-tree cases.\n- python python/tests/test_tree.py cannot run in this headless environment because installed mlx fails during import with [metal::load_device] No Metal device available before reaching test_tree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant