-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError: (InvalidArgument) The axis is expected to be in range of [0, 0), but got 0 #3408
Comments
You can attempt to fix the bug using this method, but finding the root cause of the issue will require additional effort. |
@Asthestarsfalll I corrected the related part of the code ("/usr/local/lib/python3.10/dist-packages/paddleseg/utils/metrics.py") as suggested:
But it is still giving the same error. |
@firaterdem |
@Asthestarsfalll sure, here is the notebook: https://colab.research.google.com/drive/1Uu4eUHcDNA7LThE5KGexG5HdEZR-vB2t?usp=sharing |
@firaterdem You can try this to install paddleseg git clone https://github.com/PaddlePaddle/PaddleSeg
cd PaddleSeg
pip install -r requirements.txt
python setup.py install |
@Asthestarsfalll Yes, installing paddleseg in this way solved the problem. Thank you very much! |
以上回答已经充分解答了问题,如果有新的问题欢迎随时提交issue,或者在此条issue下继续回复~ |
I have try this method, but not solve the problem. How can I solve this. |
should give more details |
I change my code from gitee to github and solve the problem, thanks. |
我也遇到同樣的問題,已經按照上面的步驟無論是重新安裝或downgrad版本重跑數變,都是一樣的問題: 我是follow 官方教程:https://github.com/PaddlePaddle/PaddleSeg/blob/release/2.8/docs/quick_start_cn.md I0924 22:43:01.913477 15680 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. |
是按照这种方式安装的吗,请确认安装成功了,而不是使用的pypi源当中的paddleseg
|
我是按照官方網站的教學: 我的硬體與安裝包如下: 錯誤碼如下: 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. (這一段的警告提示,應該無關訓練) 中止執行的時間點就是ve_interval 500的地方, epoch: 8, iter: 500/1000, loss: 0.0478, lr: 0.005369, batch_cost: 0.1344, reader_cost: 0.05471, ips: 29.7619 |
@jason660519 不要使用pip安装,确保本地的包是通过python setup.py安装上的 |
用 python setup.py 安裝不了,安裝到一半會跳出錯誤碼... |
那就使用更低版本的paddle试试 |
(paddle2-4) PS C:\Users\a0922\Desktop\paddle2-4> python -m pip install paddlepaddle-gpu==2.4.2.post117 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html PS C:\Users\a0922\Desktop\paddle2-4> python -m pip install paddlepaddle-gpu==2.3.2.post116 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html 即使降了一代版本,官網回應satisfy的paddle版本全都2.5.1版本以上 |
@jason660519 请给出本地安装paddleseg的报错信息 |
解决了吗 |
这种方式安装的还是没有解决, |
我也是源代码下载 也是没解决问题 版本是2.8.0 是因为版本问题吗? |
where you change this code |
我按照您的方法重新装了paddleseg,还是报了这个错误,似乎不是metric的错误 |
我调试了一下看到在metric.py第53-55行的paddle.sum(*)计算结果shape=[],在for循环结束后进行concat就会报错。我将sum的结果用升了一维,之后就没再报错了。如果你也是这种情况可以试试 |
Thanks for this issue. As it has been inactive for a long time, we would close it. If you has any questions, please feel free to reopen or new issue, and we will follow up and resolve it. |
问题确认 Search before asking
Bug描述 Describe the Bug
In Google Colab Quick Start code is giving the following error message at the training part. How can I solve it?
2023-07-26 12:56:35 [INFO] [TRAIN] epoch: 8, iter: 500/1000, loss: 0.0543, lr: 0.005369, batch_cost: 0.1380, reader_cost: 0.04589, ips: 28.9826 samples/sec | ETA 00:01:09 2023-07-26 12:56:35 [INFO] Start evaluating (total_samples: 76, total_iters: 76)... Traceback (most recent call last): File "/content/drive/MyDrive/SmartPol_PaddleSeg/PaddleSeg/tools/train.py", line 195, in <module> main(args) File "/content/drive/MyDrive/SmartPol_PaddleSeg/PaddleSeg/tools/train.py", line 170, in main train( File "/usr/local/lib/python3.10/dist-packages/paddleseg/core/train.py", line 315, in train mean_iou, acc, _, _, _ = evaluate( File "/usr/local/lib/python3.10/dist-packages/paddleseg/core/val.py", line 161, in evaluate intersect_area, pred_area, label_area = metrics.calculate_area( File "/usr/local/lib/python3.10/dist-packages/paddleseg/utils/metrics.py", line 57, in calculate_area pred_area = paddle.concat(pred_area) File "/usr/local/lib/python3.10/dist-packages/paddle/tensor/manipulation.py", line 1121, in concat return _C_ops.concat(input, axis) ValueError: (InvalidArgument) The axis is expected to be in range of [0, 0), but got 0 [Hint: Expected axis >= -rank && axis < rank == true, but received axis >= -rank && axis < rank:0 != true:1.] (at ../paddle/phi/infermeta/multiary.cc:954)
复现环境 Environment
Bug描述确认 Bug description confirmation
是否愿意提交PR? Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: