unsloth/studio
Daniel Han 12183e0656 studio: smart GPU allocation for GGUF inference
Automatically select the best GPU(s) for a GGUF model based on
file size and available VRAM, instead of relying on hardcoded
-ngl -1 or letting llama-server guess.

Logic:
1. Measure total GGUF file size (including split shards)
2. Query free memory per GPU via nvidia-smi
3. If the model fits in 70% of the most-free GPU's memory,
   pin to that single GPU (CUDA_VISIBLE_DEVICES=X, no --fit)
4. If it needs multiple GPUs, pick the N most-free GPUs
   (CUDA_VISIBLE_DEVICES=X,Y, no --fit)
5. If it's too large for all GPUs combined, omit
   CUDA_VISIBLE_DEVICES and use --fit on to let llama-server
   handle partial offloading

The 70% threshold accounts for KV cache and compute buffers
that sit on top of the model weights.

Removed the -ngl parameter (was hardcoded to -1). llama-server's
default of "auto" handles layer offloading correctly, especially
with --fit on for oversized models.

Tested on 8x B200:
  - 1B model (0.75 GB):  picks 1 GPU, no --fit
  - 27B model (17 GB):   picks 1 GPU, no --fit
  - 405B model (230 GB): picks 2 GPUs, no --fit
  - 2TB model:           all GPUs, --fit on
2026-03-15 05:24:06 -07:00
..
backend studio: smart GPU allocation for GGUF inference 2026-03-15 05:24:06 -07:00
frontend miscallenous studio (#4293) 2026-03-15 14:42:11 +04:00
__init__.py Final cleanup 2026-03-12 18:28:04 +00:00
install_python_stack.py [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-03-14 00:54:09 -07:00
LICENSE.AGPL-3.0 Add AGPL-3.0 license to studio folder 2026-03-09 19:36:25 +00:00
setup.bat Final cleanup 2026-03-12 18:28:04 +00:00
setup.ps1 PR: Windows Setup Improvements (#4299) 2026-03-14 23:59:49 +04:00
setup.sh studio: address review feedback 2026-03-14 00:54:09 -07:00
Unsloth_Studio_Colab.ipynb Final cleanup 2026-03-12 18:28:04 +00:00