uma-pi1 / kge

LibKGE - A knowledge graph embedding library for reproducible research
MIT License
765 stars 124 forks source link

Dataset with name . could not be found. #234

Open fratajcz opened 2 years ago

fratajcz commented 2 years ago

Hi!

I have just tried to load a checkpoint I have trained months ago and was puzzled by an error. According to the config that i get by kge dump checkpoint checkpoint_best.pt, the dataset name is "." and hence it tries to load the data from /home/user/kge/data/..

My question is, am I missing something here? It would be okay to load from /home/user/kge/data/dataset_name/, but what does the "." stand for? Is it safe to "inject" the correct dataset name by modifyng config.dataset.name?

I know I have loaded that checkpoint several times a few months ago without any problems. I have, however, switched machines and maybe not copied everything exactly.

Thanks a lot for any hint!

Traceback (most recent call last):
  File "evaluate_test.py", line 143, in <module>
    model = KgeModel.create_from(checkpoint)
  File "/home/user/kge/kge/model/kge_model.py", line 581, in create_from
    dataset = Dataset.create_from(checkpoint, config, dataset, preload_data=False)
  File "/home/user/kge/kge/dataset.py", line 147, in create_from
    dataset = Dataset.create(config, preload_data)
  File "/home/user/kge/kge/dataset.py", line 110, in create
    raise ValueError(f"Dataset with name {name} could not be found.")
ValueError: Dataset with name . could not be found.
fratajcz commented 2 years ago

So I work around this now by replacing

checkpoint = load_checkpoint(path)
model = KgeModel.create_from(checkpoint)

with

checkpoint = load_checkpoint(path)
checkpoint["config"].set("dataset.name","dataset_name" )
model = KgeModel.create_from(checkpoint)

where dataset_nameis the name of the actual dataset in kge/data/

rgemulla commented 2 years ago

Not sure what happened here; I've never seen this. You can write back the checkpoint after you updated the dataset name as in your code above.