Skip to content

Studio engines: keep the NVIDIA driver's library path so engines run on Colab - #12269

Merged
danielhanchen merged 1 commit into
studio-opt-in-engines-basefrom
studio-engines-driver-path
Sep 30, 2026
Merged

danielhanchen merged 1 commit into
studio-opt-in-engines-basefrom
studio-engines-driver-path

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Stacked on #11491 (base studio-opt-in-engines-base, which tracks its head).

Problem

On Colab the NVIDIA driver (libcuda.so.1) is not in the loader cache. It lives in /usr/lib64-nvidia and is reached only through LD_LIBRARY_PATH=/usr/lib64-nvidia. The managed engine launch and the engine install checks both drop LD_LIBRARY_PATH entirely, so on Colab:

  • vLLM installation fails at its final check (the engine's device detection finds no GPU), leaving no install record.
  • SGLang installs, then every load fails with RuntimeError: No accelerator (CUDA, XPU, HPU, NPU, MUSA, MPS) or platform plugin is available.

Probe on a fresh Colab L4 (driver 580.82.07):

LD_LIBRARY_PATH=/usr/lib64-nvidia
ldconfig -p | grep libcuda        -> (nothing)
python3 -c 'import torch; print(torch.cuda.is_available())'                        -> True
env -u LD_LIBRARY_PATH python3 -c 'import torch; print(torch.cuda.is_available())' -> False

Fix

driver_library_path(env) keeps only the LD_LIBRARY_PATH entries that contain libcuda.so.1. Every other entry is still dropped, so a CUDA runtime that Studio's own environment points at never shadows the engine's locked one. It is applied to:

  • the engine process environment (managed_engine.py)
  • the installer environment used by the install checks (engine_install.install_environment)

WSL guests are unaffected: they build their own environment, and the guest finds the driver through /usr/lib/wsl/lib.

Tests

  • test_only_driver_directories_survive_the_library_path: a driver dir is kept; runtime dirs, empty and relative entries are dropped.
  • test_installer_keeps_the_driver_its_checks_import: the installer environment keeps the driver dir and drops a CUDA 12 runtime dir.
  • test_server_outlives_short_lived_start_thread: the launched engine sees only the driver dir.

The last two fail with the fix reverted (3 failures). test_managed_engines.py, test_managed_engine_tools.py and test_engine_api_key_transport.py: 218 passed.

Colab L4, full Studio

install.sh --local from this tree, both engines installed with Studio's installer, started through ManagedEngine, then chat, stream and a forced get_weather tool call with unsloth/Qwen2.5-0.5B-Instruct, run twice per engine:

Without this fix With this fix
vLLM 0.26.0 install fails, no install record installed, current
SGLang 0.5.17 install installed installed, current
vLLM load + requests "The selected engine is no longer installed." PASS 2/2 (fraction 0.846, tool call get_weather)
SGLang load + requests "No accelerator ... is available." PASS 2/2 (fraction 0.801, tool call get_weather)
Engine key on argv / /invocations without key n/a not on argv / 401

@danielhanchen danielhanchen self-assigned this Sep 29, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 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-09-29T09:17:15.065931Z 62924cc Manual request
🔒 Security Review ✅ Completed 2026-09-29T09:18:54.093498Z 62924cc 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.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 62924ccfcb

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 62924ccfcb

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@danielhanchen
danielhanchen merged commit 25c3650 into studio-opt-in-engines-base Sep 30, 2026
44 checks passed
@danielhanchen
danielhanchen deleted the studio-engines-driver-path branch September 30, 2026 11:54
danielhanchen added a commit that referenced this pull request Oct 2, 2026
…12024)

* Studio: add opt-in vLLM and SGLang inference engines

* Studio: extend optional engines with vision, precision and parallel modes

* Studio: allow loading explicitly restored inference engines

* Studio: support tool calling with managed inference engines

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

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

* Restore managed engine settings on rollback and launch the normalized local path

* Run optional engine checks in validate before the picker unloads

* Patch the httpx module the managed tool route imports in its tests

* Fetch remote image URLs in Studio before forwarding them to a managed engine

* Give managed engine requests the llama-server first-token deadline

* Refuse an outdated engine profile on the backend unless it was restored

* Name the text encoding for engine subprocess output and the lease file

* Update repository guard tests for the optional engine changes

* Run optional engines on Studio's PyTorch instead of a separate Python 3.12 environment

* Keep the chat GPU claim when a managed engine does not stop on unload

* Report a managed engine that survives load cancellation and keep it holding the chat GPU claim

* Launch managed engines only on GPUs visible to Studio

* Default the engine GPU picker to the first GPU Studio sees

* Load a compare pane with its remembered vLLM or SGLang settings

* Validate a model switch on the GPUs its load will use

* Trim comments in opt-in engine code

* Send managed engines only data URL images

SGLang opens an image_url string that starts with / as a local file, and
Studio forwarded bare base64-looking strings unchanged, so a padded path
reached that open(). Wrap bare base64 as a data URL (this also fixes
JPEG base64, which starts with /9j/) and refuse anything else.

* Keep engine status probes from failing real engine work

The in-use probe in status() briefly took the engine lock without
waiting, so a poll landing on a load, install, remove or rollback
failed it as another Studio instance. Real takers now retry for a
second; probes still never wait. Cache the nvidia-smi answer and allow
60s: a loaded multi-GPU host took over 20s, past the old 5s limit,
and every poll spawned it again, so a supported B200 read as
unsupported. Also covers the data URL image change with engine tests.

* Give the load-time nvidia-smi probes the same 60s allowance

The memory reservation and FP8 capability queries still gave up after
5s, so on a loaded multi-GPU host (about 20s per query) every vLLM or
SGLang load failed with 'Could not reserve memory on every selected
GPU' although the card was mostly free.

* Time out engine startup on silence, not a fixed 15 minutes

For a Hub model the engine downloads the weights itself inside the
startup wait, so any checkpoint that took over 15 minutes to fetch, or
a slow first compile, always failed with 'Engine startup timed out'.
The 15 minute limit now counts time without engine output, with a
4 hour ceiling; cancelling still stops it at any point.

* Disable vLLM's vendored DeepGEMM when it was built for another Python

vLLM 0.20 bundles DeepGEMM's _C extension for CPython 3.12 only, but
the engine environment runs 3.13. vLLM still reports DeepGEMM present,
so on Hopper and Blackwell GPUs its warmup raises 'DeepGEMM backend is
not available or outdated' and every model fails to start, bf16
included (vllm-project/vllm#41849). Set VLLM_USE_DEEP_GEMM=0 when no
matching build or standalone deep_gemm package exists.

* Start a model switch without a saved config on the default engine

The resident's engine, precision and parallelism are copied into the
runtime params from status, and a switch reset every other per-model
field but not these. After a vLLM or SGLang load, picking a model with
no saved settings loaded it through the same engine and settings; a
LoRA or audio pick was refused with 'Choose Default'. The adopt check
already assumed a switch starts on the default engine.

* Cache a failed nvidia-smi probe for 5 minutes

The engines list is polled every 30s for every user. A host without a
working NVIDIA driver re-ran nvidia-smi on each poll, once per engine,
and a hung driver held a worker thread for the whole 60s timeout.

* Format the engine switch test

* Give the engine silence test room for a slow interpreter start

A macOS runner took over a second to start the fake engine, so the
1s silence window expired before its first line.

* Never run nvidia-smi inside an engines status poll

On a loaded multi-GPU host each probe took 20-60s, and while one ran
every other /api/engines poll queued behind it holding a worker
thread; the switchboard saw /api/inference/status climb from 29ms to
an 11s median beside them. Status now answers from the cache or starts
one background probe and reports 'Checking for a supported NVIDIA
GPU.'; install and load still wait for the real answer.

* Run the malware and remote-code consent gates before a managed engine loads

The default path runs these gates in its worker. vLLM and SGLang load
the checkpoint themselves, so a managed load skipped both, and
trust_remote_code reached the engine without the consent scan or the
approved fingerprint. Scan what the engine will load (the local path
for a local model) and raise the gate's message.

* Treat saved vLLM/SGLang targets as managed in image checks

An auto-switch to a model whose saved settings pick vLLM or SGLang was
pre-checked as the default backend, so remote image URLs and several
images were refused before the load although the managed branch serves
both. Managed requests also skipped the 64 image per request cap
(vLLM's own default is 999).

* Let the legacy model_id-only delete clear a saved engine choice

The documented removal payload still copied the stored engine,
precision and parallelism into the rewritten row, so the entry never
emptied and API auto-switch kept loading through vLLM or SGLang.

* Reap a crashed engine before engine status, install, repair or removal

* Count managed-engine tokens when reasoning_effort is "none"

* Tighten engine comments

* Share Studio's PyTorch with engines installed from the PyTorch index

* Keep each engine environment's FlashInfer JIT cache inside it

* Hide Studio's NVFP4 FlashInfer from shared engine environments

* Give engines the locked pip nvcc for FlashInfer JIT on driver-only hosts

* Download only what Studio lacks: reuse its accepted versions, fetch FlashInfer kernels on demand

* Require glibc 2.35 for vLLM, whose wheel is manylinux_2_35

* Run managed engines on Windows inside a private WSL2 distro

On native Windows x64 with an NVIDIA GPU, installing vLLM or SGLang now sets
up WSL2 when it is missing (one UAC prompt, then a Windows restart if needed),
imports a pinned Ubuntu 24.04 rootfs as a distro owned by this Studio home,
installs the same hash-pinned engine lock inside it, and launches the engine
through wsl.exe. The Linux path is unchanged.

- GPUs are matched between Windows and WSL by UUID and passed to the engine
  as guest indices with CUDA_DEVICE_ORDER=PCI_BUS_ID.
- The HF token and proxies cross through WSLENV, never the command line.
- A guest runner stops the engine's process group when Studio closes its
  stdin pipe, including when Studio is killed.
- The engine lease uses LockFileEx on Windows (shared and exclusive).
- New owner route DELETE /api/engines/wsl/environment unregisters the distro.

* Update engines to vLLM 0.26.0 and SGLang 0.5.17

Both are the newest releases still built on torch 2.11, so they keep sharing
Studio's PyTorch.

- vLLM 0.20.0's FA4 ViT attention used cute.core.ThrMma, which CUTLASS DSL
  4.6 removed; its loose floor let the lock pick 4.8.0, so every vision model
  (e.g. unsloth/Qwen3.5-2B) crashed at startup on Blackwell. 0.26.0 pins
  cutlass-dsl 4.6.0 and no longer uses the alias.
- vLLM 0.26.0 applies the quant config to Qwen3.5's lm_head, so NVFP4
  checkpoints that quantize it (unsloth/Qwen3.8-27B-NVFP4) load.
- vLLM 0.26.0 ships a manylinux_2_28 wheel and bundles DeepGEMM for CPython
  3.13, so the glibc 2.35 floor goes back to the 2.34 the locks resolve for.
- SGLang 0.5.17 needs transformers 5.12.1 and flash-attn-4 4.0.0b18.

* Keep TorchAO precisions working on the upgraded engines

- SGLang 0.5.17 routes unquantized linears on Blackwell through a cutedsl
  GEMM with no TorchAO tensor-subclass dispatch, so int4 and int8 failed
  with NotImplementedError. Those loads now pass --bf16-gemm-backend torch;
  unquantized models keep the fast kernel.
- vLLM with TorchAO weights (int8, fp8, pipeline int4) allocates past its
  reserved fraction in sampler warmup (2.4-4.8 GiB on an idle B200 at the
  default 0.97 budget), so int8 ran out of memory on an idle GPU. Those loads
  now leave 6 GiB more free; every other load is unchanged.

* Accept a text response_format on managed engines and name audio models correctly

A spelled-out {"type": "text"} response_format is the OpenAI default and
constrains nothing, so vLLM and SGLang now serve it instead of returning 400.
An audio checkpoint that also reads images was refused as a vision model even
though vision is supported; it is now reported as an audio model.

* Name utf-8 on the WSL host test's guest file writes

* Reap engine workers after a crash, honour cancel during WSL download, withhold unrequested tokens

* Serve managed-engine n > 1 one choice at a time, reap an engine a cancelled load left behind

* Serialize WSL preparation across engines; detect localized UTF-16 wsl.exe output

* Report the public model id on managed-engine tool responses

* WSL engines: honour offline mode, keep a committed env on cleanup failure, clear orphaned imports, check unregister, find nvidia-smi off PATH, no console window

* Serve a tool catalog with tool_choice none as plain chat on models without a parser

* Resolve nvidia-smi for the launch-time memory budget; drop a removed engine's WSL compile cache

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

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

* Keep a registered distro's disk on a failed reset, refuse removal while WSL is unresponsive, hide host GPU probe windows

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

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

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

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

* Store only non-default engine fields in model overrides, so an all-default save leaves no row

* Refuse to start training while a managed engine that failed to stop still holds the GPUs

* Pass the engine key in the environment and guard every vLLM route with it

* Reuse Studio's TorchAO for engines only at the version the adapter configs use

* Leave engine-specific VRAM headroom measured on a 24 GB card

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

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

* Keep the NVIDIA driver's library path for managed engines and their install checks

* Revert the driver library path change; it moves to its own PR

* Name the encoding on the WSL owner file write in the tests

* Keep the NVIDIA driver's library path for managed engines and their install checks (#12269)

* Engines: lock a release per Studio PyTorch (vLLM 0.30 / SGLang 0.5.20 on torch 2.13) and show the download size

* SGLang 0.5.18+: run without --torchao-config and refuse load-time INT8 / INT4 with a clear message

* Precision picker: disable INT8 and 4-bit for SGLang releases without load-time TorchAO

* SGLang 0.5.18+: disable CUDA graphs with the per-phase backend flags

* Engines: skip CUTLASS DSL's CUDA 12 libraries, which a driver 580 host never loads

* unsloth run: --engine vllm|sglang serves through an optional engine, installed on first use after a confirmation

* unsloth run --engine on Windows: show the WSL2 and administrator prompt notice before installing

* Engines: share nvcc's headers only at the locked release, so FlashInfer's JIT builds on Colab

* Engines: take nvcc and its headers from one release, all from Studio or all from the lock

* Reaping a crashed engine also drops its chat GPU claim and shared residency

* Shared engines: keep the engine's nvidia tree first when Studio's site has a regular nvidia package

* Engines: an INT4 / INT8 SGLang cannot convert resets on switching and is refused before unloading

* Engines: CUDA runtime headers travel with nvcc, so a shared engine never mixes crt releases

* unsloth run --engine: a restored engine loads as is

* Engines: one merged CUDA include tree, so Studio headers pick up the engine's crt

* Engines: keep a share of large GPUs free for vLLM's sampler warmup

* Engines: keep the current-date note on rebuilt managed-engine messages

* WSL engines: forward the hf auth login token to the guest

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

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

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

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

* Model picker: keep GGUF row badges aligned with rows that have the settings action

* Engines: validate the INT4 a legacy load_in_4bit request becomes, before unloading

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

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

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

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

* Engines: keep lock files byte-exact on Windows clones; mark Linux-only engine tests

* Engine lease tests run on Windows too, now that leases use LockFileEx there

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

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

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

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

* Engines: install-machinery tests are Linux engine-host tests

* WSL tests: wait on the job file status reads; guest runner tests are Linux only

* Engine tests on a real Windows host: skip the POSIX wsl.exe fake and Linux local-host cases

* Tests: skip the GPU query cache reset while a probe thread is still importing it

---------

Co-authored-by: oobabooga <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
JoshuaL3000 pushed a commit to JoshuaL3000/unsloth that referenced this pull request Oct 4, 2026
…nslothai#12024)

* Studio: add opt-in vLLM and SGLang inference engines

* Studio: extend optional engines with vision, precision and parallel modes

* Studio: allow loading explicitly restored inference engines

* Studio: support tool calling with managed inference engines

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

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

* Restore managed engine settings on rollback and launch the normalized local path

* Run optional engine checks in validate before the picker unloads

* Patch the httpx module the managed tool route imports in its tests

* Fetch remote image URLs in Studio before forwarding them to a managed engine

* Give managed engine requests the llama-server first-token deadline

* Refuse an outdated engine profile on the backend unless it was restored

* Name the text encoding for engine subprocess output and the lease file

* Update repository guard tests for the optional engine changes

* Run optional engines on Studio's PyTorch instead of a separate Python 3.12 environment

* Keep the chat GPU claim when a managed engine does not stop on unload

* Report a managed engine that survives load cancellation and keep it holding the chat GPU claim

* Launch managed engines only on GPUs visible to Studio

* Default the engine GPU picker to the first GPU Studio sees

* Load a compare pane with its remembered vLLM or SGLang settings

* Validate a model switch on the GPUs its load will use

* Trim comments in opt-in engine code

* Send managed engines only data URL images

SGLang opens an image_url string that starts with / as a local file, and
Studio forwarded bare base64-looking strings unchanged, so a padded path
reached that open(). Wrap bare base64 as a data URL (this also fixes
JPEG base64, which starts with /9j/) and refuse anything else.

* Keep engine status probes from failing real engine work

The in-use probe in status() briefly took the engine lock without
waiting, so a poll landing on a load, install, remove or rollback
failed it as another Studio instance. Real takers now retry for a
second; probes still never wait. Cache the nvidia-smi answer and allow
60s: a loaded multi-GPU host took over 20s, past the old 5s limit,
and every poll spawned it again, so a supported B200 read as
unsupported. Also covers the data URL image change with engine tests.

* Give the load-time nvidia-smi probes the same 60s allowance

The memory reservation and FP8 capability queries still gave up after
5s, so on a loaded multi-GPU host (about 20s per query) every vLLM or
SGLang load failed with 'Could not reserve memory on every selected
GPU' although the card was mostly free.

* Time out engine startup on silence, not a fixed 15 minutes

For a Hub model the engine downloads the weights itself inside the
startup wait, so any checkpoint that took over 15 minutes to fetch, or
a slow first compile, always failed with 'Engine startup timed out'.
The 15 minute limit now counts time without engine output, with a
4 hour ceiling; cancelling still stops it at any point.

* Disable vLLM's vendored DeepGEMM when it was built for another Python

vLLM 0.20 bundles DeepGEMM's _C extension for CPython 3.12 only, but
the engine environment runs 3.13. vLLM still reports DeepGEMM present,
so on Hopper and Blackwell GPUs its warmup raises 'DeepGEMM backend is
not available or outdated' and every model fails to start, bf16
included (vllm-project/vllm#41849). Set VLLM_USE_DEEP_GEMM=0 when no
matching build or standalone deep_gemm package exists.

* Start a model switch without a saved config on the default engine

The resident's engine, precision and parallelism are copied into the
runtime params from status, and a switch reset every other per-model
field but not these. After a vLLM or SGLang load, picking a model with
no saved settings loaded it through the same engine and settings; a
LoRA or audio pick was refused with 'Choose Default'. The adopt check
already assumed a switch starts on the default engine.

* Cache a failed nvidia-smi probe for 5 minutes

The engines list is polled every 30s for every user. A host without a
working NVIDIA driver re-ran nvidia-smi on each poll, once per engine,
and a hung driver held a worker thread for the whole 60s timeout.

* Format the engine switch test

* Give the engine silence test room for a slow interpreter start

A macOS runner took over a second to start the fake engine, so the
1s silence window expired before its first line.

* Never run nvidia-smi inside an engines status poll

On a loaded multi-GPU host each probe took 20-60s, and while one ran
every other /api/engines poll queued behind it holding a worker
thread; the switchboard saw /api/inference/status climb from 29ms to
an 11s median beside them. Status now answers from the cache or starts
one background probe and reports 'Checking for a supported NVIDIA
GPU.'; install and load still wait for the real answer.

* Run the malware and remote-code consent gates before a managed engine loads

The default path runs these gates in its worker. vLLM and SGLang load
the checkpoint themselves, so a managed load skipped both, and
trust_remote_code reached the engine without the consent scan or the
approved fingerprint. Scan what the engine will load (the local path
for a local model) and raise the gate's message.

* Treat saved vLLM/SGLang targets as managed in image checks

An auto-switch to a model whose saved settings pick vLLM or SGLang was
pre-checked as the default backend, so remote image URLs and several
images were refused before the load although the managed branch serves
both. Managed requests also skipped the 64 image per request cap
(vLLM's own default is 999).

* Let the legacy model_id-only delete clear a saved engine choice

The documented removal payload still copied the stored engine,
precision and parallelism into the rewritten row, so the entry never
emptied and API auto-switch kept loading through vLLM or SGLang.

* Reap a crashed engine before engine status, install, repair or removal

* Count managed-engine tokens when reasoning_effort is "none"

* Tighten engine comments

* Share Studio's PyTorch with engines installed from the PyTorch index

* Keep each engine environment's FlashInfer JIT cache inside it

* Hide Studio's NVFP4 FlashInfer from shared engine environments

* Give engines the locked pip nvcc for FlashInfer JIT on driver-only hosts

* Download only what Studio lacks: reuse its accepted versions, fetch FlashInfer kernels on demand

* Require glibc 2.35 for vLLM, whose wheel is manylinux_2_35

* Run managed engines on Windows inside a private WSL2 distro

On native Windows x64 with an NVIDIA GPU, installing vLLM or SGLang now sets
up WSL2 when it is missing (one UAC prompt, then a Windows restart if needed),
imports a pinned Ubuntu 24.04 rootfs as a distro owned by this Studio home,
installs the same hash-pinned engine lock inside it, and launches the engine
through wsl.exe. The Linux path is unchanged.

- GPUs are matched between Windows and WSL by UUID and passed to the engine
  as guest indices with CUDA_DEVICE_ORDER=PCI_BUS_ID.
- The HF token and proxies cross through WSLENV, never the command line.
- A guest runner stops the engine's process group when Studio closes its
  stdin pipe, including when Studio is killed.
- The engine lease uses LockFileEx on Windows (shared and exclusive).
- New owner route DELETE /api/engines/wsl/environment unregisters the distro.

* Update engines to vLLM 0.26.0 and SGLang 0.5.17

Both are the newest releases still built on torch 2.11, so they keep sharing
Studio's PyTorch.

- vLLM 0.20.0's FA4 ViT attention used cute.core.ThrMma, which CUTLASS DSL
  4.6 removed; its loose floor let the lock pick 4.8.0, so every vision model
  (e.g. unsloth/Qwen3.5-2B) crashed at startup on Blackwell. 0.26.0 pins
  cutlass-dsl 4.6.0 and no longer uses the alias.
- vLLM 0.26.0 applies the quant config to Qwen3.5's lm_head, so NVFP4
  checkpoints that quantize it (unsloth/Qwen3.8-27B-NVFP4) load.
- vLLM 0.26.0 ships a manylinux_2_28 wheel and bundles DeepGEMM for CPython
  3.13, so the glibc 2.35 floor goes back to the 2.34 the locks resolve for.
- SGLang 0.5.17 needs transformers 5.12.1 and flash-attn-4 4.0.0b18.

* Keep TorchAO precisions working on the upgraded engines

- SGLang 0.5.17 routes unquantized linears on Blackwell through a cutedsl
  GEMM with no TorchAO tensor-subclass dispatch, so int4 and int8 failed
  with NotImplementedError. Those loads now pass --bf16-gemm-backend torch;
  unquantized models keep the fast kernel.
- vLLM with TorchAO weights (int8, fp8, pipeline int4) allocates past its
  reserved fraction in sampler warmup (2.4-4.8 GiB on an idle B200 at the
  default 0.97 budget), so int8 ran out of memory on an idle GPU. Those loads
  now leave 6 GiB more free; every other load is unchanged.

* Accept a text response_format on managed engines and name audio models correctly

A spelled-out {"type": "text"} response_format is the OpenAI default and
constrains nothing, so vLLM and SGLang now serve it instead of returning 400.
An audio checkpoint that also reads images was refused as a vision model even
though vision is supported; it is now reported as an audio model.

* Name utf-8 on the WSL host test's guest file writes

* Reap engine workers after a crash, honour cancel during WSL download, withhold unrequested tokens

* Serve managed-engine n > 1 one choice at a time, reap an engine a cancelled load left behind

* Serialize WSL preparation across engines; detect localized UTF-16 wsl.exe output

* Report the public model id on managed-engine tool responses

* WSL engines: honour offline mode, keep a committed env on cleanup failure, clear orphaned imports, check unregister, find nvidia-smi off PATH, no console window

* Serve a tool catalog with tool_choice none as plain chat on models without a parser

* Resolve nvidia-smi for the launch-time memory budget; drop a removed engine's WSL compile cache

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

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

* Keep a registered distro's disk on a failed reset, refuse removal while WSL is unresponsive, hide host GPU probe windows

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

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

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

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

* Store only non-default engine fields in model overrides, so an all-default save leaves no row

* Refuse to start training while a managed engine that failed to stop still holds the GPUs

* Pass the engine key in the environment and guard every vLLM route with it

* Reuse Studio's TorchAO for engines only at the version the adapter configs use

* Leave engine-specific VRAM headroom measured on a 24 GB card

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

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

* Keep the NVIDIA driver's library path for managed engines and their install checks

* Revert the driver library path change; it moves to its own PR

* Name the encoding on the WSL owner file write in the tests

* Keep the NVIDIA driver's library path for managed engines and their install checks (unslothai#12269)

* Engines: lock a release per Studio PyTorch (vLLM 0.30 / SGLang 0.5.20 on torch 2.13) and show the download size

* SGLang 0.5.18+: run without --torchao-config and refuse load-time INT8 / INT4 with a clear message

* Precision picker: disable INT8 and 4-bit for SGLang releases without load-time TorchAO

* SGLang 0.5.18+: disable CUDA graphs with the per-phase backend flags

* Engines: skip CUTLASS DSL's CUDA 12 libraries, which a driver 580 host never loads

* unsloth run: --engine vllm|sglang serves through an optional engine, installed on first use after a confirmation

* unsloth run --engine on Windows: show the WSL2 and administrator prompt notice before installing

* Engines: share nvcc's headers only at the locked release, so FlashInfer's JIT builds on Colab

* Engines: take nvcc and its headers from one release, all from Studio or all from the lock

* Reaping a crashed engine also drops its chat GPU claim and shared residency

* Shared engines: keep the engine's nvidia tree first when Studio's site has a regular nvidia package

* Engines: an INT4 / INT8 SGLang cannot convert resets on switching and is refused before unloading

* Engines: CUDA runtime headers travel with nvcc, so a shared engine never mixes crt releases

* unsloth run --engine: a restored engine loads as is

* Engines: one merged CUDA include tree, so Studio headers pick up the engine's crt

* Engines: keep a share of large GPUs free for vLLM's sampler warmup

* Engines: keep the current-date note on rebuilt managed-engine messages

* WSL engines: forward the hf auth login token to the guest

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

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

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

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

* Model picker: keep GGUF row badges aligned with rows that have the settings action

* Engines: validate the INT4 a legacy load_in_4bit request becomes, before unloading

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

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

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

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

* Engines: keep lock files byte-exact on Windows clones; mark Linux-only engine tests

* Engine lease tests run on Windows too, now that leases use LockFileEx there

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

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

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

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

* Engines: install-machinery tests are Linux engine-host tests

* WSL tests: wait on the job file status reads; guest runner tests are Linux only

* Engine tests on a real Windows host: skip the POSIX wsl.exe fake and Linux local-host cases

* Tests: skip the GPU query cache reset while a probe thread is still importing it

---------

Co-authored-by: oobabooga <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

1 participant