djz233 / D-DGCN

source code of Orders Are Unwanted: Dynamic Deep Graph Convolutional Network for Personality Detection (AAAI2023)
24 stars 3 forks source link

when set --option == 'test' error raised #5

Closed WayneLin552 closed 1 year ago

WayneLin552 commented 1 year ago

Hi, when I try to run --option 'test', and put data, bert-pretrained.pth, best_f1_net.pth into correct folder, it still raised the erro:

RuntimeError: Error(s) in loading state_dict for UPF_dgcn: Missing key(s) in state_dict: "pretrain_models.embeddings.position_ids".

Looks like the best_f1_net.pth or bert-pretrained.pth you provide has some missing dict, can you help me fix that? Thank you so much.

The whole error message is this:

Traceback (most recent call last): File "C:\Users*\OneDrive\desktop\papers\upf_data_and_model\D-DGCN\scr\main.py", line 203, in model.load_state_dict(new_state_dict) File "C:\Users\\anaconda3\lib\site-packages\torch\nn\modules\module.py", line 1671, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for UPF_dgcn: Missing key(s) in state_dict: "pretrain_models.embeddings.position_ids".

djz233 commented 1 year ago

Hello there, we speculate that the higher version of "transformers" package causes the error. Since we use transformers==2.9.0 in the code, a version in long long ago and many implementations have been changed. XD Maybe you can downgrade the transformers to 2.9.0 and try again.