xiaojunxu / SQLNet

Neural Network for generating structured queries from natural language.
BSD 3-Clause "New" or "Revised" License
427 stars 162 forks source link

Error in train.py with --ca argument #67

Closed yefangwong closed 2 years ago

yefangwong commented 2 years ago

(SQLNet) yfwong@DESKTOP-JS1B4A9:/mnt/c/Users/user/Documents/Projects/SQLNet_Python3$ python train.py --ca Loading from original dataset Loading data from data/train_tok.jsonl Loading data from data/train_tok.tables.jsonl Loading data from data/dev_tok.jsonl Loading data from data/dev_tok.tables.jsonl Loading data from data/test_tok.jsonl Loading data from data/test_tok.tables.jsonl Loading word embedding from glove/glove.42B.300d.txt Using fixed embedding Using column attention on aggregator predicting Using column attention on selection predicting Using column attention on where predicting Traceback (most recent call last): File "train.py", line 102, in init_acc = epoch_acc(model, BATCH_SIZE, File "/mnt/c/Users/user/Documents/Projects/SQLNet_Python3/sqlnet/utils.py", line 205, in epoch_acc score = model.forward(q_seq, col_seq, col_num, File "/mnt/c/Users/user/Documents/Projects/SQLNet_Python3/sqlnet/model/sqlnet.py", line 125, in forward x_emb_var, x_len = self.embed_layer.gen_x_batch(q, col) File "/mnt/c/Users/user/Documents/Projects/SQLNet_Python3/sqlnet/model/modules/word_embedding.py", line 76, in gen_x_batch val_emb_array[i,t,:] = val_embs[i][t] IndexError: index 2 is out of bounds for axis 1 with size 2

Have any ideas? I use python 3.8 and Nvidia RTX 3070, and run in WSL2 on windows 11 thanks!

yefangwong commented 2 years ago

I solve it.

PradnyaNileshSawant commented 1 year ago

I am also facing the same problem. How did you solve the issue.

This is the traceback (myenv) C:\Pradnya\code\SQLNet>python train.py --ca --train_emb Loading from original dataset Loading data from data/train_tok.jsonl Loading data from data/train_tok.tables.jsonl Loading data from data/dev_tok.jsonl Loading data from data/dev_tok.tables.jsonl Loading data from data/test_tok.jsonl Loading data from data/test_tok.tables.jsonl Load used word embedding Using trainable embedding Using trainable embedding Using trainable embedding Using column attention on aggregator predicting Using column attention on selection predicting Using column attention on where predicting Loading from saved_model/old_sqlnet_ca.agg_model Loading from saved_model/old_sqlnet_ca.sel_model Loading from saved_model/old_sqlnet_ca.cond_model Traceback (most recent call last): File "C:\Pradnya\PhD\code\SQLNet\train.py", line 106, in init_acc = epoch_acc(model, BATCH_SIZE, File "C:\Pradnya\PhD\code\SQLNet\sqlnet\utils.py", line 208, in epoch_acc score = model.forward(q_seq, col_seq, col_num, File "C:\Pradnya\PhD\code\SQLNet\sqlnet\model\sqlnet.py", line 103, in forward x_emb_var, x_len = self.agg_embed_layer.gen_x_batch(q, col) File "C:\Pradnya\PhD\code\SQLNet\modules\word_embedding.py", line 70, in gen_x_batch val_inp_var = self.embedding(val_tok_var) File "C:\Users\91916\anaconda3\envs\myenv\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl return forward_call(*input, **kwargs) File "C:\Users\91916\anaconda3\envs\myenv\lib\site-packages\torch\nn\modules\sparse.py", line 158, in forward return F.embedding( File "C:\Users\91916\anaconda3\envs\myenv\lib\site-packages\torch\nn\functional.py", line 2183, in embedding return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse) IndexError: index out of range in self

sandriansandy commented 1 year ago

I solve it.

how did you solve it?