allenai / allenai/kb

Error when trying to run the 'train code'

Open
#48 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
373
Forks
50
PR merge metrics
No merged PRs in 30d

Description

I, am trying to run the code of a paper termed [KnowledgeMiningWithSceneText](https://github.com/MCLAB-OCR/KnowledgeMiningWithSceneText) made by [Leojc](https://github.com/Leojc) that uses the [KnowBert](https://github.com/allenai/kb), faced an error while executing the training command.

The error I got as follows:

```
(vit_kb) tih_isi_1@tih:~/Archisman/Fine-Grained Recognition/KnowledgeMiningWithSceneText$ python main.py -c configs/train_knowbert_attention_activity.toml
[2024-01-08 16:35:30,109][RANK=00][I]: unknown_args=[] [main.py:114]
Traceback (most recent call last):
File "main.py", line 121, in
main()
File "main.py", line 116, in main
import train_knowbert
File "/home/tih_isi_1/Archisman/Fine-Grained Recognition/KnowledgeMiningWithSceneText/train_knowbert.py", line 17, in
from model.vit_knowbert_interaction_timm import Net as NetWithAttention
File "/home/tih_isi_1/Archisman/Fine-Grained Recognition/KnowledgeMiningWithSceneText/model/vit_knowbert_interaction_timm.py", line 14, in
from kb.include_all import ModelArchiveFromParams
File "/home/tih_isi_1/Archisman/Fine-Grained Recognition/KnowledgeMiningWithSceneText/kb/kb/include_all.py", line 3, in
from kb.entity_linking import TokenCharactersIndexerTokenizer
File "/home/tih_isi_1/Archisman/Fine-Grained Recognition/KnowledgeMiningWithSceneText/kb/kb/entity_linking.py", line 72, in
from allennlp.data.dataset import Batch
ModuleNotFoundError: No module named 'allennlp.data.dataset'
```
I solved this by relaced `from allennlp.data.dataset import Batch` by `from allennlp.data import Batch`.

Then I faced:
```
(vit_kb) tih_isi_1@tih:~/Archisman/Fine-Grained Recognition/KnowledgeMiningWithSceneText$ python main.py -c configs/train_knowbert_attention_activity.toml
[2024-01-09 12:14:17,782][RANK=00][I]: unknown_args=[] [main.py:114]
Traceback (most recent call last):
File "main.py", line 121, in
main()
File "main.py", line 116, in main
import train_knowbert
File "/home/tih_isi_1/Archisman/Fine-Grained Recognition/KnowledgeMiningWithSceneText/train_knowbert.py", line 17, in
from model.vit_knowbert_interaction_timm import Net as NetWithAttention
File "/home/tih_isi_1/Archisman/Fine-Grained Recognition/KnowledgeMiningWithSceneText/model/vit_knowbert_interaction_timm.py", line 14, in
from kb.include_all import ModelArchiveFromParams
File "/home/tih_isi_1/Archisman/Fine-Grained Recognition/KnowledgeMiningWithSceneText/kb/kb/include_all.py", line 3, in
from kb.entity_linking import TokenCharactersIndexerTokenizer
File "/home/tih_isi_1/Archisman/Fine-Grained Recognition/KnowledgeMiningWithSceneText/kb/kb/entity_linking.py", line 82, in
from allennlp.data.iterators import DataIterator
ModuleNotFoundError: No module named 'allennlp.data.iterators'
```

But the current issue is that 'Iterators' has been discontinued since the last version. Do you know how I can solve this error?

I appreciate any help you can provide.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.