Configuration and constants for Supertonic TTS package.
This module centralizes all configuration values, magic numbers, and default settings used throughout the package.
Functions:
Attributes:
AVAILABLE_MODELS module-attribute
AVAILABLE_MODELS = ['supertonic', 'supertonic-2']
DEFAULT_MODEL module-attribute
DEFAULT_MODEL = 'supertonic-2'
MODEL_CONFIGS module-attribute
MODEL_CONFIGS = {
"supertonic": {
"repo": "Supertone/supertonic",
"cache_dir": "supertonic",
"multilingual": False,
},
"supertonic-2": {
"repo": "Supertone/supertonic-2",
"cache_dir": "supertonic2",
"multilingual": True,
},
}
DEFAULT_MODEL_REPO module-attribute
DEFAULT_CACHE_DIR module-attribute
DEFAULT_MODEL_REVISION module-attribute
DEFAULT_MODEL_REVISION = getenv(
"SUPERTONIC_MODEL_REVISION", "main"
)
get_model_config
get_model_config(model_name: str) -> dict
Get configuration for a specific model.
Parameters:
| Name | Type | Description | Default |
model_name | str | Model name ("supertonic" or "supertonic-2") | 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
| def get_model_config(model_name: str) -> dict:
"""Get configuration for a specific model.
Args:
model_name: Model name ("supertonic" or "supertonic-2")
Returns:
Dictionary with model configuration (repo, cache_dir, multilingual)
Raises:
ValueError: If model_name is not valid
"""
if model_name not in MODEL_CONFIGS:
raise ValueError(
f"Invalid model: '{model_name}'. " f"Available models: {', '.join(AVAILABLE_MODELS)}"
)
return MODEL_CONFIGS[model_name]
|
get_model_cache_dir
get_model_cache_dir(model_name: str) -> Path
Get cache directory for a specific model.
Parameters:
| Name | Type | Description | Default |
model_name | str | Model name ("supertonic" or "supertonic-2") | required |
Returns:
| Type | Description |
Path | Path to the model's cache directory |
Source code in supertonic/config.py
| def get_model_cache_dir(model_name: str) -> Path:
"""Get cache directory for a specific model.
Args:
model_name: Model name ("supertonic" or "supertonic-2")
Returns:
Path to the model's cache directory
"""
config = get_model_config(model_name)
return Path.home() / ".cache" / config["cache_dir"]
|
get_model_repo
get_model_repo(model_name: str) -> str
Get HuggingFace repo ID for a specific model.
Parameters:
| Name | Type | Description | Default |
model_name | str | Model name ("supertonic" or "supertonic-2") | required |
Returns:
| Type | Description |
str | HuggingFace repository ID |
Source code in supertonic/config.py
| def get_model_repo(model_name: str) -> str:
"""Get HuggingFace repo ID for a specific model.
Args:
model_name: Model name ("supertonic" or "supertonic-2")
Returns:
HuggingFace repository ID
"""
config = get_model_config(model_name)
return config["repo"]
|
is_multilingual_model
is_multilingual_model(model_name: str) -> bool
Check if a model supports multilingual synthesis.
Parameters:
| Name | Type | Description | Default |
model_name | str | Model name ("supertonic" or "supertonic-2") | required |
Returns:
| Type | Description |
bool | True if model supports multiple languages |
Source code in supertonic/config.py
| def is_multilingual_model(model_name: str) -> bool:
"""Check if a model supports multilingual synthesis.
Args:
model_name: Model name ("supertonic" or "supertonic-2")
Returns:
True if model supports multiple languages
"""
config = get_model_config(model_name)
return config["multilingual"]
|
ONNX_DIR module-attribute
VOICE_STYLES_DIR module-attribute
VOICE_STYLES_DIR = Path('voice_styles')
CFG_REL_PATH module-attribute
UNICODE_INDEXER_REL_PATH module-attribute
UNICODE_INDEXER_REL_PATH = ONNX_DIR / "unicode_indexer.json"
DP_ONNX_REL_PATH module-attribute
DP_ONNX_REL_PATH = ONNX_DIR / 'duration_predictor.onnx'
TEXT_ENC_ONNX_REL_PATH module-attribute
TEXT_ENC_ONNX_REL_PATH = ONNX_DIR / 'text_encoder.onnx'
VECTOR_EST_ONNX_REL_PATH module-attribute
VECTOR_EST_ONNX_REL_PATH = (
ONNX_DIR / "vector_estimator.onnx"
)
VOCODER_ONNX_REL_PATH module-attribute
VOCODER_ONNX_REL_PATH = ONNX_DIR / 'vocoder.onnx'
AVAILABLE_LANGUAGES module-attribute
AVAILABLE_LANGUAGES = ['en', 'ko', 'es', 'pt', 'fr']
DEFAULT_LANGUAGE module-attribute
DEFAULT_TOTAL_STEPS module-attribute
DEFAULT_SPEED module-attribute
DEFAULT_MAX_CHUNK_LENGTH module-attribute
DEFAULT_MAX_CHUNK_LENGTH = 300
DEFAULT_MAX_CHUNK_LENGTH_KO module-attribute
DEFAULT_MAX_CHUNK_LENGTH_KO = 120
DEFAULT_SILENCE_DURATION module-attribute
DEFAULT_SILENCE_DURATION = 0.3
MIN_SPEED module-attribute
MAX_SPEED module-attribute
MIN_TOTAL_STEPS module-attribute
MAX_TOTAL_STEPS module-attribute
DEFAULT_ONNX_PROVIDERS module-attribute
DEFAULT_ONNX_PROVIDERS = ['CPUExecutionProvider']
DEFAULT_INTRA_OP_NUM_THREADS module-attribute
DEFAULT_INTRA_OP_NUM_THREADS = _parse_env_int(
"SUPERTONIC_INTRA_OP_THREADS"
)
DEFAULT_INTER_OP_NUM_THREADS module-attribute
DEFAULT_INTER_OP_NUM_THREADS = _parse_env_int(
"SUPERTONIC_INTER_OP_THREADS"
)
MAX_TEXT_LENGTH module-attribute
LOG_FORMAT = (
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
)
LOG_LEVEL module-attribute
LOG_LEVEL = getenv('SUPERTONIC_LOG_LEVEL', 'INFO')