DeepGraphLearning / RNNLogic

120 stars 25 forks source link

the 'entities.dict' 'relations.dict' file format problem: #4

Closed quqxui closed 3 years ago

quqxui commented 3 years ago

Hi, i want to use the code in my own dataset, but the 'entities.dict' 'relations.dict' file format seems not quite right. Can you explain on the file format required in the cpp file 'rnnlogic.cpp' ?

This is the wrong I got:

#Entities: 8          
#Relations: 2          
#Train triplets: 0          
#Valid triplets: 0          
#Test triplets: 0          
#All triplets: 0          
Rule Discovery | DONE!                              
Traceback (most recent call last):
  File "run.py", line 59, in <module>
    main(parse_args())
  File "run.py", line 53, in main
    rnnlogic.m_step(miner.get_logic_rules())
  File "/data/xdr/code/RNNLogic-main/model.py", line 304, in m_step
    dataloader = DataLoader(dataset, batch_size=self.args.generator_batch_size, shuffle=True, num_workers=1, collate_fn=RuleDataset.collate_fn)
  File "/data/xdr/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 270, in __init__
    sampler = RandomSampler(dataset, generator=generator)  # type: ignore[arg-type]
  File "/data/xdr/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/sampler.py", line 103, in __init__
    "value, but got num_samples={}".format(self.num_samples))
ValueError: num_samples should be a positive integer value, but got num_samples=0
quqxui commented 3 years ago

lt's really the problem of entity name with space. i got it.

mnqu commented 3 years ago

Thanks for your interest! We follow the format which is commonly used in existing knowledge graph reasoning datasets. To be specific, the entity/relation file has multiple lines, and each line corresponds to an entity/relation. The format of each line is: <entity/relation id><\tab><entity/relation name without space inside> The data folder gives a few examples : )

Thanks, Meng