Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug report - Support for sound backend on Linux #59

Closed
trackrx opened this issue Mar 30, 2021 · 6 comments
Closed

Bug report - Support for sound backend on Linux #59

trackrx opened this issue Mar 30, 2021 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@trackrx
Copy link

trackrx commented Mar 30, 2021

馃悰 Bug

Running samples on the Linux platform (Ubuntu Focal/Mint Ulyssa flavors) causes crash due to the missing "soundfile" backend.

To Reproduce

On Ubuntu (focal):

  1. python3 -m python3 -m pip install pytorch torch omegaconf torchaudio
  2. Run minimal example from the README:
import torch

language = 'ru'
speaker = 'kseniya_16khz'
device = torch.device('cpu')
model, symbols, sample_rate, example_text, apply_tts = torch.hub.load(repo_or_dir='snakers4/silero-models',
                                                                      model='silero_tts',
                                                                      language=language,
                                                                      speaker=speaker)
model = model.to(device)  # gpu or cpu
audio = apply_tts(texts=[example_text],
                  model=model,
                  sample_rate=sample_rate,
                  symbols=symbols,
                  device=device)

Error message received:

Traceback (most recent call last):
...
    from utils import (init_jit_model,
  File "/home/user/.cache/torch/hub/snakers4_silero-models_master/utils.py", line 16, in <module>
    torchaudio.set_audio_backend(audio_backend_name)  # switch backend
  File "/home/user/.local/lib/python3.8/site-packages/torchaudio/backend/utils.py", line 52, in set_audio_backend
    raise RuntimeError(
RuntimeError: Backend "soundfile" is not one of available backends: ['sox', 'sox_io'].```

It seems that on Linux the default sound backend should be "sox_io" (the "sox" backend is deprecated). The "soundfile" backend is only available on Windows.

## Expected behavior

The example code should work on Linux.

## Environment

PyTorch version: 1.8.1+cu102
Is debug build: False
CUDA used to build PyTorch: 10.2
ROCM used to build PyTorch: N/A

OS: Linux Mint 20.1 (x86_64)
GCC version: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Clang version: 10.0.0-4ubuntu1 
CMake version: version 3.16.3

Python version: 3.8 (64-bit runtime)
Is CUDA available: False
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.17.4
[pip3] torch==1.8.1
[pip3] torchaudio==0.8.1
[conda] Could not collect

## Additional context

Suggested solution - fix util.py to add support for platforms other than Windows.
@snakers4
Copy link
Owner

snakers4 commented Mar 31, 2021

Looks like this happens due to a newer version of torchaudio

@snakers4
Copy link
Owner

I guess a better option will be just to fall back to soundfile defaults instead of switching back ends

@snakers4
Copy link
Owner

b6829ee
1752012

Cleaned up the examples, remove soundfile switch and dependencies installation

@snakers4
Copy link
Owner

@trackrx
Please verify that everything works for you now

@trackrx
Copy link
Author

trackrx commented Mar 31, 2021

Reviewed, re-tested. Confirm that the fix works.
Closing the bug. Thank you!

@trackrx trackrx closed this as completed Mar 31, 2021
@snakers4
Copy link
Owner

Thanks for catching a bug and reporting it properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants