OpenMOSS / OpenMOSS/MOSS-TTS-Nano

ONNX runtime still imports torch/torchaudio in `onnx_tts_runtime.py`

Open
#73 0 comments 0 reactions 0 assignees View on GitHub

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 ImportError when app_onnx.py imports from onnx_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() or librosa.load()
  • Float32 conversion: NumPy astype(np.float32)
  • Resampling: scipy.signal.resample or librosa.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 main branch 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.