是paddlepaddle版本导致的,出现问题时我安装的版本是
python -m pip install paddlepaddle==2.3.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
改成下面这个版本就好了
python -m pip install paddlepaddle==2.4.0rc0 -i https://pypi.tuna.tsinghua.edu.cn/simple
参考:https://github.com/PaddlePaddle/Paddle/issues/44571#issuecomment-1268797171