Code Monkey home page Code Monkey logo

audio-denoiser's People

Contributors

jose-solorzano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

audio-denoiser's Issues

Package not using CUDA

Hello, I'm having a problem with this package. It seems like it's not using CUDA at all on my machine! I've verified that CUDA is working just fine; in fact, I'm running models on CUDA in the same file as I call this model.

Here's my relevant code. Let me know if you need more details.

import torchaudio
from audio_denoiser.AudioDenoiser import AudioDenoiser

device = "cpu"
if (torch.cuda.is_available()): device = "cuda:0"
# ...
denoiser = AudioDenoiser(device=torch.device(device))
# ...
signal, fs = torchaudio.load(source)
auto_scale = True # Recommended for low-volume input audio
signal = denoiser.process_waveform(waveform=signal, sample_rate=16000, return_cpu_tensor=True, auto_scale=auto_scale)

It seems to work as is, but I'd like to get it to run on CUDA if possible.

Thanks,
Micah

RuntimeError: Couldn't find appropriate backend to handle uri <filename> and format None.

Hello,

I tried both the basic example as well as one with additional parameters, and always getting this error, probably the issue is related to torchaudio library.

Output
(venv) k:\AI\AudioDenoiser>python . K:\AI\AudioDenoiser\sample.wav                                                      
k:\AI\AudioDenoiser\__main__.py:9: UserWarning: torchaudio._backend.set_audio_backend has been deprecated. With dispatch
er enabled, this function is no-op. You can remove the function call.                                                   
  torchaudio.set_audio_backend("soundfile")                                                                             
  Traceback (most recent call last):                                                                                    
  File "<frozen runpy>", line 198, in _run_module_as_main                                                               
  File "<frozen runpy>", line 88, in _run_code                                                                          
  File "k:\AI\AudioDenoiser\__main__.py", line 16, in <module>                                                          
    denoiser.process_audio_file(in_audio_file, out_audio_file, auto_scale=auto_scale)                                   
  File "k:\AI\AudioDenoiser\venv\Lib\site-packages\audio_denoiser\AudioDenoiser.py", line 110, in process_audio_file    
    waveform, sample_rate = torchaudio.load(in_audio_file)                                                              
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                              
  File "k:\AI\AudioDenoiser\venv\Lib\site-packages\torchaudio\_backend\utils.py", line 203, in load                     
    backend = dispatcher(uri, format, backend)                                                                          
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                          
  File "k:\AI\AudioDenoiser\venv\Lib\site-packages\torchaudio\_backend\utils.py", line 115, in dispatcher               
    raise RuntimeError(f"Couldn't find appropriate backend to handle uri {uri} and format {format}.")                   
RuntimeError: Couldn't find appropriate backend to handle uri K:\AI\AudioDenoiser\sample.wav and format None.           

(venv) k:\AI\AudioDenoiser>                                                                                                                         

I see from the error message that some "format" is None, maybe I have to set it explicitly or it's not recognized for some reason.

__main__.py
from sys import argv
import os
from audio_denoiser.AudioDenoiser import AudioDenoiser
import torch
import torchaudio

if __name__ == "__main__":
  # Use the "soundfile" audio backend, used in training.
  torchaudio.set_audio_backend("soundfile")
  # Use a CUDA device for inference if available
  device = torch.device('cuda:0') if torch.cuda.is_available() else torch.device('cpu')
  denoiser = AudioDenoiser(device=device)
  in_audio_file = argv[1]
  out_audio_file = f"{os.path.splitext(in_audio_file)[0]}-denoise.wav"
  auto_scale = True # Recommended for low-volume input audio
  denoiser.process_audio_file(in_audio_file, out_audio_file, auto_scale=auto_scale)

Python: 3.11.1
OS: Windows 10 x64
The WAV file format is a standard: 44.1 kHz, 16 bits, 1 channel, PCM (Little / Signed), Duration: 1 min 43 s
The script is running under venv with audio-denoiser package installed (pip install audio-denoiser)
Here is the pip list output:

Installed packages
Package            Version
------------------ ----------
audio-denoiser     0.1.1
certifi            2023.11.17
charset-normalizer 3.3.2
colorama           0.4.6
filelock           3.13.1
fsspec             2023.12.2
huggingface-hub    0.20.2
idna               3.6
Jinja2             3.1.2
MarkupSafe         2.1.3
mpmath             1.3.0
networkx           3.2.1
numpy              1.26.3
packaging          23.2
pip                22.3.1
PyYAML             6.0.1
regex              2023.12.25
requests           2.31.0
safetensors        0.4.1
setuptools         65.5.0
sympy              1.12
tokenizers         0.15.0
torch              2.1.2
torchaudio         2.1.2
tqdm               4.66.1
transformers       4.36.2
typing_extensions  4.9.0
urllib3            2.1.0

Appreciate any help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.