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

New model runtime error #17

Open
Astronaut323 opened this issue Nov 15, 2024 · 1 comment
Open

New model runtime error #17

Astronaut323 opened this issue Nov 15, 2024 · 1 comment

Comments

@Astronaut323
Copy link

Hi, I had no problems loading and running the previous model, but the new version of the model is running with the following errors.

Traceback (most recent call last):
File "/home/songxiaonan/ReDimNet-master/test_1N.py", line 181, in
acc, suspected_daibin_records = compare_folders(model, folder1, folder2, output_csv_1N, labeld_csv, device,
File "/home/songxiaonan/ReDimNet-master/test_1N.py", line 56, in compare_folders
features2[file_path] = extract_features(model, preprocess_audio(file_path, device)).flatten()
File "/home/songxiaonan/ReDimNet-master/test_gpu.py", line 87, in extract_features
features = model(audio_tensor.unsqueeze(0))
File "/home/model/public/songxiaonan/anaconda3/envs/redimnet/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/songxiaonan/ReDimNet-master/redimnet/model.py", line 422, in forward
x = self.spec(x)
File "/home/model/public/songxiaonan/anaconda3/envs/redimnet/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/songxiaonan/ReDimNet-master/redimnet/layers/features.py", line 139, in forward
x = self.torchfbank(x)+1e-6
File "/home/model/public/songxiaonan/anaconda3/envs/redimnet/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/model/public/songxiaonan/anaconda3/envs/redimnet/lib/python3.9/site-packages/torch/nn/modules/container.py", line 217, in forward
input = module(input)
File "/home/model/public/songxiaonan/anaconda3/envs/redimnet/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/songxiaonan/ReDimNet-master/redimnet/layers/features.py", line 52, in forward
return F.conv1d(x, self.flipped_filter).squeeze(1)
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

@vanIvan
Copy link
Collaborator

vanIvan commented Nov 15, 2024

Hi @Astronaut323 , please make sure both model and input are on the same device:

RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same

States that input is on GPU, but model is not. You've probably forgotten to do model.cuda() or model.to(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

2 participants