前提・実現したいこと
MacBook Pro(M1)にて、inaSpeechSegmenterを動かそうとしたところ、
tensorflowの部分でエラーが起きました。
tensorflowは
https://zenn.dev/karaage0703/articles/0ab9e654cfb0ec
を参考に、alpha3をインストールしています。
解決方法がわかる方いらっしゃいましたらよろしくお願いいたします。
発生している問題・エラーメッセージ
Traceback (most recent call last): File "/Users/.../xxx.py", line 9, in <module> from inaSpeechSegmenter import Segmenter File "/Users/.../lib/python3.8/site-packages/inaSpeechSegmenter/__init__.py", line 26, in <module> from .segmenter import Segmenter, seg2csv File "/Users/.../lib/python3.8/site-packages/inaSpeechSegmenter/segmenter.py", line 31, in <module> import keras File "/Users/.../lib/python3.8/site-packages/keras/__init__.py", line 25, in <module> from keras import models File "/Users/.../lib/python3.8/site-packages/keras/models.py", line 19, in <module> from keras import backend File "/Users/.../lib/python3.8/site-packages/keras/backend.py", line 36, in <module> from tensorflow.python.eager.context import get_config ImportError: cannot import name 'get_config' from 'tensorflow.python.eager.context' (/Users/.../lib/python3.8/site-packages/tensorflow/python/eager/context.py)
該当のソースコード
Python
1from inaSpeechSegmenter import Segmenter
補足情報(FW/ツールのバージョンなど)
macOS 11.5.2
inaSpeechSegmenter==0.6.7
tensorflow==2.4.0rc0
tensorflow-addons==0.11.2
tensorflow-estimator==2.7.0
keras==2.6.0
keras-preprocessing==1.1.2
> cannot import name 'get_config' from 'tensorflow.python.eager.context'
https://stackoverflow.com/questions/66964492/importerror-cannot-import-name-get-config-from-tensorflow-python-eager-conte
を見たら、「keras」ではなく「tensorflow.keras」を使えばいいみたいです
> File "/Users/.../lib/python3.8/site-packages/inaSpeechSegmenter/segmenter.py", line 31, in <module>
import keras
https://github.com/ina-foss/inaSpeechSegmenter/blob/master/inaSpeechSegmenter/segmenter.py
を見たら、「import keras」ではなく「from tensorflow import keras」になってるので、
> inaSpeechSegmenter==0.6.7
を、最新版
https://pypi.org/project/inaSpeechSegmenter/
を入れるか、
https://github.com/ina-foss/inaSpeechSegmenter/
から落として入れるかしたら、直るかも
アドバイスありがとうございます!
最新バージョンのインストールを試みましたが、
```
ERROR: Could not find a version that satisfies the requirement tensorflow (from inaspeechsegmenter) (from versions: none)
ERROR: No matching distribution found for tensorflow
```
と言われてしまいました。。
これは、次のバージョンに期待して今はimport kerasの部分を書き換えるしかなさそうですね、、
> Could not find a version that satisfies the requirement tensorflow (from inaspeechsegmenter)
おそらく、m1ネイティブに対応してるtensorflowのバージョンが限られていて、inaSpeechSegmenterの最新版に必要なバージョンのtensorflowがまだ用意されてないのですね
> 今はimport kerasの部分を書き換える
こちらを参考に
https://dev.infohub.cc/use-tensorflow-keras/
ご丁寧にリンクも載せてくださりありがとうございます!!
助かりました!
回答1件
あなたの回答
tips
プレビュー