From 485da7222f7f9ca9854db1a6df027b00d348d017 Mon Sep 17 00:00:00 2001 From: Yohei Tamura Date: Wed, 2 Sep 2020 20:36:32 +0900 Subject: [PATCH] fix error class instantiation (#6634) --- src/transformers/tokenization_bert_japanese.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/transformers/tokenization_bert_japanese.py b/src/transformers/tokenization_bert_japanese.py index c75320aa3b..563318b822 100644 --- a/src/transformers/tokenization_bert_japanese.py +++ b/src/transformers/tokenization_bert_japanese.py @@ -199,7 +199,7 @@ class MecabTokenizer: try: import fugashi except ModuleNotFoundError as error: - raise error( + raise error.__class__( "You need to install fugashi to use MecabTokenizer." "See https://pypi.org/project/fugashi/ for installation." ) @@ -211,7 +211,7 @@ class MecabTokenizer: try: import ipadic except ModuleNotFoundError as error: - raise error( + raise error.__class__( "The ipadic dictionary is not installed. " "See https://github.com/polm/ipadic-py for installation." ) @@ -222,7 +222,7 @@ class MecabTokenizer: try: import unidic_lite except ModuleNotFoundError as error: - raise error( + raise error.__class__( "The unidic_lite dictionary is not installed. " "See https://github.com/polm/unidic-lite for installation." ) @@ -233,7 +233,7 @@ class MecabTokenizer: try: import unidic except ModuleNotFoundError as error: - raise error( + raise error.__class__( "The unidic dictionary is not installed. " "See https://github.com/polm/unidic-py for installation." )