Skip to content

Legacy CLI: accept --dtype None on every backend, not only MLX - #15775

Merged
danielhanchen merged 2 commits into
unslothai:mainfrom
vineethsaivs:fix-legacy-cli-dtype-none
Nov 6, 2026
Merged

danielhanchen merged 2 commits into
unslothai:mainfrom
vineethsaivs:fix-legacy-cli-dtype-none

Conversation

@vineethsaivs

Copy link
Copy Markdown
Contributor

The legacy unsloth-cli.py documents --dtype None (its own usage example, and the help says "None for auto detection"), but on every non-MLX backend it crashes: FastLanguageModel.from_pretrained asserts dtype is None or a torch dtype, and the CLI passes the string "None".

Cause: _normalize_dtype (added in #6709) only mapped "None" to None when is_mlx was true.

Fix: map "", none and auto (any case) to None on every backend, and drop the unused is_mlx parameter.

Test: unsloth_cli/tests/test_legacy_cli_dtype.py runs run(args) with stubbed unsloth, datasets, transformers and trl and checks the dtype that reaches from_pretrained. It fails before (4 failed, assert '' == None and the other spellings) and passes after (5 passed). ruff check is clean. I did not run the real loader (no accelerator here).

The script's own usage line passes --dtype None, but only the MLX path turned
the string into None. FastLanguageModel.from_pretrained asserts dtype is a
real None or a torch dtype, so the documented command died with an
AssertionError. Normalize None, none, auto and an empty value for every backend.
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T08:30:17.905498Z d55c08e Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: d55c08eeda

ℹ️ 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".

@danielhanchen
danielhanchen merged commit 69854d6 into unslothai:main Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants