1、python2 要输出中文的时候出现编码错误UnicodeEncodeError: 'ascii' codec can't encode characters in position 4-33: ordinal not in range(128,则export PYTHONIOENCODING=utf8。
2、明明GPU足够,却还报错说显存不足:
RuntimeError: CUDA out of memory. Tried to allocate 112.00 MiB (GPU 0; 11.17 GiB total capacity; 10.75 GiB already allocated; 6.44 MiB free; 120.22 MiB cached)
解决办法是将batch_size减小
3.导入.py文件出错:明明文件夹下存在.py文件,却报错说找不到改文件夹
解决办法是在改文件夹下创建一个__init__.py文件,内容不用写.
4.Floating point exception (core dumped)
可能是输入数据路径不对,检查路径
5.python2 在类继承的时候,super的地方报错:TypeError: super() argument 1 must be type, not classobj,方法是将#那行改成下面那行。
class OCRDataLoaderFactory(BaseDataLoader):
def __init__(self, config, ds):
# super(OCRDataLoaderFactory, self).__init__(config)
BaseDataLoader.__init__(self, config)
6、python2 math.inf报错
self.monitor_best = math.inf if self.monitor_mode == 'min' else -math.inf
AttributeError: 'module' object has no attribute 'inf'
lower_bound=-math.inf
to lower_bound=-float('inf')