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

add mlx support #1089

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft

add mlx support #1089

wants to merge 3 commits into from

Conversation

davidberenstein1957
Copy link
Member

@davidberenstein1957 davidberenstein1957 commented Dec 30, 2024

Use it individually

from distilabel.models.llms import MlxLLM

llm = MlxLLM(model="mlx-community/Meta-Llama-3.1-8B-Instruct-4bit")

llm.load()

# Call the model
output = llm.generate_outputs(inputs=[[{"role": "user", "content": "Hello world!"}]])

Use it with magpie

from distilabel.models.llms.mlx import MlxLLM
from distilabel.steps.tasks import Magpie

model = MlxLLM(
    path_or_hf_repo="mlx-community/Meta-Llama-3.1-8B-Instruct-8bit",
    use_magpie_template=True,
    magpie_pre_query_template="llama3",
)
task = Magpie(llm=model)
task.load()

It is relatively easy to spin up an mlx server, but no public Python API clients are available except for LangChain https://python.langchain.com/docs/integrations/chat/mlx/. Currently, the OpenAIAPI does not align with the payloads from both the chat and the text generation API.

Copy link

Documentation for this PR has been built. You can view it at: https://distilabel.argilla.io/pr-1089/

Copy link

codspeed-hq bot commented Dec 30, 2024

CodSpeed Performance Report

Merging #1089 will not alter performance

Comparing feat/add-support-mlx (162f73e) with develop (f1f7d77)

Summary

✅ 1 untouched benchmarks

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