这里写目录标题
前言
在进行深度学习比如在训练yolov8模型时,在加载训练集和验证集时会报以下那个错误时会导致模型训练中断,有以下两个方法去解决这个问题,来使模型正常训练。
一、解决OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.报错问题
- 错误如下所示:
OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.
1、解决办法1:
在pycharm里调试程序时可以直接通过在程序前添加这两个语句解决
import os
os.environ[“KMP_DUPLICATE_LIB_OK”]=“TRUE”
2、解决办法2:
办法1不能解决问题的话,甚至直接在terminal
上import torch
也会出现这种问题:
究其原因其实是,anaconda的环境下存在两个libiomp5md.dll
文件。所以直接去虚拟环境的路径下搜索这个文件,可以看到在环境里有两个dll文件:
其中第一个是torch路径下的,第二个是虚拟环境本身路径下的,转到第二个目录下把它剪切到其他路径下备份就好(最好把路径也备份一下)。
补充
跳转到第二个文件存放的目录后剪切到任何地方都可以,但最好是个你知道能找到的地方!!!