PaddleNLP
PaddleNLP copied to clipboard
[Bug]: 使用Taskflow进行情感分析任务的一键预测的时候报错
软件环境
- paddlepaddle:
- paddlepaddle-gpu: 2.3.2.post112
- paddlenlp: 2.4.2
重复问题
- [X] I have searched the existing issues
错误描述
利用paddlenlp进行情感分析任务一键预测的时候,使用skep_ernie_1.0_large_ch模型时会报错
稳定复现步骤 & 代码
senta = Taskflow("sentiment_analysis", model="skep_ernie_1.0_large_ch") [2022-11-06 21:18:44,262] [ INFO] - Already cached /home/wanghan/.paddlenlp/models/skep_ernie_1.0_large_ch/skep_ernie_1.0_large_ch.vocab.txt [2022-11-06 21:18:44,268] [ INFO] - tokenizer config file saved in /home/wanghan/.paddlenlp/models/skep_ernie_1.0_large_ch/tokenizer_config.json [2022-11-06 21:18:44,268] [ INFO] - Special tokens file saved in /home/wanghan/.paddlenlp/models/skep_ernie_1.0_large_ch/special_tokens_map.json Traceback (most recent call last): File "
", line 1, in File "/home/wanghan/.conda/envs/paddle/lib/python3.8/site-packages/paddlenlp/taskflow/taskflow.py", line 569, in init self.task_instance = task_class(model=self.model, File "/home/wanghan/.conda/envs/paddle/lib/python3.8/site-packages/paddlenlp/taskflow/sentiment_analysis.py", line 255, in init self._get_inference_model() File "/home/wanghan/.conda/envs/paddle/lib/python3.8/site-packages/paddlenlp/taskflow/task.py", line 245, in _get_inference_model self._construct_model(self.model) File "/home/wanghan/.conda/envs/paddle/lib/python3.8/site-packages/paddlenlp/taskflow/sentiment_analysis.py", line 264, in _construct_model model_instance = SkepSequenceModel.from_pretrained(self._task_path, File "/home/wanghan/.conda/envs/paddle/lib/python3.8/site-packages/paddlenlp/transformers/model_utils.py", line 348, in from_pretrained base_model = cls.base_model_class(*base_args, **base_kwargs) File "/home/wanghan/.conda/envs/paddle/lib/python3.8/site-packages/paddlenlp/transformers/utils.py", line 159, in impl init_func(self, *args, **kwargs) File "/home/wanghan/.conda/envs/paddle/lib/python3.8/site-packages/paddlenlp/transformers/skep/modeling.py", line 270, in init self.embeddings = SkepEmbeddings(vocab_size, hidden_size, File "/home/wanghan/.conda/envs/paddle/lib/python3.8/site-packages/paddlenlp/transformers/skep/modeling.py", line 54, in init self.word_embeddings = nn.Embedding(vocab_size, File "/home/wanghan/.conda/envs/paddle/lib/python3.8/site-packages/paddle/nn/layer/common.py", line 1461, in init self.weight[padding_idx] = 0.0 File "/home/wanghan/.conda/envs/paddle/lib/python3.8/site-packages/paddle/fluid/framework.py", line 2189, in setitem return setitem_impl(self, item, value) File "/home/wanghan/.conda/envs/paddle/lib/python3.8/site-packages/paddle/fluid/variable_index.py", line 696, in setitem_impl var._bump_inplace_version() AttributeError: 'Parameter' object has no attribute '_bump_inplace_version'
需要做PaddlePaddle的更新和PaddleNLP才能解决这个问题
1)Paddle的版本升级2.4.0rc0版本 2)修改PaddleNLP的library文件或者拉取代码最新的develop代码,修复PR https://github.com/PaddlePaddle/PaddleNLP/pull/3695
This issue is stale because it has been open for 60 days with no activity. 当前issue 60天内无活动,被标记为stale。
This issue was closed because it has been inactive for 14 days since being marked as stale. 当前issue 被标记为stale已有14天,即将关闭。