Repository navigation
v0.9.1: discovery tolerates broken host ML deps
Point release fixing a discovery bug that could hide every bundled
model from muse models list.
The bug
Four model scripts (sd_turbo, all_minilm_l6_v2, qwen3_embedding_0_6b,
nv_embed_v2) had heavy ML imports at module top level:
try:
import torch
from diffusers import AutoPipelineForText2Image
except ImportError:
torch = None
AutoPipelineForText2Image = NoneTwo ways this failed:
-
Broken host deps. If the supervisor env has a stale
diffusers
pinned to atransformersversion that removedMT5Tokenizer,
diffusers'_LazyModulewraps the failure as aRuntimeError, not
anImportError. Theexcept ImportErrordoes not catch it and the
module-level import raises. Discovery catches the exception per
script but the sibling models vanish from the listing along with the
broken one. This is what users were actually hitting. -
Supervisor env legitimately lacks per-model deps. The supervisor
runs in an env that does NOT have torch/diffusers/transformers
installed. Those live in per-model venvs at~/.muse/venvs/<id>/,
created bymuse pull. A top-level import that assumes otherwise is
just wrong.
The fix
Each of the four scripts now follows the pattern the three audio scripts
(kokoro_82m, soprano_80m, bark_small) already used: module-level
None sentinels plus a per-symbol lazy _ensure_deps() called from
Model.__init__. Per-symbol import means tests can patch one module
attr without affecting the other.
Regression guard
New test test_bundled_model_scripts_import_without_any_ml_deps
installs a meta-path finder that raises on all four top-level ML
package roots and verifies every bundled model is still discovered.
Would have caught this at review time.
Upgrade
pip install -U -e ".[server]"Or in production with a per-model venv setup, nothing changes in the
venvs: the fix only affects what the supervisor env sees during
discovery.
Tests: 419 pass.