Dead loop when iterate through pytorch dataloader

jony: <p>Hi,</p>
<p>I have a small CNN model that works fine on my PC-CPU.<br>
I needed more computations power, so I moved all my data and code to Datalore platform.</p>
<p>Unfortunately, when I’m initializing my model over the Datalore Sheet, my model reaches only the lines where it needs to iterate over PyTorch dataloader and then entering into a dead loop.</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/a/3/a31e3eb10c7c8f85bdcf009a40adfc851be24470.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/a31e3eb10c7c8f85bdcf009a40adfc851be24470" title="1"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/a/3/a31e3eb10c7c8f85bdcf009a40adfc851be24470_2_690x312.jpeg" alt="1" data-base62-sha1="nh0CSpKrRc5cC2dlJoQOT8wnn4k" width="690" height="312" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/a/3/a31e3eb10c7c8f85bdcf009a40adfc851be24470_2_690x312.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/a/3/a31e3eb10c7c8f85bdcf009a40adfc851be24470_2_1035x468.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/a/3/a31e3eb10c7c8f85bdcf009a40adfc851be24470_2_1380x624.jpeg 2x" data-dominant-color="373535"><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">1</span><span class="informations">1910×866 185 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>
<p>This means that it can’t pull image samples for training, the model gets stuck, and I must restart the kernel.<br>
If I’m using a batch size of 2, the model trains.<br>
This bug does not occur when I’m using my own PC nor Kaggle platform with the same code for training.<br>
I also tried to iterate over the dataloader outside of the model, using the code:</p>
<p>images, labels = iter(train_dataloader).next()</p>
<p>and this line of code reproduces the bug described above.</p>
<p>I keep searching the web for a solution and saw that Pytorch Data Loader can make such problems, I tried all the solutions and nothing helped.</p>
<p>Dataset class:</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/7/3/7307baa1003f941415c57d878520ddbfb0eadbc7.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/7307baa1003f941415c57d878520ddbfb0eadbc7" title="3"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/7/3/7307baa1003f941415c57d878520ddbfb0eadbc7_2_690x446.jpeg" alt="3" data-base62-sha1="gpBt2ItNvuYf59g0vdmDKPLyFYr" width="690" height="446" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/7/3/7307baa1003f941415c57d878520ddbfb0eadbc7_2_690x446.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/7/3/7307baa1003f941415c57d878520ddbfb0eadbc7_2_1035x669.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/7/3/7307baa1003f941415c57d878520ddbfb0eadbc7_2_1380x892.jpeg 2x" data-dominant-color="353535"><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">3</span><span class="informations">1575×1019 158 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>
<p>Data Loader:</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/3/3/339174f13dab9aad228ffaadccb3d2c4fa640076.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/339174f13dab9aad228ffaadccb3d2c4fa640076" title="2"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/3/3/339174f13dab9aad228ffaadccb3d2c4fa640076_2_690x249.jpeg" alt="2" data-base62-sha1="7mbZqusPIlBsVrW9S2dgVNzi6DI" width="690" height="249" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/3/3/339174f13dab9aad228ffaadccb3d2c4fa640076_2_690x249.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/3/3/339174f13dab9aad228ffaadccb3d2c4fa640076_2_1035x373.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/3/3/339174f13dab9aad228ffaadccb3d2c4fa640076_2_1380x498.jpeg 2x" data-dominant-color="353536"><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">2</span><span class="informations">2085×753 152 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>
<p>will be greatly appreciated an answer.<br>
Thanks!</p>