Repin BlueV3-onnx to ba91a778 and add Russian via polyg2p
Browse filesThe model repo was squashed to ba91a778; the old 3cf03e5 pin is orphaned
(browsers already 404 through /api/resolve-cache). Graphs, voices, the
polyg2p wheel and en/de/it data are byte-identical.
Russian joined the release: polyg2p with the stress and ё lexicons, so the
release path never touches RUAccent/RUPhon (no 1 GB prewarm).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- README.md +2 -2
- app.py +14 -10
- download_models.py +7 -3
- requirements.txt +1 -1
README.md
CHANGED
|
@@ -25,12 +25,12 @@ This Space was duplicated from [thewh1teagle/lightblue-tts-hebrew](https://huggi
|
|
| 25 |
|
| 26 |
The front end is the one the release was trained and validated with (see the model repo's `frontend/FRONTEND.md`):
|
| 27 |
|
| 28 |
-
- **English, German, Spanish, Italian** — [polyg2p](https://huggingface.co/notmax123/BlueV3-onnx/tree/main/frontend) (Linux x86-64 wheel + the bundle's data files; English uses the large OOV model). Spanish defaults to Castilian; set `BLUE_ES_VARIANT=es-419` for Latin American. Off Linux x86-64 the app falls back to espeak-ng, at lower quality.
|
| 29 |
- **Hebrew** — `heb-tts-normalizer` (numbers by gender, dates, times, currency, units), then [RenikudPlus](https://huggingface.co/notmax123/RenikudPlus) 0.5.0 on unpointed text, conditioned on the selected voice's gender.
|
| 30 |
|
| 31 |
Every chunk's ids are wrapped in `<lang>` … `</lang>` tags (vocab characters) for the duration predictor, text encoder and vector field — the model reads untagged input with badly wrong durations. Mixed Hebrew/English text keeps one tagged run per language.
|
| 32 |
|
| 33 |
-
Russian and
|
| 34 |
|
| 35 |
## Voices
|
| 36 |
|
|
|
|
| 25 |
|
| 26 |
The front end is the one the release was trained and validated with (see the model repo's `frontend/FRONTEND.md`):
|
| 27 |
|
| 28 |
+
- **English, German, Spanish, Italian, Russian** — [polyg2p](https://huggingface.co/notmax123/BlueV3-onnx/tree/main/frontend) (Linux x86-64 wheel + the bundle's data files; English uses the large OOV model). Spanish defaults to Castilian; set `BLUE_ES_VARIANT=es-419` for Latin American. Off Linux x86-64 the app falls back to espeak-ng, at lower quality.
|
| 29 |
- **Hebrew** — `heb-tts-normalizer` (numbers by gender, dates, times, currency, units), then [RenikudPlus](https://huggingface.co/notmax123/RenikudPlus) 0.5.0 on unpointed text, conditioned on the selected voice's gender.
|
| 30 |
|
| 31 |
Every chunk's ids are wrapped in `<lang>` … `</lang>` tags (vocab characters) for the duration predictor, text encoder and vector field — the model reads untagged input with badly wrong durations. Mixed Hebrew/English text keeps one tagged run per language.
|
| 32 |
|
| 33 |
+
Russian uses polyg2p with the release's stress and ё lexicons. Yiddish is in the release but its front end (`frontend/yi/`) is not wired into this app yet.
|
| 34 |
|
| 35 |
## Voices
|
| 36 |
|
app.py
CHANGED
|
@@ -219,8 +219,9 @@ DEFAULT_CHAR_TO_ID: dict[str, int] = {**_PIPER_MAP, **_EXTENDED_MAP}
|
|
| 219 |
|
| 220 |
# The v2.5 checkpoint was trained on he/en/de/it/es/ru/yi. Yiddish is left out
|
| 221 |
# here because its front end (nikud + yiddish_g2p) does not ship with the export.
|
| 222 |
-
# BlueV3 ships en/
|
| 223 |
-
|
|
|
|
| 224 |
BLUE_SYNTH_MAX_CHUNK_LEN = int(RELEASE_INF.get("max_chunk_tokens", 300))
|
| 225 |
DEFAULT_STEPS = int(RELEASE_INF.get("steps", 8))
|
| 226 |
DEFAULT_CFG_SCALE = float(RELEASE_INF.get("cfg_scale", 4.0))
|
|
@@ -925,9 +926,11 @@ class TextProcessor:
|
|
| 925 |
)
|
| 926 |
# Only route to the Russian front end when this checkpoint exposes Russian;
|
| 927 |
# otherwise stray Cyrillic goes through espeak instead of a 1 GB download.
|
| 928 |
-
if
|
|
|
|
|
|
|
| 929 |
return strip_silent_separator_tokens(self._russian(content))
|
| 930 |
-
if BLUE_RELEASE and lang in ("en", "de", "es", "it"):
|
| 931 |
out = self._polyg2p(content, lang)
|
| 932 |
if out is not None:
|
| 933 |
return strip_silent_separator_tokens(out)
|
|
@@ -2648,8 +2651,8 @@ def g2p_is_cold(lang: str) -> bool:
|
|
| 2648 |
import. Used to decide whether the UI owes the user a "this will take a
|
| 2649 |
moment" notice, so the notice never appears on an already-warm request.
|
| 2650 |
"""
|
| 2651 |
-
if _canonical_lang(lang) != "ru":
|
| 2652 |
-
return False
|
| 2653 |
try:
|
| 2654 |
from g2p import russian_g2p
|
| 2655 |
except ImportError:
|
|
@@ -2670,7 +2673,7 @@ def warm_g2p(lang: str) -> None:
|
|
| 2670 |
Cheap and idempotent once warm; failures are left for the real call to
|
| 2671 |
report, since this is only a warmup.
|
| 2672 |
"""
|
| 2673 |
-
if _canonical_lang(lang) != "ru":
|
| 2674 |
return
|
| 2675 |
# Serialize: the startup prewarm thread and a request can race here, and
|
| 2676 |
# RUAccent/RUPhon would otherwise both be built. The GPU child process never
|
|
@@ -2692,8 +2695,8 @@ def _prewarm_russian_async() -> None:
|
|
| 2692 |
Russian request from stalling, and doing it off-thread keeps the Space from
|
| 2693 |
sitting in APP_STARTING while it downloads. Set BLUE_PREWARM_RU=0 to skip.
|
| 2694 |
"""
|
| 2695 |
-
if "ru" not in AVAILABLE_LANGS:
|
| 2696 |
-
return
|
| 2697 |
if os.environ.get("BLUE_PREWARM_RU", "1").strip().lower() in {"0", "false", "no", "off"}:
|
| 2698 |
return
|
| 2699 |
if _SERVERLESS:
|
|
@@ -3225,6 +3228,7 @@ def clone_voice(ref_wav: Optional[str], voice_name: str):
|
|
| 3225 |
# `_SERVERLESS` is set at import time from BLUE_SERVE_MODE / BLUE_SKIP_GRADIO.
|
| 3226 |
|
| 3227 |
EXAMPLES = [
|
|
|
|
| 3228 |
["The power to change begins the moment you believe it's possible!", "en"],
|
| 3229 |
["הכוח לשנות מתחיל ברגע שבו אתה מאמין שזה אפשרי!", "he"],
|
| 3230 |
["¡El poder de cambiar comienza en el momento en que crees que es posible!", "es"],
|
|
@@ -3296,7 +3300,7 @@ if not _SERVERLESS:
|
|
| 3296 |
with gr.Row(elem_classes="ctrl-row1"):
|
| 3297 |
lang_input = gr.Dropdown(
|
| 3298 |
choices=[("English 🇺🇸", "en"), ("Hebrew 🇮🇱", "he"),
|
| 3299 |
-
("Spanish 🇪🇸", "es"),
|
| 3300 |
("German 🇩🇪", "de"), ("Italian 🇮🇹", "it")],
|
| 3301 |
value="en", label="Language", elem_classes="ctrl-lang",
|
| 3302 |
)
|
|
|
|
| 219 |
|
| 220 |
# The v2.5 checkpoint was trained on he/en/de/it/es/ru/yi. Yiddish is left out
|
| 221 |
# here because its front end (nikud + yiddish_g2p) does not ship with the export.
|
| 222 |
+
# BlueV3 v3.0.0 (ba91a778) ships he/en/de/es/it/ru through this app; Yiddish's
|
| 223 |
+
# front end (frontend/yi/) is not wired in yet.
|
| 224 |
+
AVAILABLE_LANGS = ["en", "es", "de", "it", "he", "ru"]
|
| 225 |
BLUE_SYNTH_MAX_CHUNK_LEN = int(RELEASE_INF.get("max_chunk_tokens", 300))
|
| 226 |
DEFAULT_STEPS = int(RELEASE_INF.get("steps", 8))
|
| 227 |
DEFAULT_CFG_SCALE = float(RELEASE_INF.get("cfg_scale", 4.0))
|
|
|
|
| 926 |
)
|
| 927 |
# Only route to the Russian front end when this checkpoint exposes Russian;
|
| 928 |
# otherwise stray Cyrillic goes through espeak instead of a 1 GB download.
|
| 929 |
+
if BLUE_RELEASE and _CYRILLIC_CHAR_RE.search(content):
|
| 930 |
+
lang = "ru" # the release reads Russian through polyg2p (below)
|
| 931 |
+
elif "ru" in AVAILABLE_LANGS and (lang == "ru" or _CYRILLIC_CHAR_RE.search(content)):
|
| 932 |
return strip_silent_separator_tokens(self._russian(content))
|
| 933 |
+
if BLUE_RELEASE and lang in ("en", "de", "es", "it", "ru"):
|
| 934 |
out = self._polyg2p(content, lang)
|
| 935 |
if out is not None:
|
| 936 |
return strip_silent_separator_tokens(out)
|
|
|
|
| 2651 |
import. Used to decide whether the UI owes the user a "this will take a
|
| 2652 |
moment" notice, so the notice never appears on an already-warm request.
|
| 2653 |
"""
|
| 2654 |
+
if BLUE_RELEASE or _canonical_lang(lang) != "ru":
|
| 2655 |
+
return False # the release's Russian is polyg2p: nothing to fetch
|
| 2656 |
try:
|
| 2657 |
from g2p import russian_g2p
|
| 2658 |
except ImportError:
|
|
|
|
| 2673 |
Cheap and idempotent once warm; failures are left for the real call to
|
| 2674 |
report, since this is only a warmup.
|
| 2675 |
"""
|
| 2676 |
+
if BLUE_RELEASE or _canonical_lang(lang) != "ru":
|
| 2677 |
return
|
| 2678 |
# Serialize: the startup prewarm thread and a request can race here, and
|
| 2679 |
# RUAccent/RUPhon would otherwise both be built. The GPU child process never
|
|
|
|
| 2695 |
Russian request from stalling, and doing it off-thread keeps the Space from
|
| 2696 |
sitting in APP_STARTING while it downloads. Set BLUE_PREWARM_RU=0 to skip.
|
| 2697 |
"""
|
| 2698 |
+
if BLUE_RELEASE or "ru" not in AVAILABLE_LANGS:
|
| 2699 |
+
return # release: Russian is polyg2p, no RUAccent/RUPhon download
|
| 2700 |
if os.environ.get("BLUE_PREWARM_RU", "1").strip().lower() in {"0", "false", "no", "off"}:
|
| 2701 |
return
|
| 2702 |
if _SERVERLESS:
|
|
|
|
| 3228 |
# `_SERVERLESS` is set at import time from BLUE_SERVE_MODE / BLUE_SKIP_GRADIO.
|
| 3229 |
|
| 3230 |
EXAMPLES = [
|
| 3231 |
+
["Сила меняться появляется в тот момент, когда ты веришь, что это возможно!", "ru"],
|
| 3232 |
["The power to change begins the moment you believe it's possible!", "en"],
|
| 3233 |
["הכוח לשנות מתחיל ברגע שבו אתה מאמין שזה אפשרי!", "he"],
|
| 3234 |
["¡El poder de cambiar comienza en el momento en que crees que es posible!", "es"],
|
|
|
|
| 3300 |
with gr.Row(elem_classes="ctrl-row1"):
|
| 3301 |
lang_input = gr.Dropdown(
|
| 3302 |
choices=[("English 🇺🇸", "en"), ("Hebrew 🇮🇱", "he"),
|
| 3303 |
+
("Russian 🇷🇺", "ru"), ("Spanish 🇪🇸", "es"),
|
| 3304 |
("German 🇩🇪", "de"), ("Italian 🇮🇹", "it")],
|
| 3305 |
value="en", label="Language", elem_classes="ctrl-lang",
|
| 3306 |
)
|
download_models.py
CHANGED
|
@@ -5,9 +5,10 @@ from huggingface_hub import hf_hub_download
|
|
| 5 |
|
| 6 |
BLUE_REPO = os.environ.get("BLUE_ONNX_REPO", "notmax123/BlueV3-onnx")
|
| 7 |
# Pinned so a re-upload of the model repo can't silently change (or 404) what a
|
| 8 |
-
# running Space loads.
|
|
|
|
| 9 |
BLUE_REVISION = os.environ.get(
|
| 10 |
-
"BLUE_ONNX_REVISION", "
|
| 11 |
)
|
| 12 |
# Folder inside the repo that holds the blue_onnx-layout graphs.
|
| 13 |
BLUE_SUBDIR = os.environ.get("BLUE_ONNX_SUBDIR", "onnx")
|
|
@@ -41,7 +42,10 @@ BLUE_FILES = [
|
|
| 41 |
]
|
| 42 |
|
| 43 |
# polyg2p data for en/de/it (es is rule-based). Saved under frontend/.
|
| 44 |
-
POLYG2P_FILES = ["en.lex", "en.g2p", "en-large.g2p", "de.lex", "it.lex",
|
|
|
|
|
|
|
|
|
|
| 45 |
POLYG2P_DIR = os.path.join("frontend", "polyg2p_data")
|
| 46 |
|
| 47 |
# Voices shipped with the release (LibriTTS-R, CC BY 4.0). A voice JSON is only
|
|
|
|
| 5 |
|
| 6 |
BLUE_REPO = os.environ.get("BLUE_ONNX_REPO", "notmax123/BlueV3-onnx")
|
| 7 |
# Pinned so a re-upload of the model repo can't silently change (or 404) what a
|
| 8 |
+
# running Space loads. ba91a778 = BlueV3 v3.0.0, checkpoint 701500 (the repo was
|
| 9 |
+
# squashed to this commit; earlier pins are orphaned).
|
| 10 |
BLUE_REVISION = os.environ.get(
|
| 11 |
+
"BLUE_ONNX_REVISION", "ba91a778064acb60c3137393452dfc82993549c5"
|
| 12 |
)
|
| 13 |
# Folder inside the repo that holds the blue_onnx-layout graphs.
|
| 14 |
BLUE_SUBDIR = os.environ.get("BLUE_ONNX_SUBDIR", "onnx")
|
|
|
|
| 42 |
]
|
| 43 |
|
| 44 |
# polyg2p data for en/de/it (es is rule-based). Saved under frontend/.
|
| 45 |
+
POLYG2P_FILES = ["en.lex", "en.g2p", "en-large.g2p", "de.lex", "it.lex",
|
| 46 |
+
# Russian stress and ё lexicons (ru joined the release at ba91a778)
|
| 47 |
+
"ru_accents.lex", "ru_homographs.lex", "ru_suffix.lex", "ru_yo.lex",
|
| 48 |
+
"ru_yo_homographs.lex", "LICENSE", "NOTICE"]
|
| 49 |
POLYG2P_DIR = os.path.join("frontend", "polyg2p_data")
|
| 50 |
|
| 51 |
# Voices shipped with the release (LibriTTS-R, CC BY 4.0). A voice JSON is only
|
requirements.txt
CHANGED
|
@@ -21,7 +21,7 @@ heb-tts-normalizer==0.2.0
|
|
| 21 |
hebrew-num2words==0.1.0
|
| 22 |
# en/de/es/it G2P the release was trained on. Linux x86-64 wheel only; on other
|
| 23 |
# platforms the app falls back to espeak-ng (lower quality).
|
| 24 |
-
polyg2p @ https://huggingface.co/notmax123/BlueV3-onnx/resolve/
|
| 25 |
# BlueV3 doesn't expose Russian, so BlueV2's pre-requirements.txt (RUAccent +
|
| 26 |
# RUPhon, which declare a CPU `onnxruntime`) is not used here.
|
| 27 |
|
|
|
|
| 21 |
hebrew-num2words==0.1.0
|
| 22 |
# en/de/es/it G2P the release was trained on. Linux x86-64 wheel only; on other
|
| 23 |
# platforms the app falls back to espeak-ng (lower quality).
|
| 24 |
+
polyg2p @ https://huggingface.co/notmax123/BlueV3-onnx/resolve/ba91a778064acb60c3137393452dfc82993549c5/frontend/polyg2p-0.1.0-cp39-abi3-manylinux_2_34_x86_64.whl ; sys_platform == "linux" and platform_machine == "x86_64"
|
| 25 |
# BlueV3 doesn't expose Russian, so BlueV2's pre-requirements.txt (RUAccent +
|
| 26 |
# RUPhon, which declare a CPU `onnxruntime`) is not used here.
|
| 27 |
|