question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when initializing from the transformers pipeline

See original GitHub issue

Hello,

I get an error when trying to initialize models that rely on your tokenizer from the transformers package’s pipeline. Here is code that yields the error as well as the traceback.

from transformers import pipeline 

sentiment_analyzer = pipeline(
    "sentiment-analysis", model="cl-tohoku/bert-base-japanese", tokenizer="cl-tohoku/bert-base-japanese")
Traceback (most recent call last):
  File "<input>", line 3, in <module>
  File "C:\Users\gagno\Anaconda3\envs\japanese_admin_scrape\lib\site-packages\transformers\pipelines\__init__.py", line 377, in pipeline
    tokenizer = AutoTokenizer.from_pretrained(tokenizer, revision=revision, use_fast=use_fast)
  File "C:\Users\gagno\Anaconda3\envs\japanese_admin_scrape\lib\site-packages\transformers\models\auto\tokenization_auto.py", line 391, in from_pretrained
    tokenizer_class = tokenizer_class_from_name(tokenizer_class_candidate)
  File "C:\Users\gagno\Anaconda3\envs\japanese_admin_scrape\lib\site-packages\transformers\models\auto\tokenization_auto.py", line 294, in tokenizer_class_from_name
    if c.__name__ == class_name:
AttributeError: 'NoneType' object has no attribute '__name__'

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
EtienneGagnon1commented, Mar 23, 2021

Hello, thank you for your help! The tokenizer package was up to date (0.10.1). the the use_fast=False argument solved the issue.

1reaction
prtskcommented, Mar 18, 2021

Yes! I followed your suggestion, but I still get the same error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RuntimeError: Failed to import transformers.pipelines because ...
RuntimeError: Failed to import transformers.pipelines because of the following error (look up to see its traceback): initialization failed.
Read more >
What to do when you get an error - Hugging Face Course
Debugging the pipeline from Transformers · The error messages in Python are known as tracebacks and are read from bottom to top. ·...
Read more >
[FIXED] RuntimeError: Failed to import transformers.pipelines ...
from transformers import pipeline, set_seed generator ... of the following error (look up to see its traceback): initialization failed
Read more >
Training Pipelines & Models · spaCy Usage Documentation
initialize is called (typically right before training). This allows you to set up your pipeline using local data resources and custom functions, and...
Read more >
A Deep Dive into Custom Spark Transformers for ML Pipelines
Modern Spark Pipelines are a powerful way to create machine learning pipelines; Spark Pipelines use off-the-shelf data transformers to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found