Repository navigation
Conversation
|
Confirmed the gate is only opened by the WSL drop-in in install.sh, so a pip install leaves SDPA on MATH, and setting it at the top of unsloth/init.py before torch loads is the right place. Could you take a look at the Security audit pip scan-packages hf-stack check, which is green on main but red here. |
|
@LeoBorcherding could you take a look at this one? |
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 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". |
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 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". |
|
Pushed 0bbf30c, which removes the Torch does not read That ordering is not hypothetical. The write is now unconditional. The rest of the change stands as written. One thing worth editing: the description still says torch reads the variable while loading its C++ extension, which is where the guard came from. On the red checks at 9909a0f, none of which come from this branch: |
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 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". |
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 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". |
|
CI has settled on c99258a. Four red checks, all of which reproduce on plain
The Windows
|
|
Confirmed main still only opens the gate in install.sh's WSL drop-in, so a pip install leaves ROCm SDPA on MATH, and the unconditional setdefault at the top of unsloth/init.py is the right place now that the sys.modules guard is gone. The Security audit pip scan-packages hf-stack check is still red here and green on main, could you take a look at that one. |
|
Heads up that #8821 opens the same AOTriton SDPA gate before torch loads and it landed independently. I asked there which of the two to keep; I will take one rather than merge both, so please hold off on further work here until that is settled. |
|
Closing in favour of #8821, which has the same |
Fixes the library-path half of #8819.
What
Set
TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1at the top ofunsloth/__init__.py, before anything below can import torch, viaos.environ.setdefaultso a pre-existing value — including an explicit"0"opt-out — always wins. Guarded ontorchnot already being imported, which is the only window where the variable can still take effect (torch reads it once while loading its C++ extension).Why
Per the issue's matrix, only
install.sh's ROCm-on-WSL drop-in opens the gate (confirmed:grep -r TORCH_ROCM_AOTRITONhits onlyinstall.shandscripts/install_rocm_wsl_strixhalo.sh). A user who runspip install unslothon bare-metal Linux or Windows AMD gets the O(N^2) MATH attention path: SDPA declines, MATH materialises the fullB x H x N x Nscore matrix, and finetuning memory grows with the square of the context — the issue measures 387.2 ms / 12.14 GiB vs 17.3 ms / 0.18 GiB for flash at N=9408, with1.221e-04(fp16 epsilon) accuracy difference.This is the library-path counterpart of what #8323 does inside the Studio backend process. Mirrors the file's existing pattern for
USE_TF/USE_FLAX(environment variables that must land before their reader's import). Harmless on non-ROCm hosts, which never read the variable.Validation
python -c "import ast; ast.parse(...)"on the patched filepython -c "import unsloth, os; print(os.environ['TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL'])"prints1; withTORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=0 python -c ...prints0(opt-out honoured); on ROCm hoststorch.backends.cuda.sdp_kernelselection then admits flash/mem_efficient — no ROCm hardware in this sandbox, per the issue's own one-liner for verification:python -c "import torch,os;d=os.path.join(os.path.dirname(torch.__file__),'lib');print([f for f in os.listdir(d) if 'aotriton' in f.lower()] or 'NO AOTRITON IN THIS WHEEL')"AI-assisted development disclosure
ZCode assisted with implementing the fix from the issue's proposed remedy. I reviewed the final diff, ran the validation above, and take responsibility for the submitted change.