Pytorch错误

File "/home/wang/.conda/envs/openNRE/lib/python3.7/multiprocessing/queues.py", line 236, in _feed
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/multiprocessing/reduction.py", line 51, in dumps
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/site-packages/torch/multiprocessing/reductions.py", line 321, in reduce_storage
RuntimeError: unable to open shared memory object </torch_8517_4014952554> in read-write mode
Traceback (most recent call last):
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/multiprocessing/resource_sharer.py", line 149, in _serve
    send(conn, destination_pid)
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/multiprocessing/resource_sharer.py", line 50, in send
    reduction.send_handle(conn, new_fd, pid)
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/multiprocessing/reduction.py", line 179, in send_handle
    with socket.fromfd(conn.fileno(), socket.AF_UNIX, socket.SOCK_STREAM) as s:
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/socket.py", line 463, in fromfd
    nfd = dup(fd)
OSError: [Errno 24] Too many open files
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/site-packages/torch/utils/data/_utils/pin_memory.py", line 25, in _pin_memory_loop
    r = in_queue.get(timeout=MP_STATUS_CHECK_INTERVAL)
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/multiprocessing/queues.py", line 113, in get
    return _ForkingPickler.loads(res)
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/site-packages/torch/multiprocessing/reductions.py", line 282, in rebuild_storage_fd
    fd = df.detach()
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/multiprocessing/resource_sharer.py", line 58, in detach
    return reduction.recv_handle(conn)
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/multiprocessing/reduction.py", line 185, in recv_handle
    return recvfds(s, 1)[0]
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/multiprocessing/reduction.py", line 155, in recvfds
    raise EOFError
EOFError

  0%|                                                  | 0/6533 [00:05<?, ?it/s]
Traceback (most recent call last):
  File "/home/wang/code/GCN/mytest.py", line 131, in <module>
    run(a)
  File "/home/wang/code/GCN/mytest.py", line 118, in run
    framework.train_model(args.metric)
  File "/home/wang/code/GCN/opennre/framework/gcn_re.py", line 117, in train_model
    for iter, data in enumerate(t):
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/site-packages/tqdm/std.py", line 1178, in __iter__
    for obj in iterable:
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 435, in __next__
    data = self._next_data()
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1068, in _next_data
    idx, data = self._get_data()
  File "/home/wang/.conda/envs/openNRE/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1029, in _get_data
    raise RuntimeError('Pin memory thread exited unexpectedly')
RuntimeError: Pin memory thread exited unexpectedly

解决方案:

import torch.multiprocessing
torch.multiprocessing.set_sharing_strategy('file_system')

参考:
https://blog.csdn.net/fengzhongluoleidehua/article/details/95468899

你可能感兴趣的:(错误)