RuntimeError: Creating MTGP constants failed.
See original GitHub issue使用 train_single.py
跑一整個文件時跳出這個 error。還沒找到方法解決,但看了幾篇網路上的文章貌似跟文本太長有關係,不知道大佬或是其他人有沒有遇過這個問題?
- Pytorch 版本:1.1.0
- pytorch-transformer: 1.1.0
Token indices sequence length is longer than the specified maximum sequence length for this model (12413 > 1024). Running this sequence through the model will result in indexing errors
...
RuntimeError: Creating MTGP constants failed. at /opt/conda/conda-bld/pytorch_1556653099582/work/aten/src/THC/THCTensorRandom.cu:33
完整 traceback:
Traceback (most recent call last):
File "train_single.py", line 240, in <module>
main()
File "train_single.py", line 179, in main
outputs = model.forward(input_ids=batch_inputs, labels=batch_labels)
File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/pytorch_transformers/modeling_gpt2.py", line 593, in forward
past=past, head_mask=head_mask)
File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
result = self.forward(*input, **kwargs)
File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/pytorch_transformers/modeling_gpt2.py", line 503, in forward
hidden_states = self.drop(hidden_states)
File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
result = self.forward(*input, **kwargs)
File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/nn/modules/dropout.py", line 58, in forward
return F.dropout(input, self.p, self.training, self.inplace)
File "/home/ec2-user/anaconda3/envs/pytorch_p36/lib/python3.6/site-packages/torch/nn/functional.py", line 830, in dropout
else _VF.dropout(input, p, training))
RuntimeError: Creating MTGP constants failed. at /opt/conda/conda-bld/pytorch_1556653099582/work/aten/src/THC/THCTensorRandom.cu:33
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Creating MTGP constants failed. at /pytorch/aten/src/THC/ ...
Hi fairseq team, i'm using fairseq to create translation model and i want to custom ... RuntimeError: Creating MTGP constants failed. at ...
Read more >[solved] Creating MTGP constants failed error - nlp
I am getting the following error when I tried to work with Dataset and DataLoader. ... RuntimeError: Creating MTGP constants failed. at ...
Read more >[Pytorch --- 6] Roberta分类任务,出现RuntimeError: ...
Hello Word! “RuntimeError: Cannot insert a Tensor that requires grad as a constant. Consider making it a parameter or input, or detaching the...
Read more >关于最近实践Bert 的一些坑
RuntimeError : Creating MTGP constants failed. 1. 在 pytorch-pretrained-BERT 项目下的Bert 实现中, 文本长度最多支持 512 , 这是 ...
Read more >关于最近实践Bert 的一些坑
RuntimeError : Creating MTGP constants failed. pytorch-pretrained-BERT. 512. Position Embedding. 截断. 分批读取. 不要一开始就跑整个数据集.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
好的,我来看看
config里面改成跟guwen里面一样的数量之后目前可以正常训练了