赞
踩
安装和升级到paddlepaddle2.4.2版本
在原已安装的paddlepaddle版本2.2.2版本升级到2.4.2版本
原安装环境如下所示:
paddlepaddle版本2.2.2
python 3.9.12
numpy 1.19.3
protobuf 3.19.0
matplotlib3.5.0
安装命令
python -m pip install paddlepaddle==2.4.2 -i https://mirror.baidu.com/pypi/simple
安装过程信息:
Looking in indexes: https://mirror.baidu.com/pypi/simple Collecting paddlepaddle==2.4.2 Downloading https://mirror.baidu.com/pypi/packages/94/d6/4b1aca2fcc37a674968ac309dec9911d37966f72f11408a5715b9a266498/paddlepaddle-2.4.2-cp39-cp39-win_amd64.whl (68.6 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 68.6/68.6 MB 7.4 MB/s eta 0:00:00 Requirement already satisfied: requests>=2.20.0 in d:\python39\lib\site-packages (from paddlepaddle==2.4.2) (2.31.0) Requirement already satisfied: numpy>=1.13 in d:\python39\lib\site-packages (from paddlepaddle==2.4.2) (1.19.3) Requirement already satisfied: protobuf<=3.20.0,>=3.1.0 in d:\python39\lib\site-packages (from paddlepaddle==2.4.2) (3.19.0) Requirement already satisfied: Pillow in d:\python39\lib\site-packages (from paddlepaddle==2.4.2) (10.0.0) Requirement already satisfied: six in d:\python39\lib\site-packages (from paddlepaddle==2.4.2) (1.16.0) Requirement already satisfied: decorator in d:\python39\lib\site-packages (from paddlepaddle==2.4.2) (5.1.1) Requirement already satisfied: astor in d:\python39\lib\site-packages (from paddlepaddle==2.4.2) (0.8.1) Requirement already satisfied: paddle-bfloat==0.1.7 in d:\python39\lib\site-packages (from paddlepaddle==2.4.2) (0.1.7) Requirement already satisfied: opt-einsum==3.3.0 in d:\python39\lib\site-packages (from paddlepaddle==2.4.2) (3.3.0) Requirement already satisfied: charset-normalizer<4,>=2 in d:\python39\lib\site-packages (from requests>=2.20.0->paddlepaddle==2.4.2) (3.2.0) Requirement already satisfied: idna<4,>=2.5 in d:\python39\lib\site-packages (from requests>=2.20.0->paddlepaddle==2.4.2) (3.4) Requirement already satisfied: urllib3<3,>=1.21.1 in d:\python39\lib\site-packages (from requests>=2.20.0->paddlepaddle==2.4.2) (2.0.4) Requirement already satisfied: certifi>=2017.4.17 in d:\python39\lib\site-packages (from requests>=2.20.0->paddlepaddle==2.4.2) (2023.7.22) Installing collected packages: paddlepaddle Attempting uninstall: paddlepaddle Found existing installation: paddlepaddle 2.5.0 Uninstalling paddlepaddle-2.5.0: Successfully uninstalled paddlepaddle-2.5.0 Successfully installed paddlepaddle-2.4.2
附特别说明:
安装paddlepaddle2.5.0版本时运行波士顿房价预测练习模型报警告信息,
然后选择降级paddlepaddle版本为2.4.2后,运行波士顿房价预测练习模型运行显示正常。
报错信息为:
I0727 17:24:39.457155 3264 eager_method.cc:140] Warning:: 0D Tensor cannot be used as 'Tensor.numpy()[0]' . In order to avoid this problem, 0D Tensor will be changed to 1D numpy currently, but it's not correct and will be removed in release 2.6. For Tensor contain only one element, Please modify 'Tensor.numpy()[0]' to 'float(Tensor)' as soon as possible, otherwise 'Tensor.numpy()[0]' will raise error in release 2.6.
epoch: 0, iter: 0, loss is: [0.61689854]
I0727 17:24:39.457155 3264 eager_method.cc:140] Warning:: 0D Tensor cannot be used as ‘Tensor.numpy()[0]’ . In order to avoid this problem, 0D Tensor will be changed to 1D numpy currently, but it’s not correct and will be removed in release 2.6. For Tensor contain only one element, Please modify ‘Tensor.numpy()[0]’ to ‘float(Tensor)’ as soon as possible, otherwise ‘Tensor.numpy()[0]’ will raise error in release 2.6.
epoch: 0, iter: 0, loss is: [0.61689854]
正常运行结果为:
PS E:\project\python> & D:/Python39/python.exe e:/project/python/BSD_House.py (404, 14) [2.35922547e-04 0.00000000e+00 2.62405723e-01 0.00000000e+00 1.72839552e-01 5.47997713e-01 7.82698274e-01 3.48961979e-01 4.34782617e-02 1.14822544e-01 5.53191364e-01 1.00000000e+00 2.04470202e-01 3.68888885e-01] epoch: 0, iter: 0, loss is: [0.16997007] epoch: 0, iter: 20, loss is: [0.09108555] epoch: 0, iter: 40, loss is: [0.05743874] epoch: 1, iter: 0, loss is: [0.08955293] epoch: 1, iter: 20, loss is: [0.12547061] epoch: 1, iter: 40, loss is: [0.04235566] epoch: 2, iter: 0, loss is: [0.10120375] epoch: 2, iter: 20, loss is: [0.07282082] epoch: 2, iter: 40, loss is: [0.0119858] epoch: 3, iter: 0, loss is: [0.0201203] epoch: 3, iter: 20, loss is: [0.08953147] epoch: 3, iter: 40, loss is: [0.05066795] epoch: 4, iter: 0, loss is: [0.06509191] epoch: 4, iter: 20, loss is: [0.08290102] epoch: 4, iter: 40, loss is: [0.01342782] epoch: 5, iter: 0, loss is: [0.03227503] epoch: 5, iter: 20, loss is: [0.04030671] epoch: 5, iter: 40, loss is: [0.01414857] epoch: 6, iter: 0, loss is: [0.04230401] epoch: 6, iter: 20, loss is: [0.05334773] epoch: 6, iter: 40, loss is: [0.01507752] epoch: 7, iter: 0, loss is: [0.04790386] epoch: 7, iter: 20, loss is: [0.03998263] epoch: 7, iter: 40, loss is: [0.07531232] epoch: 8, iter: 0, loss is: [0.04619852] epoch: 8, iter: 20, loss is: [0.03524473] epoch: 8, iter: 40, loss is: [0.02654554] epoch: 9, iter: 0, loss is: [0.06348988] epoch: 9, iter: 20, loss is: [0.02625728] epoch: 9, iter: 40, loss is: [0.02237093] 模型保存成功,模型参数保存在LR_model.pdparams中 Inference result is [[22.27693]], the corresponding label is 19.700000762939453
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。