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

tokenize_document() doesn't work if the model does not support fast tokenizer #29

Open
Bhuvanesh-Verma opened this issue Jan 9, 2024 · 0 comments · May be fixed by #34
Open

tokenize_document() doesn't work if the model does not support fast tokenizer #29

Bhuvanesh-Verma opened this issue Jan 9, 2024 · 0 comments · May be fixed by #34
Labels
bug Something isn't working

Comments

@Bhuvanesh-Verma
Copy link

Bhuvanesh-Verma commented Jan 9, 2024

Model: cl-tohoku/bert-base-japanese
Package Requirements: ipadic, fugashi (pip install ipadic fugashi)

Code to replicate the issue:

from pie_modules.document.processing import tokenize_document
from transformers import AutoTokenizer
from pytorch_ie.documents import TokenBasedDocument, TextBasedDocument

tokenizer = AutoTokenizer.from_pretrained("cl-tohoku/bert-base-japanese")
text_document = TextBasedDocument(text="東北大学で")

tokenized_docs = tokenize_document(
        text_document,
        tokenizer=tokenizer,
        result_document_type= TokenBasedDocument
    )

Error Message:

Traceback (most recent call last):
  ....
    tokenized_docs = tokenize_document(
  File "..../python3.9/site-packages/pie_modules/document/processing/tokenization.py", line 314, in tokenize_document
    for batch_encoding in tokenized_text.encodings:
TypeError: 'NoneType' object is not iterable

Update: Current fix using huggingface/transformers#12381

@ArneBinder ArneBinder added the bug Something isn't working label Jan 9, 2024
@ArneBinder ArneBinder linked a pull request Jan 11, 2024 that will close this issue
2 tasks
@ArneBinder ArneBinder changed the title tokenize_document() doesn't work if the model do not support fast tokenizer tokenize_document() doesn't work if the model does not support fast tokenizer Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants