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

IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1) #2

Open
abdoelsayed2016 opened this issue Nov 18, 2022 · 3 comments

Comments

@abdoelsayed2016
Copy link

Traceback (most recent call last):
File "keyword_information_extraction/train.py", line 394, in
main()
File "keyword_information_extraction/train.py", line 166, in main
logger=logger,train_dataset= train_dataset)
File "keyword_information_extraction/train.py", line 259, in train
predictions = model(text_features)
File "/home/ubuntu/anaconda3/envs/app/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
return forward_call(*input, **kwargs)
File "/home/ubuntu/ICDAR-2019-RRC-SROIE-master-1/keyword_information_extraction/model/charlm/charlm_cnn_highway_lstm.py", line 145, in forward
cnn_features = torch.cat(pool_layers, dim=1)
IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)

@NjoyimPeguy
Copy link
Owner

@abdoelsayed2016 which dataset are you using? The one provided? Because this error means that pool layers are tensors of single dimension.

@abdoelsayed2016
Copy link
Author

custom dataset it works fine when the number of classes more than 4 but when it change it to 3 classes it appear this error.

and i am wondering, the training start normarlly until epoch 80.

@NjoyimPeguy
Copy link
Owner

Well this is weird...I need more details about your custom dataset, code, etc. As it is supposed to work for any number of classes >= 2, I am wondering what you have changed.

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