Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
OmniVoice
✓ from omnivoice import OmniVoice
✗ from omnivoice.model import OmniVoice
Direct import path changed in early versions.
infer
✓ from omnivoice import infer
✗ from omnivoice.inference import infer
Inference function available at top-level.
Basic TTS inference with voice cloning.
from omnivoice import OmniVoice, infer
# Load model
model = OmniVoice.from_pretrained("k2-fsa/OmniVoice")
# Synthesize speech
audio = infer(model, text="Hello world", reference_audio="ref.wav", reference_text="The quick brown fox")
# Save to file
import torchaudio
torchaudio.save("output.wav", audio.unsqueeze(0), 24000)
Errors
Common errors & fixes
RuntimeError: Audio length mismatch
Reference audio and text lengths do not align, or audio is too long (>30s recommended).
fixTrim reference audio to 3-30 seconds and ensure the text corresponds exactly.
AttributeError: module 'torchaudio' has no attribute 'resample'
torchaudio version is too old (<0.12) for resample function.
fixInstall torchaudio >= 0.12: pip install --upgrade torchaudio
ImportError: cannot import name 'OmniVoice' from 'omnivoice'
Incorrect import path; older documentation showed wrong path.
fixUse 'from omnivoice import OmniVoice' instead of 'from omnivoice.model import OmniVoice'.
ValueError: The truth value of an array with more than one element is ambiguous
Passing stereo audio as reference; expects mono.
fixConvert reference audio to mono with torchaudio.functional.to_mono().
FileNotFoundError: No such file or directory: 'path/to/model'
Model not downloaded or cache path misconfigured.
fixEnsure internet connection for first download, or set OMNIVOICE_CACHE_DIR to a valid path.
Upgrade
Version history
0.1.5latest on PyPI · released Apr 28, 2026
Audit
Dependencies
torchrequiredCore dependency for model inference and training.
torchaudiorequiredAudio processing backend; resampling and loading audio files.
transformersrequiredRequired for tokenizer and model components.