Closed Haneen177 closed 1 year ago
FYI
On 21 Feb 2023, at 10:31 AM, Haneen @.***> wrote:
Hello,
I am encountering an error when trying to run the inference to perform tagging.
Command !python /content/ArabicNER-Wojood/arabiner/bin/infer.py \ --model_path /content/ArabicNER-Wojood \ --text "وثائق نفوس شخصية من الفترة العثمانية للسيد نعمان عقل"
Code Colab https://colab.research.google.com/drive/1x4R-ZpAYb4Bs1tKO95E31-mCTMPVrxDn?usp=sharing Error message: Traceback (most recent call last): File "/content/ArabicNER-Wojood/arabiner/bin/infer.py", line 73, in
main(parseargs()) File "/content/ArabicNER-Wojood/arabiner/bin/infer.py", line 61, in main segments = tagger.infer(dataloader) File "/content/ArabicNER-Wojood/arabiner/trainers/BertNestedTrainer.py", line 167, in infer for , gold_tags, tokens, valid_len, logits in self.tag( File "/content/ArabicNER-Wojood/arabiner/trainers/BertNestedTrainer.py", line 125, in tag for subwords, gold_tags, tokens, mask, valid_len in dataloader: File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py", line 628, in next data = self._next_data() File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py", line 671, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py", line 58, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py", line 58, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/content/ArabicNER-Wojood/arabiner/data/datasets.py", line 121, in getitem subwords, tags, tokens, masks, valid_len = self.transform(self.examples[item]) File "/content/ArabicNER-Wojood/arabiner/data/transforms.py", line 84, in call vocab_tags = "|".join([t for t in vocab.get_itos() if "-" in t]) File "/usr/local/lib/python3.10/dist-packages/torchtext/vocab/vocab.py", line 158, in get_itos return self.vocab.get_itos() File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1265, in getattr raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'Vocab' object has no attribute 'vocab' I'm using the provided versions:
Python 3.10.10 torch==1.13.0 torchtext==0.14.0 torchtext==0.14.0 transformers==4.24.0
can you help me to resolve this issue...
Thanks & Regards, Haneen Abdulrhman
— Reply to this email directly, view it on GitHub https://github.com/SinaLab/ArabicNER/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFK4TYKQ2YBETNMDG54VSCTWYR4PPANCNFSM6AAAAAAVCXMH6I. You are receiving this because you are subscribed to this thread.
Thank you for reporting this issue. The cause of this problem is mismatch in the torchtext version. The latest code was upgraded to use torchtext 0.14.0, but the pre-trained model uses an older torchtext version. We will update the pre-trained model.
Thank you for reporting this issue. The cause of this problem is mismatch in the torchtext version. The latest code was upgraded to use torchtext 0.14.0, but the pre-trained model uses an older torchtext version. We will update the pre-trained model.
Thanks, looking forward to your update!
I pushed an updated model to huggingface. Can you please try running your notebook again? Let me know if that resolves your problem so that I can mark this issue complete.
I pushed an updated model to huggingface. Can you please try running your notebook again? Let me know if that resolves your problem so that I can mark this issue complete.
Already tried and it works! thank you.
That is great 👍
Hello,
I am encountering an error when trying to run the inference to perform tagging.
Command
!python /content/ArabicNER-Wojood/arabiner/bin/infer.py \ --model_path /content/ArabicNER-Wojood \ --text "وثائق نفوس شخصية من الفترة العثمانية للسيد نعمان عقل"
Code Colab
Error message:
Traceback (most recent call last): File "/content/ArabicNER-Wojood/arabiner/bin/infer.py", line 73, in <module> main(parse_args()) File "/content/ArabicNER-Wojood/arabiner/bin/infer.py", line 61, in main segments = tagger.infer(dataloader) File "/content/ArabicNER-Wojood/arabiner/trainers/BertNestedTrainer.py", line 167, in infer for _, gold_tags, tokens, valid_len, logits in self.tag( File "/content/ArabicNER-Wojood/arabiner/trainers/BertNestedTrainer.py", line 125, in tag for subwords, gold_tags, tokens, mask, valid_len in dataloader: File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py", line 628, in __next__ data = self._next_data() File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py", line 671, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py", line 58, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py", line 58, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/content/ArabicNER-Wojood/arabiner/data/datasets.py", line 121, in __getitem__ subwords, tags, tokens, masks, valid_len = self.transform(self.examples[item]) File "/content/ArabicNER-Wojood/arabiner/data/transforms.py", line 84, in __call__ vocab_tags = "|".join([t for t in vocab.get_itos() if "-" in t]) File "/usr/local/lib/python3.10/dist-packages/torchtext/vocab/vocab.py", line 158, in get_itos return self.vocab.get_itos() File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'Vocab' object has no attribute 'vocab'
I'm using the provided versions:
Python 3.10.10 torch==1.13.0 torchtext==0.14.0 torchtext==0.14.0 transformers==4.24.0
can you help me to resolve this issue...
Thanks & Regards, Haneen Abdulrhman