Open lthakur007 opened 5 years ago
hi~ anybody know how to fix this issue?
thanks!
the same problem~
the same problem~
the same problem~
same problem
Same issue when using flair0.4.1, pythorch1.1.0 and BertEmbeddings on 2 x NVIDIA Tesla P100
the same problem
the same problem~
I had an issue with the embeddings I fixed it initializing the embedding layer with the right size which is the size of the vocabulary I am using.
when creating your Encoder/Model:
self.embed = nn.Embedding(vocab_size, embed_size)
I was using a smaller number than my actual vocab_size thus resulting in an error.
the same problem
same issue
hi, is anybody fix the problem?
Hi, try to inspect the size of your vocabulary , if using the vocab_size
in the Embedding layer initialization, try to add +1 to it like -> self.embed = nn.Embedding(vocab_size+1, embed_size)
we have the same problem using LASER bi-LSTM model with PyTorch 1.0 / Python 3.7
https://github.com/facebookresearch/LASER
Did anyone get the solution? I'm stuck! just wanted to confirm what vocab_size here means. Does it mean the length of the tokenized words set?
It happened to me when I had out-of-vocabulary words which were assigned a -1 value, and also it happens when you set the vocab-size to a smaller value than the size of the vocabulary + 1
Sorry for answering so late! I think I've fixed this bug. The main reason is that I accumulated offset when iterate feature size in data preprocess, so index of categorial feature is out of embedding size. Please refer to the update in dataPreprocess.py. Also, I've found that I should set the index of coutinous feature as 0, and the value of coutinous feature as its original value instead of 1. Refer to the update of dataset.py for more details. Thanks for your attention.
@chenxijun1029 in which version this has been fixed? Thank you.
Hey guys, I had the same problem. In my case, what happened was that I was presenting the Input (X) and the Output (Y) to the model with len(X) != len(Y) due to an error in a third-party library.
Best regards and good luck!
the same problem~
I had an issue with the embeddings I fixed it initializing the embedding layer with the right size which is the size of the vocabulary I am using.
when creating your Encoder/Model:
self.embed = nn.Embedding(vocab_size, embed_size)
I was using a smaller number than my actual vocab_size thus resulting in an error.
Hi. I too resolved my issue by fixing what @MCSZN suggested.
Hi, try to inspect the size of your vocabulary , if using the
vocab_size
in the Embedding layer initialization, try to add +1 to it like ->self.embed = nn.Embedding(vocab_size+1, embed_size)
Hi, this works. But would you mind providing an explanation for this?
Hi, try to inspect the size of your vocabulary , if using the
vocab_size
in the Embedding layer initialization, try to add +1 to it like ->self.embed = nn.Embedding(vocab_size+1, embed_size)
Hi, this works. But would you mind providing an explanation for this?
I guess it was a bug, which is now fixed by @chenxijun1029 . What I remember is that the error is because embedding_dim must be equal to the vocab size, but when initializing the embedding layer with len(voca_size) it somehow subtracts 1.
Hi, try to inspect the size of your vocabulary , if using the
vocab_size
in the Embedding layer initialization, try to add +1 to it like ->self.embed = nn.Embedding(vocab_size+1, embed_size)
Hi, this works. But would you mind providing an explanation for this?
I guess it was a bug, which is now fixed by @chenxijun1029 . What I remember is that the error is because embedding_dim must be equal to the vocab size, but when initializing the embedding layer with len(voca_size) it somehow subtracts 1.
got it. thanks very much.
same issue
Hi, try to inspect the size of your vocabulary , if using the
vocab_size
in the Embedding layer initialization, try to add +1 to it like ->self.embed = nn.Embedding(vocab_size+1, embed_size)
Why +1 will solve the problem,The initialization of embedding should not be used vocab_size rather than vocab_size+1?
I have the same issue. See DeepFM_with_PyTorch/data/dataset.py
Row7 : continous_features = 13
.
Change the value for your dataset. You can have a correct result.
observing the following error while running deep ctr on the gpu:
Traceback (most recent call last): File "main.py", line 31, in
model.fit(loader_train, loader_val, optimizer, epochs=5, verbose=True)
File "/root/deepctr/DeepFM_with_PyTorch/model/DeepFM.py", line 153, in fit
total = model(xi, xv)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, *kwargs)
File "/root/deepctr/DeepFM_with_PyTorch/model/DeepFM.py", line 98, in forward
fm_first_order_emb_arr = [(torch.sum(emb(Xi[:, i, :]), 1).t() Xv[:, i]).t() for i, emb in enumerate(self.fm_first_order_embeddings)]
File "/root/deepctr/DeepFM_with_PyTorch/model/DeepFM.py", line 98, in
fm_first_order_emb_arr = [(torch.sum(emb(Xi[:, i, :]), 1).t() Xv[:, i]).t() for i, emb in enumerate(self.fm_first_order_embeddings)]
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(input, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/sparse.py", line 118, in forward
self.norm_type, self.scale_grad_by_freq, self.sparse)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/functional.py", line 1454, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: index out of range at /pytorch/aten/src/TH/generic/THTensorEvenMoreMath.cpp:191