Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'JanomeSubwordsTokenizer' object has no attribute 'vocab' #335

Open
yosato opened this issue Jan 20, 2024 · 3 comments · May be fixed by #336
Open

AttributeError: 'JanomeSubwordsTokenizer' object has no attribute 'vocab' #335

yosato opened this issue Jan 20, 2024 · 3 comments · May be fixed by #336

Comments

@yosato
Copy link

yosato commented Jan 20, 2024

Getting the following error as I follow the readme. I hope what I do in what environment is already clear... Let me know if you need more info

Python 3.11.6 (main, Nov 2 2023, 04:39:40) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

from bunkai import Bunkai
from pathlib import Path
bunkai=Bunkai(path_model=Path('bunkai-model-directory'))
Traceback (most recent call last):
File "", line 1, in
File "/opt/homebrew/lib/python3.11/site-packages/bunkai/algorithm/bunkai_sbd/bunkai_sbd.py", line 78, in init
_annotators.insert(_idxs[0] + 1, LinebreakAnnotator(path_model=path_model))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/bunkai/algorithm/bunkai_sbd/annotator/linebreak_annotator.py", line 16, in init
self.linebreak_detector = Predictor(modelpath=path_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/bunkai/algorithm/lbd/predict.py", line 43, in init
self.tokenizer = JanomeSubwordsTokenizer(self.path_tokenizer_model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/bunkai/algorithm/lbd/custom_tokenizers.py", line 136, in init
super(BertTokenizer, self).init(
File "/opt/homebrew/lib/python3.11/site-packages/transformers/tokenization_utils.py", line 367, in init
self._add_tokens(
File "/opt/homebrew/lib/python3.11/site-packages/transformers/tokenization_utils.py", line 467, in _add_tokens
current_vocab = self.get_vocab().copy()
^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/transformers/models/bert/tokenization_bert.py", line 240, in get_vocab
return dict(self.vocab, **self.added_tokens_encoder)
^^^^^^^^^^
AttributeError: 'JanomeSubwordsTokenizer' object has no attribute 'vocab'

@yosato
Copy link
Author

yosato commented Jan 20, 2024

ah, just fyi i did 'install' your model by this command as in the readme again
bunkai --model bunkai-model-directory --setup

@kaisugi
Copy link

kaisugi commented Feb 14, 2024

I'm also facing this issue...

@KHrepo
Copy link

KHrepo commented Feb 27, 2024

pip install transformers==4.33.3 will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants