Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mlx - fix error with loading models with h5 and update mlx.core.while_loop #20819

Merged
merged 2 commits into from
Jan 29, 2025

Conversation

acsweet
Copy link

@acsweet acsweet commented Jan 28, 2025

This addresses #19571

multi_head_attention_test.py::MultiHeadAttentionTest::test_lora test was failing on loading the model.
It was due to mlx.core.array() not able to load h5py Dataset objects. Now loading it with numpy first.

Does that check I added in mlx.core.convert_to_tensor look good?

Copy link
Collaborator

@fchollet fchollet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

if _is_h5py_dataset(x):
if h5py is None:
raise ImportError(
"h5py must be installed in order to load a model."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this might be raised outside of model loading context (maybe someone is just reading some h5 data). Let's make the error message generic

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Jan 29, 2025
@fchollet fchollet merged commit a008598 into keras-team:mlx Jan 29, 2025
2 of 7 checks passed
@google-ml-butler google-ml-butler bot removed ready to pull Ready to be merged into the codebase kokoro:force-run labels Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Assigned Reviewer
Development

Successfully merging this pull request may close these issues.

3 participants