######
加载数据出错:
/usr/lib/python2.7/multiprocessing/reduction.py", line 157, in rebuild_handle
new_handle = recv_handle(conn)
File "/usr/lib/python2.7/multiprocessing/reduction.py", line 83, in recv_handle
return _multiprocessing.recvfd(conn.fileno())
OSError: [Errno 4] Interrupted system call
Exception socket.error: error(111, 'Connection refused') in <bound method DataLoaderIter.__del__ of <torch.utils.data.dataloader.DataLoaderIter object at 0x7f94f55bfc90>> ignored
参考https://github.com/pytorch/pytorch/issues/4220
######
解决方法:
打开文件
"/usr/lib/python2.7/multiprocessing/reduction.py"
把82行的函数recv_handle()
#####
def recv_handle(conn):
return _multiprocessing.recvfd(conn.fileno())
#####
改为如下内容
#####
def recv_handle(conn):
while True:
try:
_fl_data = _multiprocessing.recvfd(conn.fileno())
break
except OSError, num:
print num
if num==4:
continue
return _fl_data
#####