OpenMOSS / OpenMOSS/MOSS-TTS-Nano
ONNX runtime still imports torch/torchaudio in `onnx_tts_runtime.py`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 554
- PR merge metrics
- No merged PRs in 30d
Description
Summary
The README states:
No PyTorch dependency during inference: it runs directly on ONNX Runtime CPU.
However, onnx_tts_runtime.py (current main branch, line 12-13) still has:
import torch
import torchaudio
And these are actually used in the _load_reference_audio method (around line 443-451):
waveform, sample_rate = torchaudio.load(...)
waveform = waveform.to(torch.float32)
waveform = torchaudio.functional.resample(waveform, sample_rate, target_sample_rate)
Impact
- Anyone trying to run the ONNX-only deployment without PyTorch installed will get an
ImportErrorwhenapp_onnx.pyimports fromonnx_tts_runtime. - This defeats the purpose of the lightweight ONNX deployment path, especially on resource-constrained devices (e.g., ARM boards, mobile) where installing PyTorch is impractical.
Suggested Fix
Replace the torch/torchaudio usage in _load_reference_audio with lightweight alternatives:
- Audio loading:
soundfile.read()orlibrosa.load() - Float32 conversion: NumPy
astype(np.float32) - Resampling:
scipy.signal.resampleorlibrosa.resample
This would make the ONNX deployment truly PyTorch-free.
Environment
- Discovered while deploying on Android (proot Ubuntu, ARM64) where PyTorch cannot be installed.
- Repository cloned from
mainbranch as of 2026-06-04.
Note: This issue was drafted with the assistance of an AI assistant (Operit). The findings are based on direct source code inspection.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with onnx_tts_runtime.py, especially the imports and _load_reference_audio around lines 12–13 and 443–451; then inspect how app_onnx.py imports it. Verify the ONNX path can load and resample reference audio without torch or torchaudio, and confirm the documented PyTorch-free inference path works on the relevant deployment setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- audio-video-rtc, machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100