PaddlePaddle / PaddleHub

Awesome pre-trained models toolkit based on PaddlePaddle. (400+ models including Image, Text, Audio, Video and Cross-Modal with Easy Inference & Serving)【安全加固,暂停交互,请耐心等待】
https://www.paddlepaddle.org.cn/hub
Apache License 2.0
12.75k stars 2.07k forks source link

PaddleHub引入报错 #2194

Open Gray-web opened 1 year ago

Gray-web commented 1 year ago

硬件:Jetson Nano 2G cuda:10.2 cudnn:8.0.0 paddlepaddle-gpu:2.0.2 paddlehub:2.0.0 paddlenlp:2.3.3

在Python终端中输入import paddlehub后输出以下报错

/usr/lib/python3/dist-packages/apport/report.py:13: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import fnmatch, glob, traceback, errno, sys, atexit, locale, imp, stat Traceback (most recent call last): File "", line 1, in File "/home/tringai/.local/lib/python3.6/site-packages/paddlehub/init.py", line 24, in from paddlehub import datasets File "/home/tringai/.local/lib/python3.6/site-packages/paddlehub/datasets/init.py", line 18, in from paddlehub.datasets.chnsenticorp import ChnSentiCorp File "/home/tringai/.local/lib/python3.6/site-packages/paddlehub/datasets/chnsenticorp.py", line 19, in from paddlehub.datasets.base_nlp_dataset import TextClassificationDataset File "/home/tringai/.local/lib/python3.6/site-packages/paddlehub/datasets/base_nlp_dataset.py", line 23, in from paddlenlp.transformers import PretrainedTokenizer File "/home/tringai/.local/lib/python3.6/site-packages/paddlenlp/init.py", line 24, in from . import data File "/home/tringai/.local/lib/python3.6/site-packages/paddlenlp/data/init.py", line 16, in from .data_collator import File "/home/tringai/.local/lib/python3.6/site-packages/paddlenlp/data/data_collator.py", line 23, in from ..transformers.tokenizer_utils_base import BatchEncoding, PretrainedTokenizerBase, PaddingStrategy File "/home/tringai/.local/lib/python3.6/site-packages/paddlenlp/transformers/init.py", line 26, in from .electra.modeling import File "/home/tringai/.local/lib/python3.6/site-packages/paddlenlp/transformers/electra/modeling.py", line 20, in from paddle.nn.layer.transformer import _convert_attention_mask ImportError: cannot import name '_convert_attention_mask'

求解答

rainyfly commented 1 year ago

看报错应该是版本的问题,试试升级一下paddle的版本看看

Gray-web commented 1 year ago

看报错应该是版本的问题,试试升级一下paddle的版本看看

nano的paddle版本最高就是2.0.2