集群训练报错。本机正常,上传到集群就出现编码错误。
解决步骤:
- 命令前添加:
PYTHONIOENCODING=utf-8
例如:PYTHONIOENCODING=utf-8 python train.py
- 修改open函数。
例如将:
with open(cfg) as f:
改为:
with open(cfg,'r',encoding='utf-8') as f:
集群训练报错。本机正常,上传到集群就出现编码错误。
解决步骤:
PYTHONIOENCODING=utf-8
例如:PYTHONIOENCODING=utf-8 python train.py
with open(cfg) as f:
改为:
with open(cfg,'r',encoding='utf-8') as f: