Skip to content

Studio: startup loading banner and mute the benign bitsandbytes ROCm warning - #7085

Merged
danielhanchen merged 4 commits into
mainfrom
studio-startup-banner-bnb-warning
Jul 13, 2026
Merged

danielhanchen merged 4 commits into
mainfrom
studio-startup-banner-bnb-warning

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Jul 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Two small Studio startup UX fixes for Windows AMD ROCm hosts (and everyone else).

1. Loading banner on startup

run_server logs run_server startup begin and then blocks for up to ~2 minutes on from main import app, which transitively imports torch, unsloth, transformers and the bitsandbytes DLL. Nothing prints during that window, so the console looks frozen and people assume the launch hung.

This prints a flushed heads-up before the import, plus short progress lines around it:

Loading Unsloth Studio, please wait... (this can take a few minutes)
  - loading PyTorch, Unsloth and Transformers...
  - Starting server...

flush=True is required because a redirected or piped stdout is block buffered and we never leave the import to flush it. All output stays gated on the existing silent flag, and the single insertion in run_server covers every entry path (CLI, direct run.py, the Windows re-exec child, Colab).

2. Mute the benign bitsandbytes ROCm override notice

On Windows ROCm, BNB_ROCM_VERSION is set (by the installer sitecustomize seed, or by the redetection in main.py / worker.py), which makes bitsandbytes log this on every import:

WARNING: BNB_ROCM_VERSION=72 environment variable detected; loading libbitsandbytes_rocm72.dll. ...

The value is correct (it is the only ROCm DLL the wheel ships, and it matches bitsandbytes' own same-major fallback), so the message is pure noise. This attaches a message-scoped logging.Filter to the bitsandbytes.cextension logger that drops only records containing "environment variable detected", before bitsandbytes imports, in both the server (main.py) and the training worker (worker.py). Real load failures and the actionable "No prebuilt binary for ROCm x.y, loading z instead" mismatch warning are preserved, and the override itself is unchanged.

Verification

Booted the server from this branch: the loading banner appears immediately before the slow import, and no bitsandbytes override notice appears in the log even though BNB_ROCM_VERSION=72 is set and unsloth loads. A direct check confirms the filter drops the benign record and keeps the mismatch warning. ruff check, py_compile and ast.parse pass on all changed files.

Host: Windows 11, Strix Halo (gfx1151), torch 2.11.0+rocm7.13.0.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request mutes the benign warning from the bitsandbytes.cextension logger when BNB_ROCM_VERSION is set in both worker.py and main.py. Additionally, it adds flushed console output in run.py to notify users when heavy ML libraries are loading and when the server is starting. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@danielhanchen
danielhanchen force-pushed the studio-startup-banner-bnb-warning branch from 93a51e4 to 5672ddc Compare July 12, 2026 10:29
@danielhanchen
danielhanchen merged commit 2a22da9 into main Jul 13, 2026
52 checks passed
@danielhanchen
danielhanchen deleted the studio-startup-banner-bnb-warning branch July 13, 2026 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant