Skip to content

[Bug] GET to /api/system/hardware creates cuda context on gpu 0 #18732

Closed

Description

@jcsq6

Environment

Where are you using Unsloth?

  • Unsloth desktop application
  • Unsloth web UI (unsloth studio)
  • Unsloth CLI
  • Python package or notebook
  • Colab or Kaggle

Operating system and version:
Arch Linux Kernel 7.3.4-arch1-2

GPU model(s) and accelerator backend:
NVIDIA CUDA, RTX 5070 Ti, RTX 3090 Ti

Versions:

v0.1.922-beta, 2026.11.9

What happened?

Start with UNSLOTH_STUDIO_DISABLE_TORCH_WARM=1.
curl /api/system/hardware, or open the UI settings that calls it.

Expected behavior:
Successful GET, no side effects.

Actual behavior:
Starts a cuda context (~200mb) on device 0, doesn't release until restart.

Unsloth web UI

Attach the newest relevant items:

{"timestamp": "2026-11-11T22:24:54.005005Z", "level": "info", "event": "request_completed", "method": "GET", "path": "/api/system/hardware", "status_code": 200, "process_time_ms": 129.56}

Likely reason

Unsloth probes nvidia-smi, rejects the reading when its total memory differs from torch's total_memory by more than 1%. nvidia-smi reports 424 to 431mb per card as reserved. If they disagree by that amount, the gap is 2.6% on a 16GB card, so the probe always fails.

It also sets CUDA_DEVICE_ORDER=PCI_BUS_ID, so device 0 is the lowest PCI bus card, multi-gpu the issue always lands on that card.

Activity

  1. added
    feature request
    on Nov 21, 2026
  2. danielhanchen commented on Nov 23, 2026

    @danielhanchen
    Member

    Fixed! Studio compared the nvidia-smi total against PyTorch's total with a 1% tolerance, but nvidia-smi also counts the memory the driver reserves for itself (about 300 to 750 MiB), so on most cards the reading was rejected and Studio fell back to a torch call that opens a CUDA context on GPU 0. The tolerance now covers that reserved memory, so the hardware endpoint reads VRAM without touching the GPU. Fixed in #18734.
    To update: Unsloth Desktop will have an update banner. For Studio, use unsloth studio update. For Docker, use docker exec <container> unsloth-studio-update.
    If it's fixed for you, please close the issue; if not, reply here with what you see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugfeature request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions