Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

fix: exclude bitsandbytes from module purge to prevent duplicate operator registration

Roland Tannous9696bd557a02
diff --git a/studio/backend/utils/transformers_version.py b/studio/backend/utils/transformers_version.py
index 15ac70f31e2..5b246930f08 100644
--- a/studio/backend/utils/transformers_version.py
+++ b/studio/backend/utils/transformers_version.py
@@ -137,7 +137,10 @@ _PURGE_PREFIXES = (
"trl",
"accelerate",
"auto_gptq",
- "bitsandbytes",
+ # NOTE: bitsandbytes is intentionally EXCLUDED — it registers torch custom
+ # operators at import time via torch.library.define(). Those registrations
+ # live in torch's global operator registry which survives module purge.
+ # Re-importing bitsandbytes after purge → duplicate registration → crash.
# Our own modules that import from transformers at module level
# (e.g. model_config.py: `from transformers import AutoConfig`)
"utils.models",