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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__init__() got an unexpected keyword argument 'max_iter' #166

Open
wangjifly1 opened this issue Dec 18, 2023 · 7 comments
Open

__init__() got an unexpected keyword argument 'max_iter' #166

wangjifly1 opened this issue Dec 18, 2023 · 7 comments

Comments

@wangjifly1
Copy link

when i run a test as follows:
python -m unittest test.audio_to_image_test
an error happens:

Traceback (most recent call last):
File "/Users/wangji/riffusion-main/test/audio_to_image_test.py", line 42, in test_stereo
self.helper_test_with_params(params)
File "/Users/wangji/riffusion-main/test/audio_to_image_test.py", line 60, in helper_test_with_params
audio_to_image(audio=str(audio_path), image=str(image_path), **params)
File "/Users/wangji/riffusion-main/riffusion/cli.py", line 54, in audio_to_image
converter = SpectrogramImageConverter(params=params, device=device)
File "/Users/wangji/riffusion-main/riffusion/spectrogram_image_converter.py", line 21, in init
self.converter = SpectrogramConverter(params=params, device=device)
File "/Users/wangji/riffusion-main/riffusion/spectrogram_converter.py", line 87, in init
self.inverse_mel_scaler = torchaudio.transforms.InverseMelScale(
TypeError: init() got an unexpected keyword argument 'max_iter'

Many thanks for help!!

@wangjifly1
Copy link
Author

I have solved this problem :
pip install --upgrade torch==2.0.1
pip install --upgrade torchaudio==2.0.1
pip install --upgrade torchvision==0.15.1

@Cryptospy
Copy link

same, TypeError: init() got an unexpected keyword argument 'max_iter'

@J4BEZ
Copy link

J4BEZ commented Dec 28, 2023

@Cryptospy It is due to the stable version of torchaudio has been updated to 2.1.2,

InverseMelScale class in torchaudio 2.0.1 has the keyword argument named 'max_iter'
but the version of 2.1.2 doesn't.

You can solve the problem easily with the solution that @wangjifly1 suggested for us.
:: downgrade version of torchaudio

if you would be available for a second for me,
You may check it out in more detail through the PR that I wrote [ #165 ]

Hope you have a peaceful day and happy new year✨

@Cryptospy
Copy link

@J4BEZ This worked for me:

pip uninstall torch torchaudio torchvision

pip install torch==2.0.1+cu118 torchaudio==2.0.2+cu118 torchvision==0.15.2+cu118 -f https://download.pytorch.org/whl/cu118/torch_stable.html

@Cryptospy
Copy link

@J4BEZ happy new year to you too mate

@J4BEZ
Copy link

J4BEZ commented Dec 30, 2023

@Cryptospy Happy to hear that😆😆
Hope you have a joyful weekend and happy new year🙌🙌

@winterer
Copy link

winterer commented Jan 3, 2024

If downgrading torchaudio is not an option, the following code modification works for me (removal of unused parameters due to API changes in torchaudio 2.1.x):

diff --git a/riffusion/spectrogram_converter.py b/riffusion/spectrogram_converter.py
index 9fbfc65..2beb605 100644
--- a/riffusion/spectrogram_converter.py
+++ b/riffusion/spectrogram_converter.py
@@ -90,10 +90,6 @@ class SpectrogramConverter:
             sample_rate=params.sample_rate,
             f_min=params.min_frequency,
             f_max=params.max_frequency,
-            max_iter=params.max_mel_iters,
-            tolerance_loss=1e-5,
-            tolerance_change=1e-8,
-            sgdargs=None,
             norm=params.mel_scale_norm,
             mel_scale=params.mel_scale_type,
         ).to(self.device)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants