Code Monkey home page Code Monkey logo

denoisers's People

Contributors

will-rice avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

Forkers

techthiyanes

denoisers's Issues

RuntimeError: Given groups=1, weight of size [24, 1, 15], expected input[1, 2, 163840] to have 1 channels, but got 2 channels instead

I'm on macOS 13. Python 3.11, ffmpeg 6.1.1, torch and torchaudio 2.2.0. The audio file is almost 21 minutes long and is extracted from this video: https://www.youtube.com/watch?v=8Wdz1Tj5084. I tried both mp3 and wav versions. Your gradio demo errors out on the file too.

This is the full error.

Traceback (most recent call last):
  File "/Users/james/denoisers/test.py", line 20, in <module>
    clean_chunk = model(audio_chunk[None]).audio
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/james/.local/share/virtualenvs/denoisers-4WN3pNTX/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/james/.local/share/virtualenvs/denoisers-4WN3pNTX/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/james/.local/share/virtualenvs/denoisers-4WN3pNTX/lib/python3.11/site-packages/denoisers/modeling/waveunet/model.py", line 156, in forward
    noise = self.model(inputs)
            ^^^^^^^^^^^^^^^^^^
  File "/Users/james/.local/share/virtualenvs/denoisers-4WN3pNTX/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/james/.local/share/virtualenvs/denoisers-4WN3pNTX/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/james/.local/share/virtualenvs/denoisers-4WN3pNTX/lib/python3.11/site-packages/denoisers/modeling/waveunet/model.py", line 234, in forward
    out = self.in_conv(inputs)
          ^^^^^^^^^^^^^^^^^^^^
  File "/Users/james/.local/share/virtualenvs/denoisers-4WN3pNTX/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/james/.local/share/virtualenvs/denoisers-4WN3pNTX/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/james/.local/share/virtualenvs/denoisers-4WN3pNTX/lib/python3.11/site-packages/torch/nn/modules/conv.py", line 310, in forward
    return self._conv_forward(input, self.weight, self.bias)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/james/.local/share/virtualenvs/denoisers-4WN3pNTX/lib/python3.11/site-packages/torch/nn/modules/conv.py", line 306, in _conv_forward
    return F.conv1d(input, weight, bias, self.stride,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Given groups=1, weight of size [24, 1, 15], expected input[1, 2, 163840] to have 1 channels, but got 2 channels instead

The code is taken from the project README.md:

import torch
import torchaudio
from denoisers import WaveUNetModel
from tqdm import tqdm

model = WaveUNetModel.from_pretrained("wrice/waveunet-vctk-24khz")

audio, sr = torchaudio.load("noisy_audio.wav")
if sr != model.config.sample_rate:
    audio = torchaudio.functional.resample(audio, sr, model.config.sample_rate)

chunk_size = model.config.max_length
print(model.config)
padding = abs(audio.size(-1) % chunk_size - chunk_size)
padded = torch.nn.functional.pad(audio, (0, padding))
clean = []
for i in tqdm(range(0, padded.shape[-1], chunk_size)):
    audio_chunk = padded[:, i:i + chunk_size]
    with torch.no_grad():
        clean_chunk = model(audio_chunk[None]).audio
    clean.append(clean_chunk.squeeze(0))

denoised = torch.concat(clean, 1)[:, :audio.shape[-1]]

AttributeError: 'WaveUNetModelOutputs' object has no attribute 'output'

@will-rice , I just got this error,I attached my audio file:
p232.wav.zip

code:

import torch
import torchaudio
from denoisers import WaveUNetModel
from tqdm import tqdm

model = WaveUNetModel.from_pretrained("wrice/waveunet-vctk-24khz")

audio, sr = torchaudio.load("/content/p2325.wav")

if sr != model.config.sample_rate:
    audio = torchaudio.functional.resample(audio, sr, model.config.sample_rate)

chunk_size = model.config.max_length

padding = abs(audio.size(-1) % chunk_size - chunk_size)
padded = torch.nn.functional.pad(audio, (0, padding))

clean = []
for i in tqdm(range(0, padded.shape[-1], chunk_size)):
    audio_chunk = padded[:, i:i + chunk_size]
    with torch.no_grad():
        clean_chunk = model(audio_chunk[None]).audio
    clean.append(clean_chunk.squeeze(0))

denoised = torch.concat(clean, 1)[:, :audio.shape[-1]]

error:

0%|          | 0/1 [00:01<?, ?it/s]

AttributeError        
[p232.wav.zip](https://github.com/will-rice/denoisers/files/14550543/p232.wav.zip)
                    Traceback (most recent call last)
     22         # a=model(audio_chunk[None])
     23         # print(a)
---> 24         clean_chunk = model(audio_chunk[None]).output.audio
     25         # clean_chunk = model(audio_chunk[None]).audio
     26     clean.append(clean_chunk.squeeze(0))

AttributeError: 'WaveUNetModelOutputs' object has no attribute 'output'

Error in Running Code due to Imports


Hi! I was trying to run the code. When I tried to install the requirements, it gave me some import errors which I had to resolve through the following commands:
!pip install fastapi
!pip install kaleido
!pip install python-multipart
!pip install cohere
!pip install openai
!pip install tiktoken
Hope you can add these. However, on running the imports from the code in the README, I was getting the following error:

ImportError Traceback (most recent call last)
in <cell line: 3>()
1 import torch
2 import torchaudio
----> 3 from denoisers import WaveUNetModel
4 from tqdm import tqdm

11 frames
/usr/local/lib/python3.10/dist-packages/pytorch_lightning/core/saving.py in
44 from omegaconf import OmegaConf
45 from omegaconf.dictconfig import DictConfig
---> 46 from omegaconf.errors import UnsupportedValueType, ValidationError
47
48 # the older shall be on the top

ImportError: cannot import name 'UnsupportedValueType' from 'omegaconf.errors' (/usr/local/lib/python3.10/dist-packages/omegaconf/errors.py)

Hope you can provide a fix as I needed immediate help in denoising my audio clips for a ASR project.

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.