feat: add mlx model and trainer#4258
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1bf8b6c685
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| elif DEVICE_TYPE != "mps": | ||
| from .models import * | ||
| from .models import __version__ |
There was a problem hiding this comment.
Move top-level exports out of device setup elif chain
This elif DEVICE_TYPE != "mps" block is attached to the earlier if/elif chain that handles CUDA/HIP/XPU initialization, so it is skipped on all those supported devices; as a result, the package no longer imports FastLanguageModel/other top-level symbols (breaking common usage like from unsloth import FastLanguageModel) and also skips _patch_trl_trainer() on those environments. This is a regression for standard GPU users introduced by the new conditional structure.
Useful? React with 👍 / 👎.
for more information, see https://pre-commit.ci
1bf8b6c to
76054a5
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 76054a562a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ) -> Tuple[Any, Any]: | ||
| print(f"Unsloth: Loading model with MLX: {model_name}") | ||
|
|
||
| model, tokenizer = load(model_name) |
There was a problem hiding this comment.
Forward
from_pretrained options into MLX loader
from_pretrained accepts arbitrary keyword arguments but drops them when calling load, so caller-supplied options (for example adapter_path when reopening a LoRA checkpoint) are silently ignored and the base model is loaded instead. This can produce incorrect inference/training continuation while appearing to succeed, because the API signature suggests those parameters are supported.
Useful? React with 👍 / 👎.
Replacement for #3856 due to Studio rebasing
hello everyone!
this PR aims to integrate mlx support in unsloth with minimal changes.
im attaching below a sample alpaca training run script to get this working.