When I try to increase workers to 4 in my trainloader …torch.utils.data.DataLoader.
I get broken pipe error. My cpu is i7 4core 2.8Ghz
Also using Jupyter notebook for interactivity and checking progress saving etc
Also tried:-Number of worker =1
Error no 32 ----broken pip error
     3     running_loss = 0.0
----> 4     for i, data in enumerate(trainloader, 0):
      5         # get the inputs; data is a list of [inputs, labels]
      6         inputs, labels,img_name = data

~\Documents\Python\lib\site-packages\torch\utils\data\dataloader.py in __iter__(self)
    191 
    192     def __iter__(self):
--> 193         return _DataLoaderIter(self)
    194 
    195     def __len__(self):

~\Documents\Python\lib\site-packages\torch\utils\data\dataloader.py in __init__(self, loader)
    467                 #     before it starts, and __del__ tries to join but will get:
    468                 #     AssertionError: can only join a started process.
--> 469                 w.start()
    470                 self.index_queues.append(index_queue)
    471                 self.workers.append(w)

~\Documents\Python\lib\multiprocessing\process.py in start(self)
    110                'daemonic processes are not allowed to have children'
    111         _cleanup()
--> 112         self._popen = self._Popen(self)
    113         self._sentinel = self._popen.sentinel
    114         # Avoid a refcycle if the target function holds an indirect

~\Documents\Python\lib\multiprocessing\context.py in _Popen(process_obj)
    221     @staticmethod
    222     def _Popen(process_obj):
--> 223         return _default_context.get_context().Process._Popen(process_obj)
    224 
    225 class DefaultContext(BaseContext):

~\Documents\Python\lib\multiprocessing\context.py in _Popen(process_obj)
    320         def _Popen(process_obj):
    321             from .popen_spawn_win32 import Popen
--> 322             return Popen(process_obj)
    323 
    324     class SpawnContext(BaseContext):

~\Documents\Python\lib\multiprocessing\popen_spawn_win32.py in __init__(self, process_obj)
     63             try:
     64                 reduction.dump(prep_data, to_child)
---> 65                 reduction.dump(process_obj, to_child)
     66             finally:
     67                 set_spawning_popen(None)

~\Documents\Python\lib\multiprocessing\reduction.py in dump(obj, file, protocol)
     58 def dump(obj, file, protocol=None):
     59     '''Replacement for pickle.dump() using ForkingPickler.'''
---> 60     ForkingPickler(file, protocol).dump(obj)
     61 
     62 #

BrokenPipeError: [Errno 32] Broken pipe


This is my dataset custom loader through csv file .

from PIL import Image

class Dataset(Dataset):
    """Face Landmarks dataset."""

    def __init__(self, csv_file, root_dir, transforms=None):
        """
        Args:
            csv_file (string): Path to the csv file with annotations.
            root_dir (string): Directory with all the images.
            transform (callable, optional): Optional transform to be applied
                on a sample.
        """
        self.df_frame = pd.read_csv(csv_file)
        self.root_dir = root_dir
        self.transforms = transforms

    def __len__(self):
        return len(self.df_frame)

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

        img_name = os.path.join(self.root_dir,self.df_frame.iloc[idx, 0])
        img = Image.open(img_name).convert('RGB')
        label= self.df_frame.iloc[idx, 2]
#         sample = {'img': img, 'label': label}
        
        if self.transforms is not None:
            img = self.transforms(img)
        
        return (img, label,img_name)
transformed_dataset = Dataset(csv_file='images_data.csv',
                                    root_dir='./',transforms=t)

train_size = int(0.8 * len(transformed_dataset))
test_size = len(transformed_dataset) - train_size
trainset, testset = torch.utils.data.random_split(transformed_dataset, [train_size, test_size])