LittleGuoKe / ConceptFERE

This code is the source code of our paper "Entity Concept-enhanced Few-shot Relation Extraction" in the ACL2021
MIT License
32 stars 9 forks source link

Hi, can you show us the structure of your code? I was wondering where to put the download code. #5

Closed Drizze999 closed 2 years ago

LittleGuoKe commented 2 years ago

Maybe you mean to put your own training data set in my code. You can follow the directory structure of data

Drizze999 commented 2 years ago

There is an error that I could not solve. It seems that this train.json can not be generated. Could you help me?

----------------------BERTPAIRConceptSentenceEncoder initializing---------------------------------- loading Instance2concept file: 100%|██████████████| 1/1 [00:30<00:00, 30.56s/it] loading entity2id in conceptgraph: 100%|██████████| 1/1 [00:09<00:00, 9.81s/it] file path ./data/train.json [ERROR] Data file does not exist! Traceback (most recent call last): File "train_demo.py", line 366, in main() File "train_demo.py", line 234, in main id_from=opt.id_from) File "/home/nlp/ConceptFERE/fewshot_re_kit/data_kg_loader.py", line 342, in get_concept_loader_pair word2id, id_from) File "/home/nlp/ConceptFERE/fewshot_re_kit/data_kg_loader.py", line 29, in init assert (0) AssertionError

LittleGuoKe commented 2 years ago

You should check whether your train.json path is correct.

Drizze999 commented 2 years ago

hi.I used the order you provided in README and did not change any parameter in the code.

python train_demo.py --trainN 5 --N 5 --K 1 --Q 1 --model pair --encoder bert --pair --hidden_size 768 --val_step 1000 --save_ckpt checkpoint/5way1shot.ConceptFere.pth.tar --batch_size 1 --grad_iter 4 --optim adam --fp16 --id_from MultiHeadAttentionAndBeyondWordEmbedding > 5way1shot.ConceptFere.log 2>&1

But the result is 80.48 while it should be 89.21 in the paper. I am confused about this difference. Can you give me some help?

LittleGuoKe commented 2 years ago

1.Due to the randomness of the experiments of the FSRE task, the results in the paper are the average of the results of multiple experiments. It is recommended that you conduct multiple experiments. 2.Check if this protocol is followed: We divide the original training dataset into a new training dataset and a new validation dataset, the corresponding code is in the re_split_dataset module in fewshot_re_kit/utils.py, and the validation set in the original dataset is used as the new test dataset