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

用bert预训练模型时报错 IndexError: index out of range in self #14

Open
Elveshh opened this issue Feb 4, 2021 · 0 comments
Open

Comments

@Elveshh
Copy link

Elveshh commented Feb 4, 2021

Epoch: 0% 0/30 [00:00<?, ?it/s]Traceback (most recent call last):
File "run.py", line 191, in
main()
File "run.py", line 182, in main
_, _, all_eval_results = train(args, train_dataset, model, test_dataset)
File "/content/drive/My Drive/Colab Notebooks/yht/RGAT-ABSA-master/trainer.py", line 147, in train
logit = model(**inputs)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/content/drive/My Drive/Colab Notebooks/yht/RGAT-ABSA-master/model.py", line 291, in forward
outputs = self.bert(input_cat_ids, token_type_ids = segment_ids)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/transformers/models/bert/modeling_bert.py", line 956, in forward
past_key_values_length=past_key_values_length,
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/transformers/models/bert/modeling_bert.py", line 200, in forward
inputs_embeds = self.word_embeddings(input_ids)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/sparse.py", line 126, in forward
self.norm_type, self.scale_grad_by_freq, self.sparse)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py", line 1852, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
IndexError: index out of range in self
Epoch: 0% 0/30 [00:00<?, ?it/s]

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