supertonic.config¶
supertonic.config ¶
Configuration and constants for Supertonic TTS package.
This module centralizes all configuration values, magic numbers, and default settings used throughout the package.
Functions:
| Name | Description |
|---|---|
get_model_config | Get configuration for a specific model. |
get_model_cache_dir | Get cache directory for a specific model. |
get_model_repo | Get HuggingFace repo ID for a specific model. |
get_model_revision | Get the HuggingFace Hub revision to download for a model. |
is_multilingual_model | Check if a model supports multilingual synthesis. |
Attributes:
AVAILABLE_MODELS module-attribute ¶
MODEL_CONFIGS module-attribute ¶
MODEL_CONFIGS = {
"supertonic": {
"repo": "Supertone/supertonic",
"cache_dir": "supertonic",
"multilingual": False,
"revision": "b6856d033f622c63ea29441795be266a1133e227",
},
"supertonic-2": {
"repo": "Supertone/supertonic-2",
"cache_dir": "supertonic2",
"multilingual": True,
"revision": "75e6727618a02f323c720cba9478152d4bc16ca4",
},
"supertonic-3": {
"repo": "Supertone/supertonic-3",
"cache_dir": "supertonic3",
"multilingual": True,
"revision": "724fb5abbf5502583fb520898d45929e62f02c0b",
},
}
DEFAULT_MODEL_REPO module-attribute ¶
DEFAULT_MODEL_REPO = getenv(
"SUPERTONIC_MODEL_REPO",
MODEL_CONFIGS[DEFAULT_MODEL]["repo"],
)
MODEL_REVISION_ENV_OVERRIDE module-attribute ¶
MODEL_REVISION_ENV_OVERRIDE = getenv(
"SUPERTONIC_MODEL_REVISION"
)
get_model_config ¶
Get configuration for a specific model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name | str | Model name (one of | required |
Returns:
| Type | Description |
|---|---|
dict | Dictionary with model configuration (repo, cache_dir, multilingual) |
Raises:
| Type | Description |
|---|---|
ValueError | If model_name is not valid |
Source code in supertonic/config.py
get_model_cache_dir ¶
Get cache directory for a specific model.
$SUPERTONIC_CACHE_DIR overrides the directory for every model when set — matching the documented contract and the historical DEFAULT_CACHE_DIR spelling. Users running two models from the same process and wanting them separated should leave the env var unset (each model then falls back to its own ~/.cache/<cache_dir>).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name | str | Model name (one of | required |
Returns:
| Type | Description |
|---|---|
Path | Path to the model's cache directory |
Source code in supertonic/config.py
get_model_repo ¶
get_model_revision ¶
Get the HuggingFace Hub revision to download for a model.
Priority: SUPERTONIC_MODEL_REVISION env var (if set) → the per-model pinned SHA in MODEL_CONFIGS. Pinning by SHA keeps a given package version reproducible across HF Hub updates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_name | str | Model name (one of | required |
Returns:
| Type | Description |
|---|---|
str | Commit SHA (or whatever ref the env override points at). |
Source code in supertonic/config.py
is_multilingual_model ¶
UNICODE_INDEXER_REL_PATH module-attribute ¶
UNICODE_INDEXER_REL_PATH = ONNX_DIR / "unicode_indexer.json"
VECTOR_EST_ONNX_REL_PATH module-attribute ¶
VECTOR_EST_ONNX_REL_PATH = (
ONNX_DIR / "vector_estimator.onnx"
)
SUPPORTED_LANGUAGES module-attribute ¶
SUPPORTED_LANGUAGES = [
"en",
"ko",
"ja",
"ar",
"bg",
"cs",
"da",
"de",
"el",
"es",
"et",
"fi",
"fr",
"hi",
"hr",
"hu",
"id",
"it",
"lt",
"lv",
"nl",
"pl",
"pt",
"ro",
"ru",
"sk",
"sl",
"sv",
"tr",
"uk",
"vi",
]
AVAILABLE_LANGUAGES module-attribute ¶
AVAILABLE_LANGUAGES = SUPPORTED_LANGUAGES + [
UNKNOWN_LANGUAGE
]