torch.utils.data.DataLoader cantnot iter(dataloader)

mingkong165: <p>I have loaded the data, and these are the parameters of the dataset, which can be read normally.<br>
the dataloader I created, and you can also view its parameters.<br>
The issue is：Once I iterate over this dataloader, the program freezes (without any errors or warnings, I can only restart the kernel). I tried to debug the program, but I couldn’t set breakpoints.<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/f/2/f2abeeabec48b4a19d22bfa80bd4df5f698611db.png" data-download-href="https://discuss.pytorch.org/uploads/default/f2abeeabec48b4a19d22bfa80bd4df5f698611db" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/f/2/f2abeeabec48b4a19d22bfa80bd4df5f698611db_2_690x428.png" alt="image" data-base62-sha1="yCLUumMrjmFZ5020UdhGaaxxWf9" width="690" height="428" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/f/2/f2abeeabec48b4a19d22bfa80bd4df5f698611db_2_690x428.png, https://discuss.pytorch.org/uploads/default/optimized/3X/f/2/f2abeeabec48b4a19d22bfa80bd4df5f698611db_2_1035x642.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/f/2/f2abeeabec48b4a19d22bfa80bd4df5f698611db_2_1380x856.png 2x" data-dominant-color="26272A"><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">image</span><span class="informations">1455×904 68.6 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 is the runtime environment.with python 3.12 torch2.3 cuda121</p>
<p>and it also doesn’t work in python 3.8.<br>
I hope someone can help me solve this problem. It has been bothering me for several days, and I have searched online for a long time without finding a similar issue.thanks</p>

mingkong165: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/b/b/bb0e0fae13ade14e33b3db2adcaf050cbbe78736.png" data-download-href="https://discuss.pytorch.org/uploads/default/bb0e0fae13ade14e33b3db2adcaf050cbbe78736" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/b/b/bb0e0fae13ade14e33b3db2adcaf050cbbe78736_2_595x500.png" alt="image" data-base62-sha1="qGLpBOuuUC5NYsnDaLtEuncpGF8" width="595" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/b/b/bb0e0fae13ade14e33b3db2adcaf050cbbe78736_2_595x500.png, https://discuss.pytorch.org/uploads/default/optimized/3X/b/b/bb0e0fae13ade14e33b3db2adcaf050cbbe78736_2_892x750.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/b/b/bb0e0fae13ade14e33b3db2adcaf050cbbe78736.png 2x" data-dominant-color="2E3033"><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">image</span><span class="informations">1095×920 91 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>

mingkong165: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/1/2/12a51bdd8213e4b914dc58d5543dcd8512830f28.png" data-download-href="https://discuss.pytorch.org/uploads/default/12a51bdd8213e4b914dc58d5543dcd8512830f28" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/1/2/12a51bdd8213e4b914dc58d5543dcd8512830f28_2_557x500.png" alt="image" data-base62-sha1="2EWkZmK7Q79QQJgoFrckPq32Dos" width="557" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/1/2/12a51bdd8213e4b914dc58d5543dcd8512830f28_2_557x500.png, https://discuss.pytorch.org/uploads/default/optimized/3X/1/2/12a51bdd8213e4b914dc58d5543dcd8512830f28_2_835x750.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/1/2/12a51bdd8213e4b914dc58d5543dcd8512830f28.png 2x" data-dominant-color="2E3033"><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">image</span><span class="informations">846×759 52.9 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>

mingkong165: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/1/f/1ff97452366024198e0fb3953db1c3dbf3170b1d.png" data-download-href="https://discuss.pytorch.org/uploads/default/1ff97452366024198e0fb3953db1c3dbf3170b1d" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/1/f/1ff97452366024198e0fb3953db1c3dbf3170b1d_2_482x500.png" alt="image" data-base62-sha1="4yRfOHUVs9kbu10dzMhi3pPGWYJ" width="482" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/1/f/1ff97452366024198e0fb3953db1c3dbf3170b1d_2_482x500.png, https://discuss.pytorch.org/uploads/default/optimized/3X/1/f/1ff97452366024198e0fb3953db1c3dbf3170b1d_2_723x750.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/1/f/1ff97452366024198e0fb3953db1c3dbf3170b1d.png 2x" data-dominant-color="252629"><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">image</span><span class="informations">879×910 87 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>

qq-me: <p>Dataloader uses multiprocessing (or something like that) which apparently doesn’t work on windows + jupyter. Try setting num workers to 0 in your dataloader</p>