前提
Google Colabでライブラリtransformersを用いて、bertによる感情分析を行おうとしています
参考として以下の記事のコードを実行しようとしています
https://qiita.com/izaki_shin/items/2b4573ee7fbea5ec8ed6
実現したいこと
- 感情分析を行いたい
発生している問題・エラーメッセージ
トークナイザーの読み込みがうまくいかない
実際のところ、二週間ほど前には問題なく動いたのでGoogle Colabの使い方の問題ではないかと思います。しかし、何かを変更した覚えがないので、なぜ動かなくなったのか分かりません。仮想マシンをリセット(ランタイムを接続解除して削除)しても動かないのはなぜなのでしょう?
Downloading: 100% 110/110 [00:00<00:00, 1.06kB/s] Downloading: 100% 479/479 [00:00<00:00, 4.55kB/s] --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/transformers/utils/import_utils.py in _get_module(self, module_name) 1075 try: -> 1076 return importlib.import_module("." + module_name, self.__name__) 1077 except Exception as e: 12 frames ModuleNotFoundError: No module named 'sentencepiece' The above exception was the direct cause of the following exception: RuntimeError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/transformers/utils/import_utils.py in _get_module(self, module_name) 1079 f"Failed to import {self.__name__}.{module_name} because of the following error (look up to see its" 1080 f" traceback):\n{e}" -> 1081 ) from e 1082 1083 def __reduce__(self): RuntimeError: Failed to import transformers.models.bert_japanese.tokenization_bert_japanese because of the following error (look up to see its traceback): No module named 'sentencepiece'
該当のソースコード
Python
1# 使用するモデルを指定して、Tokenizerを読み込む 2checkpoint = 'cl-tohoku/bert-base-japanese-whole-word-masking' 3tokenizer = AutoTokenizer.from_pretrained(checkpoint)
試したこと
兎に角解決の糸口が見えなく、意味のなさそうなことも試しています
ランタイムを再起動
ランタイムを接続解除して削除
ブラウザを変える
OSを変える
アカウントを変える
回答1件
あなたの回答
tips
プレビュー