RuntimeError: DataLoader worker (pid(s) 2656) exited unexpectedly

El_Apatchi: <p>Hi<br>
Im work in pytorch “cycle gan”<br>
My training:<br>
<span class="hashtag-raw">#csv</span><br>
train_csv_path = ‘fileTrainFinWord.csv’ <span class="hashtag-raw">#TODO</span> 70<br>
val_csv_path = ‘fileVal_fin.csv’ <span class="hashtag-raw">#TODO</span> 20<br>
test_csv_path =‘fileTest_fin.csv’ <span class="hashtag-raw">#TODO</span> 10<br>
train_set = MedicalDataset(train_csv_path)<br>
val_set = MedicalDataset(val_csv_path)<br>
test_set = MedicalDataset(test_csv_path)</p>
<p>train_loader = DataLoader(MedicalDataset(train_csv_path,transform = transform),<br>
batch_size=opt.batch_size,<br>
shuffle=True, num_workers=1)<br>
val_loader = DataLoader(MedicalDataset(val_csv_path,transform = transform ),<br>
batch_size=5,<br>
shuffle=True, num_workers=1)<br>
My class<br>
class MedicalDataset(Dataset):<br>
“”“Low-Dose CT dataset.”“”</p>
<pre><code>def __init__(self,csv_file_path,
             root_dir='../input/lowdosect/manifest-1623308542701/LDCT-and-Projection-data/',
             transform=None, ):
    """
    Args:
        root_dir (string): Directory with all the images.
        transform (callable, optional): Optional transform to be applied on a sample.
    """
    self.root_dir = root_dir
    self.img_paths = pd.read_csv(csv_file_path,sep="../input/lowdosect/manifest-1623308542701/metadata.csv",engine='python')
    print(self.img_paths)
    self.img_paths = self.img_paths.drop(self.img_paths.columns[0], axis=1)
    self.len = self.img_paths.shape[0]
</code></pre>
<h1><a name="selffull-1" class="anchor" href="#selffull-1"></a>self.full = <span class="chcklst-box fa fa-square-o fa-fw"></span></h1>
<h1><a name="selflow-2" class="anchor" href="#selflow-2"></a>self.low = <span class="chcklst-box fa fa-square-o fa-fw"></span></h1>
<pre><code>    self.fullcache = {}  
    self.lowcache = {}
    
    if transform:
        self.transform = transform
    else:
        self.transform = transforms.Compose([
</code></pre>
<h1><a name="transformsrescale255-3" class="anchor" href="#transformsrescale255-3"></a>transforms.Rescale(255),</h1>
<pre><code>            transforms.ToTensor()
        ])

def __len__(self):
    return self.len

def __getitem__(self, idx):
    if torch.is_tensor(idx):
        idx = idx.tolist()

    low_dose_path, full_dose_path = self.img_paths.iloc[idx, 0:2]
    # till this point we have paths for both low dose and high dose dicom files
    # write a function `dicom_to_img` to convert .dicom to image
    # and store them in low_dose_img, high_dose_img respectively
    low_dose_img, full_dose_img = self.dicom_to_img(low_dose_path, full_dose_path)
    if self.transform:
        low_dose_img = self.transform(low_dose_img)
        full_dose_img = self.transform(full_dose_img)
        
    (low_dose_img, full_dose_img)
    return {"A":low_dose_img , "B": full_dose_img}
    #return sample
</code></pre>
<p>class MedicalDataset(Dataset):<br>
“”“Low-Dose CT dataset.”“”</p>
<pre><code>def __init__(self,csv_file_path,
             root_dir='../input/lowdosect/manifest-1623308542701/LDCT-and-Projection-data/',
             transform=None, ):
    """
    Args:
        root_dir (string): Directory with all the images.
        transform (callable, optional): Optional transform to be applied on a sample.
    """
    self.root_dir = root_dir
    self.img_paths = pd.read_csv(csv_file_path,sep="../input/lowdosect/manifest-1623308542701/metadata.csv",engine='python')
    print(self.img_paths)
    self.img_paths = self.img_paths.drop(self.img_paths.columns[0], axis=1)
    self.len = self.img_paths.shape[0]
</code></pre>
<h1><a name="selffull-4" class="anchor" href="#selffull-4"></a>self.full = <span class="chcklst-box fa fa-square-o fa-fw"></span></h1>
<h1><a name="selflow-5" class="anchor" href="#selflow-5"></a>self.low = <span class="chcklst-box fa fa-square-o fa-fw"></span></h1>
<pre><code>    self.fullcache = {}  
    self.lowcache = {}
    
    if transform:
        self.transform = transform
    else:
        self.transform = transforms.Compose([
</code></pre>
<h1><a name="transformsrescale255-6" class="anchor" href="#transformsrescale255-6"></a>transforms.Rescale(255),</h1>
<pre><code>            transforms.ToTensor()
        ])

def __len__(self):
    return self.len

def __getitem__(self, idx):
    if torch.is_tensor(idx):
        idx = idx.tolist()

    low_dose_path, full_dose_path = self.img_paths.iloc[idx, 0:2]
    # till this point we have paths for both low dose and high dose dicom files
    # write a function `dicom_to_img` to convert .dicom to image
    # and store them in low_dose_img, high_dose_img respectively
    low_dose_img, full_dose_img = self.dicom_to_img(low_dose_path, full_dose_path)
    if self.transform:
        low_dose_img = self.transform(low_dose_img)
        full_dose_img = self.transform(full_dose_img)
        
    (low_dose_img, full_dose_img)
    return {"A":low_dose_img , "B": full_dose_img}
    #return sample
</code></pre>
<p>i have this Erreur<br>
<img src="https://discuss.pytorch.org/uploads/default/original/3X/8/0/80d27e1ff7d98bb08e3917cc79e11692ea7a45e7.png" alt="Capture" data-base62-sha1="inC5S0koYuGxjHppTEA3saoUAT5" width="535" height="360"><br>
when i change the Num worker To 0 i have this :<br>
ValueError: not enough values to unpack (expected 2, got 0)<br>
Please help me in figuring out these issues.</p>

Andre_Amaral_IST: <p>Hey,<br>
Can you please provide the GPU frame? In Nvidia if you use <code>nvidia-smi</code> you can check the GPU usage, memory and the processes that are occupying memory.</p>

El_Apatchi: <p>I don’t have any gpu Just Cpu i3 M370 / 6gb Ram<br>
i try in google colab i got this erreur<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/5/4/543cd943e29fc172b8acad4b5602d3ca6a165efa.png" data-download-href="https://discuss.pytorch.org/uploads/default/543cd943e29fc172b8acad4b5602d3ca6a165efa" title="Capture"><img src="https://discuss.pytorch.org/uploads/default/original/3X/5/4/543cd943e29fc172b8acad4b5602d3ca6a165efa.png" alt="Capture" data-base62-sha1="c1ctsOPoWJiOXa7xTE9iz7Ly5Oa" width="690" height="277" data-dominant-color="414142"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Capture</span><span class="informations">933×375 22.4 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

ptrblck: <p>The current error is raised as <code>self.img_paths.iloc[idx, 0:2]</code> seems to return <code>0</code> values, so I guess the paths of your data samples might be wrong in the current setup.</p>