VoiceHubstyletts2
StyleTTS2¶
Uses an explicit local VoiceHub artifact and the native phoneme boundary required by StyleTTS 2.
Parameter metadata: Not reported: the audited metadata available for the registered default does not provide an exact parameter total.
Resources
Usage¶
Complete the VoiceHub installation once, then run this repository-authored example. Model pages intentionally contain no package-install command.
This example is maintained against VoiceHub's public API; it is not copied from an upstream demo or package README.
Model-specific path: Uses an explicit local VoiceHub artifact and the native phoneme boundary required by StyleTTS 2.
Inputs and controls: Convert or review the upstream LibriTTS files first; the HF repository is provenance, not a drop-in VoiceHub directory.
from pathlib import Path
from voicehub import AutoModelForTextToSpeech, TTSGenerationConfig
REFERENCE_AUDIO = Path("reference.wav")
REFERENCE_TEXT = "The reference transcript must exactly match the authorized audio."
if not REFERENCE_AUDIO.is_file():
raise FileNotFoundError(REFERENCE_AUDIO)
model = AutoModelForTextToSpeech.from_pretrained(
'checkpoints/styletts2/model.safetensors',
model_type='styletts2',
device="cuda",
lazy_load=True,
)
output = model.generate(
'həˈloʊ fɹʌm vɔɪs hʌb',
generation_config=TTSGenerationConfig(
seed=42,
output_file=Path("output.wav"),
),
speaker_audio_path=str(REFERENCE_AUDIO),
text_is_phonemes=True,
diffusion_steps=5,
embedding_scale=1.0,
)
print(output.file_path, output.sample_rate, output.metadata)
Use authorized recordings. Verify hardware needs and pin a revision in production.
Overview¶
styletts2 is a VoiceHub text to speech
integration. This page is generated from its registry contract.
| Property | Value |
|---|---|
| Task | Text to speech |
| Architecture | styletts2 |
| Runtime | VoiceHub-native |
| Languages | en-US |
| Capabilities | text-to-speech, voice-cloning, fine-tuning, safetensors, voicehub-native, native-runtime, preprocessed-training, explicit-phonemes |
| Reusable components | — |
| Normalized output | TTSOutput |
Language support¶
Supported language abbreviations
en-US
Paper and GitHub¶
- Paper: StyleTTS 2: Towards Human-Level Text-to-Speech through Style Diffusion
- Upstream GitHub: StyleTTS 2
- VoiceHub source: VoiceHub model implementation
Configuration¶
Load configuration without constructing the model:
| Property | Value |
|---|---|
| Canonical model type | styletts2 |
| Configuration class | StyleTTS2Config |
| Architecture class | StyleTTS2ForTextToSpeech |
Processing¶
Create the registered processor without allocating model weights:
from voicehub import AutoProcessor
processor = AutoProcessor.from_pretrained(
'checkpoints/styletts2/model.safetensors',
model_type='styletts2',
)
print(type(processor).__name__)
Inference¶
The Usage example returns TTSOutput through AutoModelForTextToSpeech.
Input and output contract¶
| Property | Value |
|---|---|
| Readiness | preprocessed |
| Data architecture | vits |
| Sample rate | 24,000 Hz |
| Contract getter | get_tts_dataset_spec('styletts2') |
| Variant | Required fields | One of | Boundary | Other rules |
|---|---|---|---|---|
explicit-features |
input_ids, alignments, normalized_mel, reference_mel, f0_targets, noise_targets, audio_values |
— | Prepared | — |
VITS/GAN text, waveform, spectrogram, and adversarial data. See the data workflow.
Training and optimization¶
Use available_optimization_passes() to discover reversible public passes.
Unsupported runtime or hardware fails closed before mutation.
Training contract¶
| Property | Value |
|---|---|
| Support | preprocessed |
| Family | vits |
| Recipe | adversarial |
| Default phase | generator |
| Training checkpoint | owner/model-or-local-directory |
| Native training graph | yes |
| Phase | Kind | Components | Required inputs | Loss keys |
|---|---|---|---|---|
generator |
generator | training_model.model |
input_ids, input_lengths, alignments, alignment_lengths, normalized_mel, normalized_mel_lengths, reference_mel, reference_mel_lengths, f0_targets, noise_targets, audio_values, audio_lengths |
loss |
discriminator |
discriminator | training_model.mpd, training_model.msd |
input_ids, input_lengths, alignments, alignment_lengths, normalized_mel, normalized_mel_lengths, reference_mel, reference_mel_lengths, f0_targets, noise_targets, audio_values, audio_lengths |
loss |
Prepare the exact tensors listed in the data contract before this step. Call model.validate_training_support() first, then follow the
training workflow.
Checkpoints, provenance, license, and limitations¶
| Property | Value |
|---|---|
| Default checkpoint | No default; pass a compatible Hub ID or local directory. |
| Hugging Face ID | yl4579/StyleTTS2-LibriTTSUpstream LibriTTS repository, verified available on 2026-08-11. VoiceHub requires a reviewed local artifact because the published layout is not a native VoiceHub directory. |
| Checkpoint status | No registry default; provide the compatible local artifact described on this page |
| Optional dependency extra | Core package |
| Hardware and runtime | Usage selects cuda; verify checkpoint-specific requirements |
| Real-checkpoint evidence | Release evidence; a registry default alone is not execution evidence |
| Implementation | voicehub.models.styletts2.modeling_styletts2.StyleTTS2ForTextToSpeech |
| Configuration | voicehub.models.styletts2.configuration_styletts2.StyleTTS2Config |
| Source provenance | voicehub/models/styletts2/source/SOURCE.json |
| License | Checkpoint-specific |
No VoiceHub-specific license override is registered. Verify the checkpoint and upstream source terms before use.
Confirm the checkpoint revision, access terms, provenance, and license.
Limitations¶
- No integration-specific checkpoint limitation is registered. Verify the selected checkpoint revision and its documented runtime requirements.
- Validate memory, precision, and optional dependencies on the target system.
- Public optimizations fail closed when the runtime or hardware cannot satisfy their validation contract; an unavailable pass is not reported as applied.
- Contract tests do not replace the linked released-checkpoint evidence.
Public API¶
Use the stable configuration, processor, and task-model facades below.
Configuration
StyleTTS2Config¶
Parameters¶
**config_kwargs— Configuration fields validated by StyleTTS2Config.
Model
StyleTTS2ForTextToSpeech¶
Parameters¶
pretrained_model_name_or_path— Hub ID or compatible local directory.model_type— Canonical model type; use 'styletts2'.config— Optional preloaded StyleTTS2Config instance.**model_kwargs— Model-specific loading arguments.
from voicehub import get_model_spec
spec = get_model_spec('styletts2')
print(spec.display_name, spec.task.value)
| Purpose | Public object |
|---|---|
| Discover | get_model_spec('styletts2') |
| Load and run | AutoModelForTextToSpeech |
| Configure | StyleTTS2Config |
| Process | AutoProcessor |
| Model implementation | StyleTTS2ForTextToSpeech |
| Normalized output | TTSOutput |
| Training contract | get_training_spec('styletts2') |
| Optimization lifecycle | available_optimization_passes, apply_optimization_plan, optimization_manifest, restore_optimization_plan |
See all model guides, inference, and the training matrix.