TimDettmers / ConvE

Convolutional 2D Knowledge Graph Embeddings resources
MIT License
674 stars 163 forks source link

Spodernet `TypeError: 'NoneType' object is not callable` issue #23

Closed TimDettmers closed 6 years ago

TimDettmers commented 6 years ago

I got an email with the following commands / errors.

1) 
 python main.py model ConvE dataset FB15k-237 process True
Traceback (most recent call last):
  File "main.py", line 181, in <module>
    main()
  File "main.py", line 153, in main
    for i, str2var in enumerate(train_batcher):
  File "/home/jisuk1/virtual_env_dir/torch/src/spodernet/spodernet/preprocessing/batching.py", line 369, in __next__
    self.publish_end_of_iter_event()
  File "/home/jisuk1/virtual_env_dir/torch/src/spodernet/spodernet/preprocessing/batching.py", line 302, in publish_end_of_iter_event
    obs.at_end_of_iter_event(self.state)
  File "/home/jisuk1/virtual_env_dir/torch/src/spodernet/spodernet/hooks.py", line 55, in at_end_of_iter_event
    metric = self.calculate_metric(state)
  File "/home/jisuk1/virtual_env_dir/torch/src/spodernet/spodernet/hooks.py", line 169, in calculate_metric
    return state.loss.item()
AttributeError: 'torch.FloatTensor' object has no attribute 'item'
Exception ignored in: <bound method Event.__del__ of <torch.cuda.Event 0x49e0c720>>
Traceback (most recent call last):
  File "/share/apps/lib/python3.5/site-packages/torch/cuda/streams.py", line 164, in __del__
TypeError: 'NoneType' object is not callable

2) 
python main.py model ConvE dataset WN18RR process True
Traceback (most recent call last):
  File "main.py", line 181, in <module>
    main()
  File "main.py", line 153, in main
    for i, str2var in enumerate(train_batcher):
  File "/home/jisuk1/virtual_env_dir/torch/src/spodernet/spodernet/preprocessing/batching.py", line 369, in __next__
    self.publish_end_of_iter_event()
  File "/home/jisuk1/virtual_env_dir/torch/src/spodernet/spodernet/preprocessing/batching.py", line 302, in publish_end_of_iter_event
    obs.at_end_of_iter_event(self.state)
  File "/home/jisuk1/virtual_env_dir/torch/src/spodernet/spodernet/hooks.py", line 55, in at_end_of_iter_event
    metric = self.calculate_metric(state)
  File "/home/jisuk1/virtual_env_dir/torch/src/spodernet/spodernet/hooks.py", line 169, in calculate_metric
    return state.loss.item()
TimDettmers commented 6 years ago

Here my reply to the issue:

The problem is your PyTorch version. ConvE now supports the latest version PyTorch v0.4. If you want to use PyTorch version v0.3 you can use the commit 5f9f39fdaab153b63cf299f6c5d93da9e13be684 for ConvE and the commit 5f9112810653b85ad27545681123e2deec258652 for spodernet. With these changes, everything should work. Another solution would be to upgrade your PyTorch version.