36

使用PyTorch版的yolov5训练时,出现Error in `python': double free or corruption (!...

 3 years ago
source link: https://blog.popkx.com/Error-in-python-double-free-or-corruption-prev-when-using-yolov5-training/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

使用PyTorch版的yolov5训练时,出现Error in `python': double free or corruption (!prev)错误的解决方式

发表于 2020-08-06 08:08:00   |   已被 访问: 540 次   |   分类于:   PyTorch基础   |   暂无评论

一切准备妥当,运行训练命令时,出现下面这个错误:

Error in `python': double free or corruption (!prev)

这可能与我使用的训练机器系统版本(ubuntu14.04)较低有关,相关的库可能不能匹配较新的程序。执行下面的命令:

$ sudo apt-get install libtcmalloc-minimal4
$ export LD_PRELOAD="/usr/lib/libtcmalloc_minimal.so.4"

问题解决。

详细讨论可以参考这里

如果不添加上面的库到 LD_PRELAOD,可能还会出现下面这样的错误:

Error in `python': free(): invalid pointer: 0x00000000020663b

但是添加后,虽然可以暂时正常训练,但是在一个 epoch结束时,又出现了下面这样的错误:

src/tcmalloc.cc:277] Attempt to free invalid pointer

此时可以尝试将 utils/dataset.py 中的 Dataloader 的 drop_last 参数设置为 True。

阅读更多:   PyTorch基础


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK