Skip to content

[Feature] Unsloth Studio / Desktop: cap GPU memory for XPU and MPS training, and make image generation honour the VRAM Budget #8178

Open

Description

@LeoBorcherding

Most of this issue has landed. What's left is narrower than the original ask, so the title and body now cover only that. Re-checked against main at 5ab5419 (2026-10-21).

Landed

That also settles the open question at the bottom of the old body: training and inference have separate controls with their own labels.

Still open

  1. XPU and MPS training are never capped. Both the env cap and the GiB budget only reach CUDA/ROCm devices. _apply_training_vram_budget returns early when torch.cuda isn't available (worker.py:2029), and the env cap block still notes "XPU and MPS are not wired yet" (worker.py:4741). Both backends have set_per_process_memory_fraction (torch.xpu, torch.mps). On MPS, memory is unified with the OS, so the cap matters more there, not less.
  2. Image generation ignores the VRAM Budget. Only llama_cpp.py and engine_adapters.py call get_vram_budget_fraction(). The diffusers image path plans offload against the whole card, and the sd.cpp path sizes --max-vram from free VRAM on its own (sd_cpp_args.py:439). Either wire both to the setting, or label the slider as covering only text models so it doesn't promise more than it does.

Related: #7878 (closed), #7960, #8589, #11077, #11491, #12996, #12998.

Activity

  1. olifarhaan commented on Aug 8, 2026

    @olifarhaan

    @LeoBorcherding is this feature open for contribution?

  2. LeoBorcherding commented on Aug 9, 2026

    @LeoBorcherding
    CollaboratorAuthor

    hi @olifarhaan it may be but i think I would like to get @danielhanchen 's opinion first as this will be a multi PR issue i think, each gpu glass will likely be a separate pr, and the UI design will need to be thought out as well. I would suggest maybe waiting before doing anything big.

  3. danielhanchen commented on Aug 9, 2026

    @danielhanchen
    Member

    Yes I think adding it in the Advanced settings dropdown can work for Inference - "auto" will be our default, then whatever fraction 90%, 95%, 99% for eg

  4. olifarhaan commented on Aug 9, 2026

    @olifarhaan

    hi @LeoBorcherding and @danielhanchen, we can structure the split so each backend PR can be merged independently after a small shared groundwork PR.

    Proposed order:

    1. Shared inference setting/schema groundwork:

      • Add the optional auto | 90% | 95% | 99% load-setting shape.
      • Keep default auto.
      • Preserve current behavior when unset.
    2. NVIDIA/CUDA inference PR:

      • Wire the fraction into the existing GGUF/llama.cpp VRAM budget path.
      • Add CUDA-specific tests.
    3. AMD inference PR:

      • Handle AMD separately, including Windows/Linux and unified-memory cases.
      • Add AMD-specific tests.
    4. Intel inference PR:

      • Wire and test Intel behavior separately.
    5. UI PR:

      • Add the Advanced settings dropdown once the backend contract is agreed.
      • It can land after the first supported backend, then mark unsupported backends as Auto-only if needed.

    Training should stay a later separate PR because it uses PyTorch allocator caps rather than the inference VRAM fitter.

  5. changed the title [-][Feature] Unsloth Studio: let users cap GPU memory from Settings, not just an env var (AMD, NVIDIA, Intel)[/-] [+][Feature] Unsloth Studio / Desktop: cap GPU memory for XPU and MPS training, and make image generation honour the VRAM Budget[/+] on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions