INK-USC / MHGRN

Scalable Multi-Hop Relational Reasoning for Knowledge-Aware Question Answering (EMNLP 2020)
246 stars 46 forks source link

The concept2id index in GconAttn are shifted by one #5

Closed ThinkingSlow closed 4 years ago

ThinkingSlow commented 4 years ago

Hey, thanks for providing the code. I am running one of the baseline model GconAttn. I am really confused about the concept2id part code. For line 155 and line 156 in modelling_gconattn.py, the id of each concept are added by 1. The comment notes leave index 0 for padding. What I am confusing is that after adding 1, the index of a concept will be changed, and the corresponding embedding retrieved from the embedding matrix will no longer be correct. Did I miss something or my understanding is correct? Thank you so much for your kind help.

for data in tqdm(concept_data, total=n, desc='loading concepts'):  
            # leave index 0 for padding. 
            cur_qc = [self.concept2id[x] + 1 for x in data['qc']][:self.max_cpt_num]. 
            cur_ac = [self.concept2id[x] + 1 for x in data['ac']][:self.max_cpt_num]. 
            qc.append(cur_qc + [0] * (self.max_cpt_num - len(cur_qc))). 
            ac.append(cur_ac + [0] * (self.max_cpt_num - len(cur_ac)))
Kiwisher commented 4 years ago

Hi, thanks a lot for pointing it out!

We have fixed the bug and the experimental results involved will be updated soon.