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

Is there an example code for convert hugging face model to pytorch then mlx ? #95

Open
znsoftm opened this issue Dec 9, 2023 · 1 comment

Comments

@znsoftm
Copy link

znsoftm commented Dec 9, 2023

as title

@jbarrow
Copy link
Contributor

jbarrow commented Dec 10, 2023

Most HuggingFace models are (default) already in PyTorch. Check out the https://github.com/ml-explore/mlx-examples repo, there's a script to convert the weights from HuggingFace BERT to an MLX model: https://github.com/ml-explore/mlx-examples/blob/main/bert/convert.py

The rest of the BERT example shows how the model is implemented. You need to ensure that the tensors are mapped correctly and that the computations are set up exactly the same.

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

No branches or pull requests

2 participants