mayank-git-hub / ETE-Speech-Recognition

Implementation of Hybrid CTC/Attention Architecture for End-to-End Speech Recognition in pure python and PyTorch
Apache License 2.0
26 stars 2 forks source link

model.py line 453 IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1) #1

Closed FriedaSmith closed 4 years ago

FriedaSmith commented 4 years ago

Hello. When I run your code, it had an exception in ilter_banks = torch.matmul(pow_frames, fbank.transpose(1, 0)): IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1) Thanks and regards

mayank-git-hub commented 4 years ago

Thank you for using the repository!

The error means that fbank is a 1 dimension torch tensor, whereas the way I have initialized it on line 397 in model.py shows it to be 2 dimensional.

Did you change some parts of the code? If so, then could you please send it here, I would have a look into it.

FriedaSmith commented 4 years ago

I only delete num_cuda in config.py beacuse NameError: name 'num_cuda' is not defined

mayank-git-hub commented 4 years ago

I guess you meant added num_cuda. I will add the specific_cuda.py file in the repository, it will clear out some of the errors.

But related to the fbank part, I am not sure why you are getting the error. Let me re-run the code and check if it works fine on my PC. I will get back to you.

mayank-git-hub commented 4 years ago

I have added the specific_config.py file in the repository. You will have to set the path for the dataset there.

I hope it solves some of the errors.

I re-ran the code on my PC and I don't seem to get the fbank error.

mayank-git-hub commented 4 years ago

I guess when you removed config.num_cuda from the line 412 in model.py which is

self.fbank = [fbank.to(torch.device('cuda:'+str(i))) for i in range(len(config.num_cuda.split(',')))]

You might have removed the list. That is why the fbank which was a list of 2 dimension tensor, became a 2 dimension tensor, and one dimension was removed in model.py line 418.

I think if you revert the changes you made it should work now.

FriedaSmith commented 4 years ago

Thank you very much. It's the problem of num_cuda. I can run normally according to your configuration in specific_config.py.

mayank-git-hub commented 4 years ago

Glad I could help. I would close the issue now.