torchkge-team / torchkge

TorchKGE: Knowledge Graph embedding in Python and PyTorch.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shortest Training from docs doesn't work

ozogxyz opened this issue · comments

  • TorchKGE version: 0.17.7
  • Python version: 3.10.11, 3.10.13
  • Operating System: 4.15.0-209-generic x86_64 x86_64 GNU/Linux, MacOS Ventura 13.1.1

Description

TrainDataLoader seems to fail to return an iterator hence its def get_counter_examples(self) -> SmallKG method fails with an error message hinting that self.iterator is None.

So trainer.run() fails in the Shortest Training from the docs.

Error message:

File "/project-root/test.py", line 38, in main trainer.run()

File "/project-root/.venv/lib/python3.10/site-packages/torchkge/utils/training.py", line 179, in run

self.counter_examples = data_loader.get_counter_examples()

File "/project-root/.venv/lib/python3.10/site-packages/torchkge/utils/training.py", line 64, in get_counter_examples

return SmallKG(self.iterator.nh, self.iterator.nt, self.iterator.r)

AttributeError: 'NoneType' object has no attribute 'nh'

What I Did

****
1. copy Shortest Training from the docs
2. run it on Ubuntu and MacOS
****

Thanks @shreyash-Pandey-Katni for fixing this.

You're welcome, @armand33 ! I'm glad I could help resolve the issue. If you ever need assistance with anything else in the future, feel free to reach out. I'm always open to collaborating and working together on projects. Let me know if there's anything I can do to support you.