Error when initializing from the transformers pipeline
See original GitHub issueHello,
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:
- Created 3 years ago
- Comments:7
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.Yes! I followed your suggestion, but I still get the same error.