pytoch dataloader can only join a child process

Nov. 24, 2019, 10:22 p.m.

read: 187

环境

python版本3.7.0
pytorch版本1.3.1
pycharm远程调试

import torch
from torch import multiprocessing

# DEPENDANCY: This is required for ``DistributedDataParallel``
# https://pytorch.org/docs/stable/nn.html?highlight=distributeddataparallel#torch.nn.parallel.DistributedDataParallel
try:
    multiprocessing.set_start_method('spawn')
except RuntimeError:
    pass

# DEPENDANCY: This is required for ``from tqdm import tqdm``
# https://github.com/tqdm/tqdm/blob/96d8a3c3642474144f53f74331ef2172d1c39496/tqdm/_tqdm.py#L74
mp_lock = multiprocessing.RLock()

import torch
from torch.utils.data import DataLoader

if __name__ == '__main__':
    data_iterator = torch.utils.data.DataLoader([torch.tensor(i) for i in range(10)], num_workers=4)
    for batch in data_iterator:
        pass

直接运行以上简单代码会报错
解决方案/solution
重启pycharm/restart pycharm
如果以上方法行不通 / or
step 1.切换到python3.6环境 / change python version to python3.6
step 2.切换到pytorch 1.1.0/ change pytorch version to 1.1.0




评论

评论模块试运行中,标*的为必填项
昵称:
邮箱:
*内容:
评论

Python EER等错误率计算

import numpy as np class PerformanceEvalHelper(): def eer_clac(self, output, label): …

SoX 音频加速减速

文章标题:SoX 音频加速减速文章内容: SoX - 音频处理的瑞士军刀Welcome to the home of SoX, the Swiss Army knife of sound proc…

推荐使用 Firefox 访问此站点 | 服务器由huxia赞助 | 友情链接: 张鹏的博客  杨洋的博客   李号的博客 | Developed by zhangpeng && hupeng | Powered by Golang | Copyright © 2018-2020 hupeng.me