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

RuntimeError: expand(torch.LongTensor{[50, 1]}, size=[50]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2) #68

Open
zakarianamikaz opened this issue Sep 9, 2019 · 0 comments

Comments

@zakarianamikaz
Copy link

I was trying to run the program by
python3 train_wc.py --gpu -1 --train_file ./data/ner/train.txt --dev_file ./data/ner/testa.txt --test_file ./data/ner/testb.txt --checkpoint ./checkpoint/ner_ --caseless --fine_tune --high_way --co_train --least_iters 100
I got the following error:

embedding size: '400060'
constructing dataset
building model
/usr/local/python3/lib/python3.6/site-packages/torch/nn/modules/rnn.py:38

: UserWarning: dropout option adds dropout after all but last recurrent layer, so non-zero dropout expects num_layers greater than 1, but got dropout=0.55 and num_layers=1
"num_layers={}".format(dropout, num_layers))
/home/yankai/weixiao/LM-LSTM-CRF/model/utils.py:805

: UserWarning: nn.init.uniform is now deprecated in favor of nn.init.uniform_.
nn.init.uniform(input_linear.weight, -bias, bias)
/home/yankai/weixiao/LM-LSTM-CRF/model/utils.py:816

: UserWarning: nn.init.uniform is now deprecated in favor of nn.init.uniform_.
nn.init.uniform(weight, -bias, bias)
/home/yankai/weixiao/LM-LSTM-CRF/model/utils.py:819

: UserWarning: nn.init.uniform is now deprecated in favor of nn.init.uniform_.
nn.init.uniform(weight, -bias, bias)

Tot it 1406 (epoch 0): 0it [00:00, ?it/s]train_wc.py:201
: UserWarning: torch.nn.utils.clip_grad_norm is now deprecated in favor of torch.nn.utils.clip_grad_norm_.
nn.utils.clip_grad_norm(ner_model.parameters(), args.clip_grad)
Traceback (most recent call last):
File "train_wc.py

", line 212, in
dev_f1, dev_pre, dev_rec, dev_acc = evaluator.calc_score(ner_model, dev_dataset_loader)
File "/home/yankai/weixiao/LM-LSTM-CRF/model/evaluator.py

", line 209, in calc_score
decoded = self.decoder.decode(scores.data, mask_v.data)
File "/home/yankai/weixiao/LM-LSTM-CRF/model/crf.py

", line 379, in decode
decode_idx[idx] = pointer
RuntimeError: expand(torch.LongTensor{[50, 1]}, size=[50]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)

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

1 participant