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

Support for Apple MLX backend #1046

Open
notnotrishi opened this issue Oct 11, 2024 · 3 comments
Open

Support for Apple MLX backend #1046

notnotrishi opened this issue Oct 11, 2024 · 3 comments

Comments

@notnotrishi
Copy link

Would be nice to have support for language models on Apple MLX

@Harsha-Nori
Copy link
Member

Hi @notnotrishi, I'm a bit new to the MLX world. Do most people use the mlx_lm subpackage to interface with MLX based transformer models? https://github.com/ml-explore/mlx-examples/blob/main/llms/README.md

@notnotrishi
Copy link
Author

@Harsha-Nori yes, that's my understanding.

also, awni from mlx team is very helpful should your team has any questions

@painpoung
Copy link

Hi,
I don't know if someone pick up this but if not I would like to work on it (assuming you have time before it got implemented 😄 ).

The plan if I understand well is to propose something such as

from guidance import models, gen

# load a model (could be Transformers, LlamaCpp, VertexAI, OpenAI...)
mlx_model = models.MlxLM(path) 

# append text or generations to the model
mlx_model + f'Do you want a joke or a poem? ' + gen(stop='.')

And to do so we "just" need to add a _mlx.py in the models sub package (or like transformers with a sub package) using the mlx_lm library to handle the LLM (or the https://github.com/ToluClassics/mlx-transformers mlx-transformers cause it would be easier since I would only have to "copy" the _transformers.py or even just modify the _transformers.py via good check at the right place).

Am I totally off the track or Is it the path to follow?

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

3 participants