csteinmetz1 / auraloss

Collection of audio-focused loss functions in PyTorch
Apache License 2.0
724 stars 66 forks source link

NameError: name 'kwargs' is not defined when running compressor example #30

Closed leoauri closed 2 years ago

leoauri commented 2 years ago

Hi Christian!

Running the compressor example I get this error:

$ srun ... python examples/compressor/train_comp.py --root_dir /.../SignalTrain_LA2A_Dataset_1.1
GPU available: False, used: False
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
Global seed set to 42
NOTE! Installing ujson may make loading annotations faster.
Located 94285 examples totaling 19.5 hr in the train subset.
Located 19762 examples totaling 4.1 hr in the val subset.
training with l1
lightning_logs/version_0/l1
lightning_logs/version_0/l1
Traceback (most recent call last):
  File "examples/compressor/train_comp.py", line 93, in <module>
    model = TCNModel(**dict_args)
  File "/home/.../auraloss/examples/compressor/tcn.py", line 147, in __init__
    self.rrstft = auraloss.freq.RandomResolutionSTFTLoss()
  File "/opt/conda/lib/python3.8/site-packages/auraloss/freq.py", line 421, in __init__
    self.randomize_losses()  # init the losses
  File "/opt/conda/lib/python3.8/site-packages/auraloss/freq.py", line 452, in randomize_losses
    **kwargs,
NameError: name 'kwargs' is not defined

Taking a look at it now... Cheers Leo

csteinmetz1 commented 2 years ago

Hey Leo. Thanks for raising this.

I tried to reproduce this from the main branch and I didn't hit any errors. I have a hunch that you may be on an older version since there is no longer a line 452 in auraloss/freq.py. Can you try again with a fresh pull of the repo? Let me know. Thanks!

(Side note: the example training code is a bit old and perhaps a bit brittle so I wouldn't be surprised if you hit some errors, but it does seem that basic training is working...)

leoauri commented 2 years ago

Hey Christian, thanks for your quick response.

Maybe I am missing something on this quick look, but as far as I can see main seems to have that line: here

I installed by cloning the repo at 69d53b7 and pip install ., in case that makes any difference.

I will have some time tomorrow to have a look at this. Cheers, Leo

csteinmetz1 commented 2 years ago

Ah, you are completely right! That is my mistake. I was working from a different branch. Let me look into this tomorrow. I think the fix should be fairly straightforward.

leoauri commented 2 years ago

Cool. I patched it by just removing **kwargs...

csteinmetz1 commented 2 years ago

Nice, I pushed the change to main with #31. Also removed the torchsummary imports which aren't needed.