Repository navigation
CPU backend: honour unsloth_tiled_mlp and UNSLOTH_TILED_MLP in FastLanguageModel.from_pretrained - #16731
Merged
Conversation
…nguageModel.from_pretrained On a host with no accelerator, unsloth_zoo's FastCPUModel dropped the unsloth_tiled_mlp kwarg and never read UNSLOTH_TILED_MLP, so tiling was silently off while an explicit unsloth.tile_mlp(model) worked. Tile at load through unsloth/tiling.py's loader_tile_mlp, as the GPU loaders do.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[skip ci]
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On a host with no accelerator, Unsloth Zoo's
FastCPUModel.from_pretraineddrops theunsloth_tiled_mlpkwarg and never readsUNSLOTH_TILED_MLP, so sequence tiling was silently off, with no message, while an explicitunsloth.tile_mlp(model)worked. Sequence tiling is plain torch, so it runs on CPU.Change
unsloth/_cpu_init.py:FastLanguageModel.from_pretrainedtakesunsloth_tiled_mlp, checks it withcheck_tiling_available, loads throughFastCPUModel, then tiles throughloader_tile_mlp, the same helper the GPU loaders use (UNSLOTH_TILED_MLPstill wins).Testing
tests/test_cpu_backend_tiled_mlp.py(kwarg and env var both tile the MLPs)CPU gloo composition run: tiled MLP on tiny OLMoE and Qwen3-MoE, eager, matches one process under single process, DDP and FSDP2 (tiles run 96 per step in one process, 48 + 48 per rank).