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

求助 #6

Open
Mr1meng opened this issue Nov 25, 2023 · 2 comments
Open

求助 #6

Mr1meng opened this issue Nov 25, 2023 · 2 comments

Comments

@Mr1meng
Copy link

Mr1meng commented Nov 25, 2023

Traceback (most recent call last):
File "D:\BERT-Relation-Extraction-main\re_main.py", line 189, in
main(data_name)
File "D:\BERT-Relation-Extraction-main\re_main.py", line 181, in main
train.train()
File "D:\BERT-Relation-Extraction-main\re_main.py", line 53, in train
output = self.model(input_ids, attention_mask, token_type_ids, labels)
File "C:\Users\mqx.conda\envs\bert2\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "D:\BERT-Relation-Extraction-main\model.py", line 55, in forward
bert_output = self.bert(input_ids=input_ids)
File "C:\Users\mqx.conda\envs\bert2\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\mqx.conda\envs\bert2\lib\site-packages\transformers\models\bert\modeling_bert.py", line 974, in forward
batch_size, seq_length = input_shape
ValueError: not enough values to unpack (expected 2, got 1)
大佬,请问在训练关系抽取模型时会报这个错是什么原因呢

@taishan1994
Copy link
Owner

batch_size, seq_length = input_shape
input_shape期望有两个维度,但是只有一个维度。

@Banshan6
Copy link

同求,请问大佬们这个咋改?

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

3 participants