Skip to content

Clone your own voice on your own computer: speak any text in 60+ languages and dub videos into another language in your voice. Fully local. Early version.

fix: pin transformers and turn Hub kernels off, so OmniVoice loads offline (#180)

Taras Hevlichfe7fc7f86438
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0ce76e9..a2b801b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,14 @@
# Changelog
+## Unreleased
+
+* **OmniVoice loads again on new installs:** since transformers 5.25 (2026-12-01), setup installed a version that tries
+ to download extra model code from the internet while the speech model loads offline, so OmniVoice failed and the app
+ said it was not installed. Setup now installs transformers 5.24.1 and huggingface-hub 2.5.0 for OmniVoice and
+ VoxCPM2, and the speech workers never download that code. After the update, the app asks to run setup once more.
+* **A speech model that fails to load is no longer reported as not installed,** and a turned-off voice training
+ component is named as such instead of "RVC runtime not found".
+
## 0.9.1
* **The MCP server reads books in character voices:** `start_book` takes `men_voice`, `women_voice` and `cast`, and
diff --git a/engine/src/mimvox_engine/backends/clone_worker.py b/engine/src/mimvox_engine/backends/clone_worker.py
index 7bf06b8..7226c1e 100644
--- a/engine/src/mimvox_engine/backends/clone_worker.py
+++ b/engine/src/mimvox_engine/backends/clone_worker.py
@@ -40,6 +40,7 @@ def parse_args():
args = ap.parse_args()
os.environ.setdefault("HF_HUB_OFFLINE", "1")
os.environ.setdefault("TRANSFORMERS_OFFLINE", "1")
+ os.environ.setdefault("USE_HUB_KERNELS", "0")
os.environ.setdefault("TOKENIZERS_PARALLELISM", "false")
return args
diff --git a/engine/src/mimvox_engine/backends/holos_worker.py b/engine/src/mimvox_engine/backends/holos_worker.py
index 32d3cb5..415b876 100644
--- a/engine/src/mimvox_engine/backends/holos_worker.py
+++ b/engine/src/mimvox_engine/backends/holos_worker.py
@@ -44,6 +44,7 @@ args = ap.parse_args()
os.environ.setdefault("HF_HUB_OFFLINE", "1")
os.environ.setdefault("TRANSFORMERS_OFFLINE", "1")
+os.environ.setdefault("USE_HUB_KERNELS", "0")
os.environ.setdefault("TOKENIZERS_PARALLELISM", "false")
os.environ["STANZA_RESOURCES_DIR"] = str(Path(args.model_dir) / "stanza")
diff --git a/engine/src/mimvox_engine/backends/omnivoice_worker.py b/engine/src/mimvox_engine/backends/omnivoice_worker.py
index 38406b0..0e0adc5 100644
--- a/engine/src/mimvox_engine/backends/omnivoice_worker.py
+++ b/engine/src/mimvox_engine/backends/omnivoice_worker.py
@@ -55,6 +55,7 @@ args = ap.parse_args()
os.environ.setdefault("HF_HUB_OFFLINE", "1")
os.environ.setdefault("TRANSFORMERS_OFFLINE", "1")
+os.environ.setdefault("USE_HUB_KERNELS", "0")
os.environ.setdefault("TOKENIZERS_PARALLELISM", "false")
import numpy as np # noqa: E402
diff --git a/engine/src/mimvox_engine/tts.py b/engine/src/mimvox_engine/tts.py
index c8be1b2..bef872f 100644
--- a/engine/src/mimvox_engine/tts.py
+++ b/engine/src/mimvox_engine/tts.py
@@ -13,7 +13,7 @@ from typing import Any
import numpy as np
-from . import accent, aio, backends, config, media, reflang, results, rvc, speech, voices, zsvc
+from . import accent, aio, backends, components, config, media, reflang, results, rvc, speech, voices, zsvc
from . import audio_util as au
from .backends import SynthParams, names
from .backends.holos import HOLOS
@@ -311,7 +311,7 @@ async def load_models(ctx: Context) -> None:
async def do_rvc() -> None:
if worker is None:
- errors["rvc"] = "RVC runtime not found"
+ errors["rvc"] = "voice training is turned off" if components.off("training") else "RVC runtime not found"
async def do_others() -> None:
for b in backends.all_backends():
@@ -327,7 +327,7 @@ async def load_models(ctx: Context) -> None:
log.info("model loading stopped: the engine is shutting down")
return
tts_state = "ready" if "tts" not in errors else "no_memory" if OMNIVOICE.status() == "no_memory" else "missing"
- if OMNIVOICE.status() == "missing" and speech_status() == "missing":
+ if OMNIVOICE.status() == "missing" and speech_status() == "missing" and "tts" not in errors:
errors["tts"] = "no voice-cloning model is installed; run setup"
if tts_state == "ready" and OMNIVOICE.status() != "missing" and not OMNIVOICE.on_cpu():
await _warm_up(data)
diff --git a/engine/src/mimvox_engine/workerproc.py b/engine/src/mimvox_engine/workerproc.py
index a4407ca..b18c6a0 100644
--- a/engine/src/mimvox_engine/workerproc.py
+++ b/engine/src/mimvox_engine/workerproc.py
@@ -386,6 +386,7 @@ def isolated() -> list[str]:
def child_env(**extra: str) -> dict[str, str]:
- env = dict(os.environ, PYTHONIOENCODING="utf-8", PYTHONUNBUFFERED="1", **extra)
+ # transformers 5.25+ fetches Hub kernels by default; the workers run offline and use the PyTorch ops.
+ env = dict(os.environ, PYTHONIOENCODING="utf-8", PYTHONUNBUFFERED="1", USE_HUB_KERNELS="0", **extra)
env.pop("PYTHONPATH", None)
return env
diff --git a/engine/tests/test_cpu_speech.py b/engine/tests/test_cpu_speech.py
index 0d034f2..3ec66b4 100644
--- a/engine/tests/test_cpu_speech.py
+++ b/engine/tests/test_cpu_speech.py
@@ -685,3 +685,17 @@ def test_a_refused_voice_warm_up_sends_the_plain_message(tmp_path, monkeypatch,
def test_a_voice_warm_up_on_the_cpu_builds_only_the_prompt(tmp_path, monkeypatch):
calls, events = _voice_warm(tmp_path, monkeypatch, "cpu")
assert calls == ["warm"] and events[0][1]["ok"] is True
+
+
+def test_a_model_that_fails_to_load_is_not_called_not_installed(tmp_path, monkeypatch, caplog):
+ monkeypatch.setattr(tts, "omnivoice_installed", lambda runtime: True)
+
+ def fail(b):
+ b._status = "missing"
+
+ with caplog.at_level(logging.WARNING, logger="mimvox.tts"):
+ events, _ = _start_up(tmp_path, monkeypatch, load=fail)
+ assert events[-1]["tts"] == "missing"
+ problems = next(r.getMessage() for r in caplog.records if "start-up problems" in r.getMessage())
+ assert "OmniVoice failed to load" in problems
+ assert "not installed" not in problems
diff --git a/engine/tests/test_speech_models.py b/engine/tests/test_speech_models.py
index e36ff1e..bc2dc79 100644
--- a/engine/tests/test_speech_models.py
+++ b/engine/tests/test_speech_models.py
@@ -215,3 +215,17 @@ def test_redub_refuses_an_unknown_or_missing_model(tmp_path):
with pytest.raises(EngineError) as e:
handlers._model({"model": "holos"})
assert e.value.code == "bad_request"
+
+
+def test_every_speech_environment_pins_transformers_and_the_hub():
+ setup = _setup_module()
+ for packages in (setup.ENGINE_PACKAGES, setup.CLONE_MODELS["voxcpm"]["packages"]):
+ names = {p.split("==")[0] for p in packages if "==" in p}
+ assert {"transformers", "huggingface-hub"} <= names, packages
+
+
+def test_workers_run_without_hub_kernels(monkeypatch):
+ from mimvox_engine import workerproc
+
+ monkeypatch.setenv("USE_HUB_KERNELS", "1")
+ assert workerproc.child_env()["USE_HUB_KERNELS"] == "0"
diff --git a/tools/setup/runtime_version.txt b/tools/setup/runtime_version.txt
index 9306509..1ca9924 100644
--- a/tools/setup/runtime_version.txt
+++ b/tools/setup/runtime_version.txt
@@ -2,4 +2,4 @@
# (Python packages, a model, the Applio commit) that the new app or engine depends on. Setup writes it to runtime.toml
# ([setup] runtime_version); an app whose number here is higher than the installed one asks the user to run setup
# again (setup installs only what changed). Runtimes set up before this file existed count as version 1.
-2
+3
diff --git a/tools/setup/setup.py b/tools/setup/setup.py
index faaa79e..3eec84a 100644
--- a/tools/setup/setup.py
+++ b/tools/setup/setup.py
@@ -163,7 +163,7 @@ UKRAINIAN_GB = 1.5 # weights 0.9 GB + the packages the engine venv does not sha
CLONE_MODELS = {
"voxcpm": {
"label": "VoxCPM2",
- "packages": ("voxcpm==2.0.3", "num2words==0.5.14"),
+ "packages": ("voxcpm==2.0.3", "transformers==5.24.1", "huggingface-hub==2.5.0", "num2words==0.5.14"),
"repo": "openbmb/VoxCPM2",
"revision": "7936080b41163874f38610f46f438e2c0757f9fd",
"files": (),
@@ -265,6 +265,8 @@ ENGINE_TORCH = ("torch==2.11.0", "torchaudio==2.11.0")
# pypdf (BSD-3-Clause, pure Python): PDF books; every other book format is read with the standard library.
ENGINE_PACKAGES = (
"omnivoice==0.2.1",
+ "transformers==5.24.1",
+ "huggingface-hub==2.5.0",
"openai-whisper==20250625",
"num2words==0.5.14",
"sentencepiece",
@@ -1917,7 +1919,7 @@ class Setup:
[py, "-I", "-c", NLLB_FP16_SCRIPT, target, tmp],
"Converting the better translation model",
cwd=self.runtime,
- extra_env={"HF_HUB_OFFLINE": "1", "TRANSFORMERS_OFFLINE": "1"},
+ extra_env={"HF_HUB_OFFLINE": "1", "TRANSFORMERS_OFFLINE": "1", "USE_HUB_KERNELS": "0"},
)
if not (tmp / "model.safetensors").is_file():
raise SetupError(f"Converting the better translation model wrote no model.safetensors in {tmp}.")