JiehangXie/PaddleBoBo

运行PaddleBoBo报错MODEL_HOME的解决办法

Kedreamix opened this issue · 6 comments

如果大家在运行中发现了问题,那一般是库的版本问题,我自己看了看paddlespeech的库,我终于发现了他的改动,在之前的时候,<=1.0的时候,这个都是正确的。但是如果paddlespeech默认下载了1.1或者1.2的版本,在PaddleTools中的TTS.py的11行的MODEL_HOME中,MODEL_HOME就会出现问题,这是因为换位置了,所以我们需要将其换为,

from paddlespeech.utils.env import MODEL_HOME

亲测有效,或者安装paddlespeech为<=1.0的版本也可以,就直接不用改代码了

亲测有效,或把 PaddleTools/TTS.py 中MODEL_HOME 替换成 CONF_HOME

from paddlespeech.utils.env import MODEL_HOME

修改有效

修改之后 出现了这样的报错,大佬可以帮我看一下吗?
ImportError: cannot import name 'amp_state' from 'paddle.fluid.dygraph.amp.auto_cast' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/amp/auto_cast.py)

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/decorators.py:68: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
  regargs, varargs, varkwargs, defaults, formatvalue=lambda value: ""
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/lm/counter.py:15: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Sequence, defaultdict
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/lm/vocabulary.py:13: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Counter, Iterable
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/librosa/core/constantq.py:1059: DeprecationWarning: `np.complex` is a deprecated alias for the builtin `complex`. To silence this warning, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  dtype=np.complex,
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/__init__.py:107: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import MutableMapping
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/rcsetup.py:20: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Iterable, Mapping
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/colors.py:53: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Sized
Traceback (most recent call last):
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/transformers/t5/modeling.py", line 28, in <module>
    from paddle.amp.auto_cast import amp_state
ImportError: cannot import name 'amp_state' from 'paddle.amp.auto_cast' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/amp/auto_cast.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "general_demo.py", line 6, in <module>
    from PaddleTools.TTS import TTSExecutor
  File "/home/aistudio/PaddleBoBo/PaddleTools/TTS.py", line 14, in <module>
    from paddlespeech.t2s.frontend.zh_frontend import Frontend
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlespeech/t2s/frontend/zh_frontend.py", line 31, in <module>
    from paddlespeech.t2s.frontend.g2pw import G2PWOnnxConverter
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlespeech/t2s/frontend/g2pw/__init__.py", line 1, in <module>
    from .onnx_api import G2PWOnnxConverter
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlespeech/t2s/frontend/g2pw/onnx_api.py", line 28, in <module>
    from paddlenlp.transformers import BertTokenizer
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/__init__.py", line 35, in <module>
    from . import (
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/data/__init__.py", line 16, in <module>
    from .data_collator import *
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/data/data_collator.py", line 25, in <module>
    from ..transformers import BertTokenizer
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/transformers/__init__.py", line 142, in <module>
    from .t5.modeling import *
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/transformers/t5/modeling.py", line 30, in <module>
    from paddle.fluid.dygraph.amp.auto_cast import amp_state
ImportError: cannot import name 'amp_state' from 'paddle.fluid.dygraph.amp.auto_cast' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/amp/auto_cast.py)

修改之后 出现了这样的报错,大佬可以帮我看一下吗? ImportError: cannot import name 'amp_state' from 'paddle.fluid.dygraph.amp.auto_cast' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/amp/auto_cast.py)

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/decorators.py:68: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
  regargs, varargs, varkwargs, defaults, formatvalue=lambda value: ""
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/lm/counter.py:15: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Sequence, defaultdict
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/lm/vocabulary.py:13: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Counter, Iterable
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/librosa/core/constantq.py:1059: DeprecationWarning: `np.complex` is a deprecated alias for the builtin `complex`. To silence this warning, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  dtype=np.complex,
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/__init__.py:107: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import MutableMapping
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/rcsetup.py:20: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Iterable, Mapping
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/colors.py:53: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Sized
Traceback (most recent call last):
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/transformers/t5/modeling.py", line 28, in <module>
    from paddle.amp.auto_cast import amp_state
ImportError: cannot import name 'amp_state' from 'paddle.amp.auto_cast' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/amp/auto_cast.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "general_demo.py", line 6, in <module>
    from PaddleTools.TTS import TTSExecutor
  File "/home/aistudio/PaddleBoBo/PaddleTools/TTS.py", line 14, in <module>
    from paddlespeech.t2s.frontend.zh_frontend import Frontend
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlespeech/t2s/frontend/zh_frontend.py", line 31, in <module>
    from paddlespeech.t2s.frontend.g2pw import G2PWOnnxConverter
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlespeech/t2s/frontend/g2pw/__init__.py", line 1, in <module>
    from .onnx_api import G2PWOnnxConverter
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlespeech/t2s/frontend/g2pw/onnx_api.py", line 28, in <module>
    from paddlenlp.transformers import BertTokenizer
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/__init__.py", line 35, in <module>
    from . import (
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/data/__init__.py", line 16, in <module>
    from .data_collator import *
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/data/data_collator.py", line 25, in <module>
    from ..transformers import BertTokenizer
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/transformers/__init__.py", line 142, in <module>
    from .t5.modeling import *
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/transformers/t5/modeling.py", line 30, in <module>
    from paddle.fluid.dygraph.amp.auto_cast import amp_state
ImportError: cannot import name 'amp_state' from 'paddle.fluid.dygraph.amp.auto_cast' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/amp/auto_cast.py)

刚查了,amp_state在paddle 2.4.1版本被移除,目前建议先采用2.3.0版本以下的paddlepaddle运行,后面我找时间修复。

修改之后 出现了这样的报错,大佬可以帮我看一下吗? ImportError: cannot import name 'amp_state' from 'paddle.fluid.dygraph.amp.auto_cast' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/amp/auto_cast.py)

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/decorators.py:68: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
  regargs, varargs, varkwargs, defaults, formatvalue=lambda value: ""
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/lm/counter.py:15: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Sequence, defaultdict
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/lm/vocabulary.py:13: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Counter, Iterable
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/librosa/core/constantq.py:1059: DeprecationWarning: `np.complex` is a deprecated alias for the builtin `complex`. To silence this warning, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  dtype=np.complex,
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/__init__.py:107: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import MutableMapping
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/rcsetup.py:20: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Iterable, Mapping
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/colors.py:53: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Sized
Traceback (most recent call last):
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/transformers/t5/modeling.py", line 28, in <module>
    from paddle.amp.auto_cast import amp_state
ImportError: cannot import name 'amp_state' from 'paddle.amp.auto_cast' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/amp/auto_cast.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "general_demo.py", line 6, in <module>
    from PaddleTools.TTS import TTSExecutor
  File "/home/aistudio/PaddleBoBo/PaddleTools/TTS.py", line 14, in <module>
    from paddlespeech.t2s.frontend.zh_frontend import Frontend
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlespeech/t2s/frontend/zh_frontend.py", line 31, in <module>
    from paddlespeech.t2s.frontend.g2pw import G2PWOnnxConverter
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlespeech/t2s/frontend/g2pw/__init__.py", line 1, in <module>
    from .onnx_api import G2PWOnnxConverter
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlespeech/t2s/frontend/g2pw/onnx_api.py", line 28, in <module>
    from paddlenlp.transformers import BertTokenizer
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/__init__.py", line 35, in <module>
    from . import (
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/data/__init__.py", line 16, in <module>
    from .data_collator import *
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/data/data_collator.py", line 25, in <module>
    from ..transformers import BertTokenizer
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/transformers/__init__.py", line 142, in <module>
    from .t5.modeling import *
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/transformers/t5/modeling.py", line 30, in <module>
    from paddle.fluid.dygraph.amp.auto_cast import amp_state
ImportError: cannot import name 'amp_state' from 'paddle.fluid.dygraph.amp.auto_cast' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/amp/auto_cast.py)

刚查了,amp_state在paddle 2.4.1版本被移除,目前建议先采用2.3.0版本以下的paddlepaddle运行,后面我找时间修复。

是用aistudio运行的,PaddlePaddle 2.2.2 版本
1683595646649

修改之后 出现了这样的报错,大佬可以帮我看一下吗? ImportError: cannot import name 'amp_state' from 'paddle.fluid.dygraph.amp.auto_cast' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/amp/auto_cast.py)

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/decorators.py:68: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
  regargs, varargs, varkwargs, defaults, formatvalue=lambda value: ""
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/lm/counter.py:15: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Sequence, defaultdict
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/nltk/lm/vocabulary.py:13: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Counter, Iterable
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/librosa/core/constantq.py:1059: DeprecationWarning: `np.complex` is a deprecated alias for the builtin `complex`. To silence this warning, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  dtype=np.complex,
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/__init__.py:107: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import MutableMapping
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/rcsetup.py:20: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Iterable, Mapping
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/colors.py:53: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Sized
Traceback (most recent call last):
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/transformers/t5/modeling.py", line 28, in <module>
    from paddle.amp.auto_cast import amp_state
ImportError: cannot import name 'amp_state' from 'paddle.amp.auto_cast' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/amp/auto_cast.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "general_demo.py", line 6, in <module>
    from PaddleTools.TTS import TTSExecutor
  File "/home/aistudio/PaddleBoBo/PaddleTools/TTS.py", line 14, in <module>
    from paddlespeech.t2s.frontend.zh_frontend import Frontend
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlespeech/t2s/frontend/zh_frontend.py", line 31, in <module>
    from paddlespeech.t2s.frontend.g2pw import G2PWOnnxConverter
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlespeech/t2s/frontend/g2pw/__init__.py", line 1, in <module>
    from .onnx_api import G2PWOnnxConverter
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlespeech/t2s/frontend/g2pw/onnx_api.py", line 28, in <module>
    from paddlenlp.transformers import BertTokenizer
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/__init__.py", line 35, in <module>
    from . import (
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/data/__init__.py", line 16, in <module>
    from .data_collator import *
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/data/data_collator.py", line 25, in <module>
    from ..transformers import BertTokenizer
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/transformers/__init__.py", line 142, in <module>
    from .t5.modeling import *
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlenlp/transformers/t5/modeling.py", line 30, in <module>
    from paddle.fluid.dygraph.amp.auto_cast import amp_state
ImportError: cannot import name 'amp_state' from 'paddle.fluid.dygraph.amp.auto_cast' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/amp/auto_cast.py)

刚查了,amp_state在paddle 2.4.1版本被移除,目前建议先采用2.3.0版本以下的paddlepaddle运行,后面我找时间修复。

使用 2.4.1版本的pp就没问题了