crnn-audio-classification icon indicating copy to clipboard operation
crnn-audio-classification copied to clipboard

Error while training using notebook

Open dhaniram-kshirsagar opened this issue 5 years ago • 6 comments

!python run.py train -c my-config.json --cfg crnn.cfg

Compose( ProcessChannels(mode=avg) AdditiveNoise(prob=0.3, sig=0.001, dist_type=normal) RandomCropLength(prob=0.4, sig=0.25, dist_type=half) ToTensorAudio() ) Traceback (most recent call last): File "run.py", line 176, in train_main(config, args.resume) File "run.py", line 85, in train_main model = getattr(net_module, m_name)(classes, config=config) File "/Users/dk/projects/ns/misc_git_projects/crnn-audio-classification/net/model.py", line 29, in init self.net = parse_cfg(config['cfg'], in_shape=[in_chan, self.spec.num_mels, 400]) File "/Users/dk/py_env/ts/lib/python3.7/site-packages/torchparse/parser.py", line 139, in parse_cfg return CFGParser(fname).get_modules(in_shape) File "/Users/dk/py_env/ts/lib/python3.7/site-packages/torchparse/parser.py", line 120, in get_modules model = self._flow(in_shape) File "/Users/dk/py_env/ts/lib/python3.7/site-packages/torchparse/parser.py", line 108, in _flow in_shape = layer.get_out_shape() File "/Users/dk/py_env/ts/lib/python3.7/site-packages/torchparse/base_layers.py", line 40, in get_out_shape return torch.cat([channel, spatial]) RuntimeError: Expected object of scalar type Long but got scalar type Float for sequence element 1 in sequence argument at position #1 'tensors

dhaniram-kshirsagar avatar Jan 17 '20 08:01 dhaniram-kshirsagar

Same

DonRichards avatar Feb 28 '20 17:02 DonRichards

same

giakoumidis avatar Feb 29 '20 12:02 giakoumidis

Same.

Converted tensor to Long and was welcomed with new errors

physiii avatar Mar 29 '20 12:03 physiii

Hi, I got the same error before and successfully run the program by changing the Pytorch version.

conda install pytorch==1.2.0 torchvision==0.4.0 -c pytorch
pip install pillow=6.2.2

wayne391 avatar Mar 30 '20 10:03 wayne391

Hi, I got the same error before and successfully run the program by changing the Pytorch version.

conda install pytorch==1.2.0 torchvision==0.4.0 -c pytorch
pip install pillow=6.2.2

it solves my problem ,thx

undefinedXD avatar Apr 04 '20 02:04 undefinedXD

Changing the 40th line in base_layers.py file in the torchparse package works for me. - return torch.cat([channel, spatial]) + return torch.cat([channel, spatial.long()])

ZishunYu avatar Aug 18 '20 21:08 ZishunYu