Commit graph

4,672 commits

Author SHA1 Message Date
DoubleMathew
a835b266ef Fix auto padding free logic to respect user passed False (#4128)
* Fix auto padding free logic to respect user passed

* Update unsloth/trainer.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-01 19:30:47 -08:00
Wasim Yousef Said
dc7976c534 Merge pull request #294 from unslothai/fix/navbar-center-tabs-shift
Prevent navbar tab shift when navigating across pages
2026-03-01 15:42:19 +01:00
Wasim Yousef Said
2df2d671ce Merge pull request #290 from unslothai/fix/model-dropdown-visual-consistency
Standard OOM/TIGHT model status indicators across model dropdowns
2026-03-01 15:41:39 +01:00
Roland Tannous
674cc67d78 Tighten Python bounds to >= 3.11, < 3.14 (matching setup.sh), only auto-install if missing 2026-03-01 13:05:10 +00:00
Roland Tannous
d5644d2d0d Add Python 3.12 prerequisite check with auto-install via winget 2026-03-01 13:05:10 +00:00
Roland Tannous
0267ba0a18 Auto-enable Windows Long Paths via UAC elevation during setup 2026-03-01 13:05:10 +00:00
Roland Tannous
6536bfb33b Remove unused CMP0194 cmake policy (eliminates cmake warning) 2026-03-01 13:05:10 +00:00
Roland Tannous
453f423d22 Simplify: use winget OpenSSL.Dev instead of vcpkg for HTTPS support 2026-03-01 13:05:10 +00:00
Roland Tannous
2e102b683e Add vcpkg/curl[ssl] for HTTPS support in llama-server, enable LLAMA_CURL=ON 2026-03-01 13:05:10 +00:00
Roland Tannous
6e5a3d1744 Download GGUF via huggingface_hub instead of llama-server -hf (fixes HTTPS not supported on Windows) 2026-03-01 13:05:10 +00:00
Roland Tannous
9eb0ff074b Add .venv/Scripts to User PATH so unsloth-studio works without activation 2026-03-01 13:05:10 +00:00
Roland Tannous
8e22b16bd8 Simplify completion banner: no venv activation needed 2026-03-01 13:05:10 +00:00
Roland Tannous
12867f701b Auto-add CUDA DLLs to PATH when launching llama-server on Windows 2026-03-01 13:05:10 +00:00
Roland Tannous
d79fe439ed Warn user to uninstall incompatible CUDA toolkit instead of failed side-by-side 2026-03-01 13:05:10 +00:00
Roland Tannous
b22c5b6ed8 Fallback: try descending CUDA versions if exact driver-max install fails 2026-03-01 13:05:10 +00:00
Roland Tannous
7b4d074857 Always persist compatible CUDA_PATH to User registry (overwrite stale values) 2026-03-01 13:05:10 +00:00
Roland Tannous
7576552717 Fix: scan side-by-side CUDA installs, pick compatible toolkit version 2026-03-01 13:05:10 +00:00
Roland Tannous
3521de7040 Build llama.cpp in-tree, auto-detect driver CUDA version for compatible toolkit 2026-03-01 13:05:10 +00:00
Roland Tannous
8d272ff8d5 Auto-detect driver CUDA version, install compatible toolkit instead of latest 2026-03-01 13:05:10 +00:00
Roland Tannous
bccbd26f3a Fix non-ASCII chars in test script for Windows PS 5.1 2026-03-01 13:05:10 +00:00
Roland Tannous
1684e48b1e Add llama-cpp Windows test script, fix binary lookup paths 2026-03-01 13:05:10 +00:00
Roland Tannous
f036a70681 Fix llama-server binary lookup for Windows (.exe, Release dir, ~/.unsloth) 2026-03-01 13:05:10 +00:00
Roland Tannous
7e021886c8 Force num_proc=1 on Windows to avoid slow spawn overhead 2026-03-01 13:05:10 +00:00
Roland Tannous
bd7c17708b Set short TORCHINDUCTOR_CACHE_DIR to fix Windows MAX_PATH crash 2026-03-01 13:05:10 +00:00
Roland Tannous
e1cc5e61b1 Fix npm Invalid Version: delete package-lock.json, relax Node constraint 2026-03-01 13:05:10 +00:00
Roland Tannous
aba3d8e29b Enforce Node LTS (v20-v22), add npm error checking, clean node_modules 2026-03-01 13:05:10 +00:00
Roland Tannous
2dfe0abaa1 Fix npm stderr crash on Windows ErrorActionPreference 2026-03-01 13:05:10 +00:00
Roland Tannous
662a1eb9d5 Fix Windows frontend build, add setup.bat, ANSI colors, aliases 2026-03-01 13:05:10 +00:00
Roland Tannous
783f0caf5f add setup.bat 2026-03-01 13:05:10 +00:00
Roland Tannous
28bac1859a Extract shared install_python_stack.py for cross-platform setup 2026-03-01 13:05:10 +00:00
Roland Tannous
4aba18375b Merge pull request #295 from unslothai/fix/fix-local-vision-gguf-loading
fix: support mmproj for local vision GGUF models + fix Windows pipe d…
2026-03-01 17:03:24 +04:00
Roland Tannous
ff93c97024 fix: support mmproj for local vision GGUF models + fix Windows pipe deadlock 2026-03-01 12:58:38 +00:00
Shine1i
761c84f92b feat(recipe-studio): introduce validator blocks for code validation with Python and SQL engines 2026-03-01 13:01:00 +01:00
Shine1i
891739a56a feat(recipe-studio): add LLM trace modes and reasoning content extraction support 2026-03-01 12:01:48 +01:00
Shine1i
b7ee065ffd refactor(recipe-studio): add image preview support for dataset and LLM configurations p2 2026-03-01 11:21:10 +01:00
Shine1i
c3c65cded8 feat(recipe-studio): add image preview support for dataset and LLM configurations p1 2026-03-01 10:57:51 +01:00
Shine1i
4d718db5a0 feat(recipe-studio): auto-fit editor viewport on tab switch, track manual viewport adjustments 2026-03-01 10:21:02 +01:00
Daniel Han
54119f2060 rl: guard warnings_issued before TRL estimate_tokens write (#4034)
Co-authored-by: Daniel Hanchen <danielhanchen@users.noreply.github.com>
2026-03-01 00:42:37 -08:00
金黄色葡萄球君君
afd5b687aa Fix global dequantize buffer dtype mismatch across mixed-precision loads (#4026)
Fix global dequantize buffer dtype mismatch when loading multiple 4-bit models with different dtypes in the same process. Adds dtype check alongside existing None check for WEIGHT_BUFFER in both CUDA/HIP and XPU paths.
2026-03-01 00:15:47 -08:00
Manan17
c636fd5a42 code cleanup 2026-03-01 08:04:38 +00:00
金黄色葡萄球君君
721bf4852a perf(ROCm): optimize chunked CE loss num_warps for RDNA GPUs (#4123)
Use 16 warps for RDNA in the chunked cross-entropy forward kernel
(large vocab > 65536), matching the existing CDNA optimization.

Benchmarked on W7900 (gfx1100) with actual unsloth kernels (5 trials, median):
  - Chunked CE forward (BS=65536): 16 warps = 2.4-2.6x faster than 32
  - All other kernels (LayerNorm, RoPE, SwiGLU): default heuristic is
    already optimal for RDNA; no modification needed.

Depends on: #4109 (provides is_rdna() detection)
2026-02-28 23:59:34 -08:00
金黄色葡萄球君君
48e8f78042 fix(ROCm): prevent false TMA support detection on AMD GPUs (#4126)
TMA (Tensor Memory Accelerator) is an NVIDIA Hopper+ feature that does
not exist on AMD GPUs.  However, _check_tma_support() incorrectly
returns True on ROCm because:

1. torch.cuda.get_device_capability() returns (11, 0) for gfx1100,
   satisfying the >= 9 check intended for Hopper (sm_90).
2. ROCm Triton exports tl.make_tensor_descriptor (the symbol exists
   even though the hardware does not support TMA).

This would cause MoE grouped_gemm to attempt TMA operations on AMD
GPUs, leading to runtime failures.

Fix: early-return False for HIP devices, matching the existing XPU
guard.
2026-02-28 23:59:27 -08:00
金黄色葡萄球君君
17795e4f14 fix(Triton): ensure float32 eps in RMS LayerNorm rsqrt for HIP/ROCm (#4110)
* fix(Triton): ensure float32 eps in RMS LayerNorm rsqrt for HIP/ROCm

On HIP (AMD ROCm), Triton constexpr eps may not promote to float32
in rsqrt, causing numerical instability (NaN/Inf) on RDNA GPUs
(gfx1100, gfx1151 Strix Halo, etc.).

Use tl.full((), eps, tl.float32) to explicitly create a float32
scalar before adding to row_var in rsqrt. Applied to both standard
and Gemma RMS LayerNorm forward kernels.

Tested on W7900 (gfx1100): full test suite passed (dim 512-2048,
bf16/fp16, various seqlen).

Related: #3385, #3588

* Apply same float32 eps fix to layernorm.py for PR #4110

layernorm.py has the identical tl.constexpr eps pattern in
layernorm_forward that can misfire on HIP/ROCm. Apply the same
tl.full((), eps, tl.float32) fix for consistency.

Both testing_suite_layernorm (standard LayerNorm) and
testing_suite_layernorm (RMS LayerNorm) pass on NVIDIA after
this change.

---------

Co-authored-by: Daniel Han <danielhanchen@gmail.com>
2026-02-28 23:59:22 -08:00
金黄色葡萄球君君
8a8dcd48dd fix(ROCm): Comprehensive RDNA GPU support - fix Gemma3 NaN & add is_rdna() (#4109)
* fix(ROCm): comprehensive RDNA GPU support - fix Gemma3 NaN & add is_rdna()

- Add is_rdna() detection for RDNA3/3.5/RDNA4 consumer GPUs (gfx11xx, gfx1151, gfx12xx)
- Disable torch.compile for Gemma3 on HIP to fix NaN loss (fixes #3385, #4029)
- Export is_cdna/is_rdna from kernels for downstream use
- Import is_rdna into cross_entropy_loss for future RDNA-specific tuning

Tested on AMD Radeon PRO W7900 (gfx1100) with ROCm 7.1:
  ✓ Gemma3-1B: loss 3.37→3.25 (no NaN)
  ✓ Llama-3.2-1B: loss 2.44→2.37 (no NaN)
  ✓ Qwen2.5-1.5B: loss 1.89→1.85 (no NaN)
  ✓ RMS LayerNorm Triton kernel: bf16/fp16 PASSED
  ✓ Cross Entropy Loss Triton kernel: 32K/256K vocab PASSED

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Address review: scope compile disable to RDNA only, use partial mode, remove unused import

Changes based on Daniel's review:
1. (HIGH) Replace DEVICE_TYPE=='hip' with is_rdna() to avoid disabling
   torch.compile on CDNA GPUs (MI250X/MI300X/MI350) where it works fine
2. (MEDIUM) Use 'partial' instead of '1' for UNSLOTH_COMPILE_DISABLE to
   only disable model forward compilation while keeping loss compilation,
   matching the existing Sesame pattern
3. (LOW) Remove unused is_rdna import from cross_entropy_loss.py (F401)

* Remove redundant is_cdna/is_rdna exports from kernels/__init__.py

These functions are imported directly from .utils where needed
(e.g. cross_entropy_loss.py, loader.py). No external code imports
them from the unsloth.kernels namespace.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-28 23:59:17 -08:00
金黄色葡萄球君君
a3a1c3457f fix(ROCm): remove fix_rocm_triton_key_error — based on a false premise (#4125)
The function (introduced in #3923) assumed that the absence of
`triton.runtime.triton_key` on ROCm means torch.compile will crash.
Investigation shows this is incorrect:

1. `triton.runtime.triton_key` was renamed/removed in the ROCm Triton
   fork — it does not exist at that path.  However,
   `triton.compiler.compiler.triton_key` (the path torch._inductor
   actually imports) EXISTS and works correctly on ROCm.

2. Both call-sites in torch._inductor (codecache.py and
   async_compile.py) already wrap the import in try/except, so even a
   genuinely missing triton_key would be handled gracefully.

3. Comprehensive testing on ROCm 7.1 + Triton 3.4.0 + gfx1100 confirms
   torch.compile works correctly for matmul, cross-entropy, RMSNorm,
   multi-layer transformer forward+backward, and LoRA — all without
   triton.runtime.triton_key.

The original code was also ineffective (environment variables set after
torch import have no effect on torch._dynamo config), so removing it
has zero behavioral change on existing installations.

Supersedes the compile-disable portion of #3923.
2026-02-28 23:59:12 -08:00
imagineer99
471fc8fd90 fix: prevent navbar tab shift when navigating across pages 2026-03-01 03:02:49 +00:00
Manan17
c48437848d revamping up the code and adding inference 2026-03-01 02:30:31 +00:00
Manan17
ab2ac39017 Changes with audio training 2026-03-01 02:27:45 +00:00
Manan17
ac27edde35 merging with nightly 2026-03-01 02:27:45 +00:00
imagineer99
42f5ba5fcc fix: standardize OOM/TIGHT model status indicators across model dropdowns 2026-03-01 00:02:15 +00:00