Anurag1734/cuda-error-resolution-analysis
07
1[2 {3 "post_stream": {4 "posts": [5 {6 "id": 379769,7 "name": "ATU ATU",8 "username": "ATU_ATU",9 "avatar_template": "/user_avatar/discuss.pytorch.org/atu_atu/{size}/46764_2.png",10 "created_at": "2022-12-20T03:58:44.332Z",11 "cooked": "<p>Hello everyone, I need your support. I made some modifications to increase group size from 3 to 4 by adding <code>self.g4= Group(conv, self.dim, kernel_size,blocks=blocks)</code> to the <code>class FFA(nn.Module)</code> and also adding <code>res4 </code>on the <code>def forward(self, x1):</code> block. I am getting error that says <code>RuntimeError: Given groups = 1, weight of size [64, 4, 3, 3], expected input[2, 3, 240, 240] to have 4 channels, but got 3 channels instead</code> . I will appreciate your assistance. I have attached the <code>.py file</code> content of 1. <code>Original Code</code>, 2. <code>Modified code</code>. I’m seeing a couple of these posts in the forum, but I’m having trouble connecting them to my own problem below. Thank you</p>\n<p>Original code:</p>\n<pre><code class=\"lang-auto\">import torch.nn as nn\nimport torch\n\ndef default_conv(in_channels, out_channels, kernel_size, bias=True):\n return nn.Conv2d(in_channels, out_channels, kernel_size,padding=(kernel_size//2), bias=bias)\n \nclass PALayer(nn.Module):\n def __init__(self, channel):\n super(PALayer, self).__init__()\n self.pa = nn.Sequential(\n nn.Conv2d(channel, channel // 8, 1, padding=0, bias=True),\n nn.ReLU(inplace=True),\n nn.Conv2d(channel // 8, 1, 1, padding=0, bias=True),\n nn.Sigmoid()\n )\n def forward(self, x):\n y = self.pa(x)\n return x * y\n\nclass CALayer(nn.Module):\n def __init__(self, channel):\n super(CALayer, self).__init__()\n self.avg_pool = nn.AdaptiveAvgPool2d(1)\n self.ca = nn.Sequential(\n nn.Conv2d(channel, channel // 8, 1, padding=0, bias=True),\n nn.ReLU(inplace=True),\n nn.Conv2d(channel // 8, channel, 1, padding=0, bias=True),\n nn.Sigmoid()\n )\n\n def forward(self, x):\n y = self.avg_pool(x)\n y = self.ca(y)\n return x * y\n\nclass Block(nn.Module):\n def __init__(self, conv, dim, kernel_size,):\n super(Block, self).__init__()\n self.conv1=conv(dim, dim, kernel_size, bias=True)\n self.act1=nn.ReLU(inplace=True)\n self.conv2=conv(dim,dim,kernel_size,bias=True)\n self.calayer=CALayer(dim)\n self.palayer=PALayer(dim)\n def forward(self, x):\n res=self.act1(self.conv1(x))\n res=res+x \n res=self.conv2(res)\n res=self.calayer(res)\n res=self.palayer(res)\n res += x \n return res\nclass Group(nn.Module):\n def __init__(self, conv, dim, kernel_size, blocks):\n super(Group, self).__init__()\n modules = [ Block(conv, dim, kernel_size) for _ in range(blocks)]\n modules.append(conv(dim, dim, kernel_size))\n self.gp = nn.Sequential(*modules)\n def forward(self, x):\n res = self.gp(x)\n res += x\n return res\n\nclass FFA(nn.Module):\n def __init__(self,gps,blocks,conv=default_conv):\n super(FFA, self).__init__()\n self.gps=gps\n self.dim=64\n kernel_size=3\n pre_process = [conv(3, self.dim, kernel_size)]\n assert self.gps==3\n self.g1= Group(conv, self.dim, kernel_size,blocks=blocks)\n self.g2= Group(conv, self.dim, kernel_size,blocks=blocks)\n self.g3= Group(conv, self.dim, kernel_size,blocks=blocks)\n self.ca=nn.Sequential(*[\n nn.AdaptiveAvgPool2d(1),\n nn.Conv2d(self.dim*self.gps,self.dim//16,1,padding=0),\n nn.ReLU(inplace=True),\n nn.Conv2d(self.dim//16, self.dim*self.gps, 1, padding=0, bias=True),\n nn.Sigmoid()\n ])\n self.palayer=PALayer(self.dim)\n\n post_precess = [\n conv(self.dim, self.dim, kernel_size),\n conv(self.dim, 3, kernel_size)]\n\n self.pre = nn.Sequential(*pre_process)\n self.post = nn.Sequential(*post_precess)\n\n def forward(self, x1):\n x = self.pre(x1)\n res1=self.g1(x)\n res2=self.g2(res1)\n res3=self.g3(res2)\n w=self.ca(torch.cat([res1,res2,res3],dim=1))\n w=w.view(-1,self.gps,self.dim)[:,:,:,None,None]\n out=w[:,0,::]*res1+w[:,1,::]*res2+w[:,2,::]*res3\n out=self.palayer(out)\n x=self.post(out)\n return x + x1\nif __name__ == \"__main__\":\n net=FFA(gps=3,blocks=19)\n print(net)\n</code></pre>\n<ol start=\"2\">\n<li>\n<code>Modified code</code> that generates the error.</li>\n</ol>\n<pre><code class=\"lang-auto\">import torch.nn as nn\nimport torch\n\ndef default_conv(in_channels, out_channels, kernel_size, bias=True):\n return nn.Conv2d(in_channels, out_channels, kernel_size,padding=(kernel_size//2), bias=bias)\n \nclass PALayer(nn.Module):\n def __init__(self, channel):\n super(PALayer, self).__init__()\n self.pa = nn.Sequential(\n nn.Conv2d(channel, channel // 8, 1, padding=0, bias=True),\n nn.ReLU(inplace=True),\n nn.Conv2d(channel // 8, 1, 1, padding=0, bias=True),\n nn.Sigmoid()\n )\n def forward(self, x):\n y = self.pa(x)\n return x * y\n\nclass CALayer(nn.Module):\n def __init__(self, channel):\n super(CALayer, self).__init__()\n self.avg_pool = nn.AdaptiveAvgPool2d(1)\n self.ca = nn.Sequential(\n nn.Conv2d(channel, channel // 8, 1, padding=0, bias=True),\n nn.ReLU(inplace=True),\n nn.Conv2d(channel // 8, channel, 1, padding=0, bias=True),\n nn.Sigmoid()\n )\n\n def forward(self, x):\n y = self.avg_pool(x)\n y = self.ca(y)\n return x * y\n\nclass Block(nn.Module):\n def __init__(self, conv, dim, kernel_size,):\n super(Block, self).__init__()\n self.conv1=conv(dim, dim, kernel_size, bias=True)\n self.act1=nn.ReLU(inplace=True)\n self.conv2=conv(dim,dim,kernel_size,bias=True)\n self.calayer=CALayer(dim)\n self.palayer=PALayer(dim)\n def forward(self, x):\n res=self.act1(self.conv1(x))\n res=res+x \n res=self.conv2(res)\n res=self.calayer(res)\n res=self.palayer(res)\n res += x \n return res\nclass Group(nn.Module):\n def __init__(self, conv, dim, kernel_size, blocks):\n super(Group, self).__init__()\n modules = [ Block(conv, dim, kernel_size) for _ in range(blocks)]\n modules.append(conv(dim, dim, kernel_size))\n self.gp = nn.Sequential(*modules)\n def forward(self, x):\n res = self.gp(x)\n res += x\n return res\n\nclass FFA(nn.Module):\n def __init__(self,gps,blocks,conv=default_conv):\n super(FFA, self).__init__()\n self.gps=gps\n self.dim=64\n kernel_size=3\n pre_process = [conv(3, self.dim, kernel_size)]\n assert self.gps==4\n self.g1= Group(conv, self.dim, kernel_size,blocks=blocks)\n self.g2= Group(conv, self.dim, kernel_size,blocks=blocks)\n self.g3= Group(conv, self.dim, kernel_size,blocks=blocks)\n self.g4= Group(conv, self.dim, kernel_size,blocks=blocks)\n self.ca=nn.Sequential(*[\n nn.AdaptiveAvgPool2d(1),\n nn.Conv2d(self.dim*self.gps,self.dim//16,1,padding=0),\n nn.ReLU(inplace=True),\n nn.Conv2d(self.dim//16, self.dim*self.gps, 1, padding=0, bias=True),\n nn.Sigmoid()\n ])\n self.palayer=PALayer(self.dim)\n\n post_precess = [\n conv(self.dim, self.dim, kernel_size),\n conv(self.dim, 3, kernel_size)]\n\n self.pre = nn.Sequential(*pre_process)\n self.post = nn.Sequential(*post_precess)\n\n def forward(self, x1):\n x = self.pre(x1)\n res1=self.g1(x)\n res2=self.g2(res1)\n res3=self.g3(res2)\n res4=self.g4(res3)\n w=self.ca(torch.cat([res1,res2,res3,res4],dim=1))\n w=w.view(-1,self.gps,self.dim)[:,:,:,None,None]\n out=w[:,0,::]*res1+w[:,1,::]*res2+w[:,2,::]*res3+w[:,3,::]*res4\n out=self.palayer(out)\n x=self.post(out)\n return x + x1\nif __name__ == \"__main__\":\n net=FFA(gps=4,blocks=19)\n print(net)\n</code></pre>",12 "post_number": 1,13 "post_type": 1,14 "posts_count": 1,15 "updated_at": "2022-12-20T11:09:03.741Z",16 "reply_count": 0,17 "reply_to_post_number": null,18 "quote_count": 0,19 "incoming_link_count": 23,20 "reads": 6,21 "readers_count": 5,22 "score": 116.2,23 "yours": false,24 "topic_id": 168676,25 "topic_slug": "runtimeerror-given-groups-1-weight-of-size-64-4-3-3-expected-input-2-3-240-240-to-have-4-channels-but-got-3-channels-instead",26 "display_username": "ATU ATU",27 "primary_group_name": null,28 "flair_name": null,29 "flair_url": null,30 "flair_bg_color": null,31 "flair_color": null,32 "flair_group_id": null,33 "badges_granted": [],34 "version": 6,35 "can_edit": false,36 "can_delete": false,37 "can_recover": false,38 "can_see_hidden_post": false,39 "can_wiki": false,40 "read": true,41 "user_title": null,42 "bookmarked": false,43 "actions_summary": [],44 "moderator": false,45 "admin": false,46 "staff": false,47 "user_id": 61928,48 "hidden": false,49 "trust_level": 1,50 "deleted_at": null,51 "user_deleted": false,52 "edit_reason": null,53 "can_view_edit_history": true,54 "wiki": false,55 "post_url": "/t/runtimeerror-given-groups-1-weight-of-size-64-4-3-3-expected-input-2-3-240-240-to-have-4-channels-but-got-3-channels-instead/168676/1",56 "can_accept_answer": false,57 "can_unaccept_answer": false,58 "accepted_answer": false,59 "topic_accepted_answer": null,60 "can_vote": false61 }62 ],63 "stream": [64 37976965 ]66 },67 "timeline_lookup": [68 [69 1,70 104171 ]72 ],73 "suggested_topics": [74 {75 "fancy_title": "Function selection for upsampling 1.5 times in gan",76 "id": 216973,77 "title": "Function selection for upsampling 1.5 times in gan",78 "slug": "function-selection-for-upsampling-1-5-times-in-gan",79 "posts_count": 2,80 "reply_count": 0,81 "highest_post_number": 2,82 "image_url": null,83 "created_at": "2025-02-21T03:31:16.600Z",84 "last_posted_at": "2025-02-22T02:47:27.869Z",85 "bumped": true,86 "bumped_at": "2025-02-22T02:47:27.869Z",87 "archetype": "regular",88 "unseen": false,89 "pinned": false,90 "unpinned": null,91 "visible": true,92 "closed": false,93 "archived": false,94 "bookmarked": null,95 "liked": null,96 "tags_descriptions": {},97 "like_count": 0,98 "views": 49,99 "category_id": 5,100 "featured_link": null,101 "has_accepted_answer": false,102 "posters": [103 {104 "extras": null,105 "description": "Original Poster",106 "user": {107 "id": 81867,108 "username": "2209262843",109 "name": "璐 璐",110 "avatar_template": "/user_avatar/discuss.pytorch.org/2209262843/{size}/74890_2.png",111 "trust_level": 1112 }113 },114 {115 "extras": "latest",116 "description": "Most Recent Poster",117 "user": {118 "id": 5995,119 "username": "Mohammad_Hassan_Soha",120 "name": "Mohammad Hassan Sohan Ajini",121 "avatar_template": "/user_avatar/discuss.pytorch.org/mohammad_hassan_soha/{size}/16288_2.png",122 "trust_level": 2123 }124 }125 ]126 },127 {128 "fancy_title": "My Loss function becomes 0 in 2nd epoch",129 "id": 221317,130 "title": "My Loss function becomes 0 in 2nd epoch",131 "slug": "my-loss-function-becomes-0-in-2nd-epoch",132 "posts_count": 2,133 "reply_count": 0,134 "highest_post_number": 2,135 "image_url": null,136 "created_at": "2025-07-07T05:55:40.826Z",137 "last_posted_at": "2025-07-08T22:59:30.226Z",138 "bumped": true,139 "bumped_at": "2025-07-08T22:59:30.226Z",140 "archetype": "regular",141 "unseen": false,142 "pinned": false,143 "unpinned": null,144 "visible": true,145 "closed": false,146 "archived": false,147 "bookmarked": null,148 "liked": null,149 "tags_descriptions": {},150 "like_count": 1,151 "views": 74,152 "category_id": 5,153 "featured_link": null,154 "has_accepted_answer": false,155 "posters": [156 {157 "extras": null,158 "description": "Original Poster",159 "user": {160 "id": 84964,161 "username": "syeda_raheen",162 "name": "Raheen",163 "avatar_template": "/letter_avatar_proxy/v4/letter/s/b19c9b/{size}.png",164 "trust_level": 0165 }166 },167 {168 "extras": "latest",169 "description": "Most Recent Poster",170 "user": {171 "id": 84484,172 "username": "Dhia-naouali",173 "name": "Dhia naouali",174 "avatar_template": "/user_avatar/discuss.pytorch.org/dhia-naouali/{size}/77193_2.png",175 "trust_level": 2176 }177 }178 ]179 },180 {181 "fancy_title": "Resnet101 encoder with U-Net decoder from scratch - tensor size issue",182 "id": 212738,183 "title": "Resnet101 encoder with U-Net decoder from scratch - tensor size issue",184 "slug": "resnet101-encoder-with-u-net-decoder-from-scratch-tensor-size-issue",185 "posts_count": 1,186 "reply_count": 0,187 "highest_post_number": 1,188 "image_url": null,189 "created_at": "2024-11-09T13:32:48.917Z",190 "last_posted_at": "2024-11-09T13:32:48.977Z",191 "bumped": true,192 "bumped_at": "2024-11-09T13:32:48.977Z",193 "archetype": "regular",194 "unseen": false,195 "pinned": false,196 "unpinned": null,197 "visible": true,198 "closed": false,199 "archived": false,200 "bookmarked": null,201 "liked": null,202 "tags_descriptions": {},203 "like_count": 0,204 "views": 186,205 "category_id": 5,206 "featured_link": null,207 "has_accepted_answer": false,208 "posters": [209 {210 "extras": "latest single",211 "description": "Original Poster, Most Recent Poster",212 "user": {213 "id": 80787,214 "username": "neen4",215 "name": "",216 "avatar_template": "/letter_avatar_proxy/v4/letter/n/4af34b/{size}.png",217 "trust_level": 1218 }219 }220 ]221 },222 {223 "fancy_title": "F.scaled_dot_product_attention get query @ key",224 "id": 215697,225 "title": "F.scaled_dot_product_attention get query @ key",226 "slug": "f-scaled-dot-product-attention-get-query-key",227 "posts_count": 1,228 "reply_count": 0,229 "highest_post_number": 1,230 "image_url": null,231 "created_at": "2025-01-22T05:03:27.120Z",232 "last_posted_at": "2025-01-22T05:03:27.155Z",233 "bumped": true,234 "bumped_at": "2025-01-22T05:03:27.155Z",235 "archetype": "regular",236 "unseen": false,237 "pinned": false,238 "unpinned": null,239 "visible": true,240 "closed": false,241 "archived": false,242 "bookmarked": null,243 "liked": null,244 "tags_descriptions": {},245 "like_count": 0,246 "views": 109,247 "category_id": 5,248 "featured_link": null,249 "has_accepted_answer": false,250 "posters": [251 {252 "extras": "latest single",253 "description": "Original Poster, Most Recent Poster",254 "user": {255 "id": 82230,256 "username": "b10901187",257 "name": "閎凱 鍾",258 "avatar_template": "/user_avatar/discuss.pytorch.org/b10901187/{size}/75232_2.png",259 "trust_level": 1260 }261 }262 ]263 },264 {265 "fancy_title": "Small loss in training, large loss after loading .pkl",266 "id": 221337,267 "title": "Small loss in training, large loss after loading .pkl",268 "slug": "small-loss-in-training-large-loss-after-loading-pkl",269 "posts_count": 2,270 "reply_count": 0,271 "highest_post_number": 2,272 "image_url": null,273 "created_at": "2025-07-07T15:12:07.628Z",274 "last_posted_at": "2025-07-07T16:29:25.481Z",275 "bumped": true,276 "bumped_at": "2025-07-07T16:29:25.481Z",277 "archetype": "regular",278 "unseen": false,279 "pinned": false,280 "unpinned": null,281 "visible": true,282 "closed": false,283 "archived": false,284 "bookmarked": null,285 "liked": null,286 "tags_descriptions": {},287 "like_count": 0,288 "views": 35,289 "category_id": 5,290 "featured_link": null,291 "has_accepted_answer": false,292 "posters": [293 {294 "extras": null,295 "description": "Original Poster",296 "user": {297 "id": 82512,298 "username": "paul188",299 "name": "Paul188",300 "avatar_template": "/user_avatar/discuss.pytorch.org/paul188/{size}/75490_2.png",301 "trust_level": 1302 }303 },304 {305 "extras": "latest",306 "description": "Most Recent Poster",307 "user": {308 "id": 3534,309 "username": "ptrblck",310 "name": "",311 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",312 "admin": true,313 "moderator": true,314 "trust_level": 2315 }316 }317 ]318 }319 ],320 "tags_descriptions": {},321 "fancy_title": "RuntimeError: Given groups=1, weight of size [64, 4, 3, 3], expected input[2, 3, 240, 240] to have 4 channels, but got 3 channels instead",322 "id": 168676,323 "title": "RuntimeError: Given groups=1, weight of size [64, 4, 3, 3], expected input[2, 3, 240, 240] to have 4 channels, but got 3 channels instead",324 "posts_count": 1,325 "created_at": "2022-12-20T03:58:44.241Z",326 "views": 284,327 "reply_count": 0,328 "like_count": 0,329 "last_posted_at": "2022-12-20T03:58:44.332Z",330 "visible": true,331 "closed": false,332 "archived": false,333 "has_summary": false,334 "archetype": "regular",335 "slug": "runtimeerror-given-groups-1-weight-of-size-64-4-3-3-expected-input-2-3-240-240-to-have-4-channels-but-got-3-channels-instead",336 "category_id": 5,337 "word_count": 1066,338 "deleted_at": null,339 "user_id": 61928,340 "featured_link": null,341 "pinned_globally": false,342 "pinned_at": null,343 "pinned_until": null,344 "image_url": null,345 "slow_mode_seconds": 0,346 "draft": null,347 "draft_key": "topic_168676",348 "draft_sequence": null,349 "unpinned": null,350 "pinned": false,351 "current_post_number": 1,352 "highest_post_number": 1,353 "deleted_by": null,354 "actions_summary": [355 {356 "id": 4,357 "count": 0,358 "hidden": false,359 "can_act": false360 },361 {362 "id": 8,363 "count": 0,364 "hidden": false,365 "can_act": false366 },367 {368 "id": 10,369 "count": 0,370 "hidden": false,371 "can_act": false372 },373 {374 "id": 7,375 "count": 0,376 "hidden": false,377 "can_act": false378 }379 ],380 "chunk_size": 20,381 "bookmarked": false,382 "topic_timer": null,383 "message_bus_last_id": 0,384 "participant_count": 1,385 "show_read_indicator": false,386 "thumbnails": null,387 "slow_mode_enabled_until": null,388 "can_vote": false,389 "vote_count": 0,390 "user_voted": false,391 "discourse_zendesk_plugin_zendesk_id": null,392 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",393 "details": {394 "can_edit": false,395 "notification_level": 1,396 "participants": [397 {398 "id": 61928,399 "username": "ATU_ATU",400 "name": "ATU ATU",401 "avatar_template": "/user_avatar/discuss.pytorch.org/atu_atu/{size}/46764_2.png",402 "post_count": 1,403 "primary_group_name": null,404 "flair_name": null,405 "flair_url": null,406 "flair_color": null,407 "flair_bg_color": null,408 "flair_group_id": null,409 "trust_level": 1410 }411 ],412 "created_by": {413 "id": 61928,414 "username": "ATU_ATU",415 "name": "ATU ATU",416 "avatar_template": "/user_avatar/discuss.pytorch.org/atu_atu/{size}/46764_2.png"417 },418 "last_poster": {419 "id": 61928,420 "username": "ATU_ATU",421 "name": "ATU ATU",422 "avatar_template": "/user_avatar/discuss.pytorch.org/atu_atu/{size}/46764_2.png"423 }424 },425 "bookmarks": []426 },427 {428 "post_stream": {429 "posts": [430 {431 "id": 379691,432 "name": "Miquel Espinosa",433 "username": "Miquel_Espinosa",434 "avatar_template": "/user_avatar/discuss.pytorch.org/miquel_espinosa/{size}/47180_2.png",435 "created_at": "2022-12-19T12:59:57.452Z",436 "cooked": "<p>Is there any way of combining an <code>IterDataPipe</code> dataset with DDP?<br>\nI have tried to convert my IterDataPipe to Map-style dataset with <code>to_map_datapipe()</code> but without success.<br>\nAlso, I am not sure if there are better ways to do this.</p>\n<p>Thanks</p>",437 "post_number": 1,438 "post_type": 1,439 "posts_count": 3,440 "updated_at": "2022-12-19T13:00:53.777Z",441 "reply_count": 1,442 "reply_to_post_number": null,443 "quote_count": 0,444 "incoming_link_count": 88,445 "reads": 12,446 "readers_count": 11,447 "score": 432.4,448 "yours": false,449 "topic_id": 168629,450 "topic_slug": "iterdatapipe-and-ddp",451 "display_username": "Miquel Espinosa",452 "primary_group_name": null,453 "flair_name": null,454 "flair_url": null,455 "flair_bg_color": null,456 "flair_color": null,457 "flair_group_id": null,458 "badges_granted": [],459 "version": 1,460 "can_edit": false,461 "can_delete": false,462 "can_recover": false,463 "can_see_hidden_post": false,464 "can_wiki": false,465 "read": true,466 "user_title": null,467 "bookmarked": false,468 "actions_summary": [],469 "moderator": false,470 "admin": false,471 "staff": false,472 "user_id": 53692,473 "hidden": false,474 "trust_level": 2,475 "deleted_at": null,476 "user_deleted": false,477 "edit_reason": null,478 "can_view_edit_history": true,479 "wiki": false,480 "post_url": "/t/iterdatapipe-and-ddp/168629/1",481 "can_accept_answer": false,482 "can_unaccept_answer": false,483 "accepted_answer": false,484 "topic_accepted_answer": null,485 "can_vote": false486 },487 {488 "id": 379733,489 "name": "Erjia",490 "username": "ejguan",491 "avatar_template": "/letter_avatar_proxy/v4/letter/e/5f8ce5/{size}.png",492 "created_at": "2022-12-19T20:57:52.279Z",493 "cooked": "<aside class=\"quote no-group\" data-username=\"Miquel_Espinosa\" data-post=\"1\" data-topic=\"168629\">\n<div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img loading=\"lazy\" alt=\"\" width=\"24\" height=\"24\" src=\"https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/miquel_espinosa/48/47180_2.png\" class=\"avatar\"> Miquel_Espinosa:</div>\n<blockquote>\n<p>Is there any way of combining an <code>IterDataPipe</code> dataset with DDP?</p>\n</blockquote>\n</aside>\n<p>Could you please elaborate on it?</p>",494 "post_number": 2,495 "post_type": 1,496 "posts_count": 3,497 "updated_at": "2022-12-19T20:57:52.279Z",498 "reply_count": 0,499 "reply_to_post_number": null,500 "quote_count": 1,501 "incoming_link_count": 0,502 "reads": 13,503 "readers_count": 12,504 "score": 2.6,505 "yours": false,506 "topic_id": 168629,507 "topic_slug": "iterdatapipe-and-ddp",508 "display_username": "Erjia",509 "primary_group_name": null,510 "flair_name": null,511 "flair_url": null,512 "flair_bg_color": null,513 "flair_color": null,514 "flair_group_id": null,515 "badges_granted": [],516 "version": 1,517 "can_edit": false,518 "can_delete": false,519 "can_recover": false,520 "can_see_hidden_post": false,521 "can_wiki": false,522 "read": true,523 "user_title": null,524 "bookmarked": false,525 "actions_summary": [],526 "moderator": false,527 "admin": false,528 "staff": false,529 "user_id": 37796,530 "hidden": false,531 "trust_level": 2,532 "deleted_at": null,533 "user_deleted": false,534 "edit_reason": null,535 "can_view_edit_history": true,536 "wiki": false,537 "post_url": "/t/iterdatapipe-and-ddp/168629/2",538 "can_accept_answer": false,539 "can_unaccept_answer": false,540 "accepted_answer": false,541 "topic_accepted_answer": null542 },543 {544 "id": 379809,545 "name": "Miquel Espinosa",546 "username": "Miquel_Espinosa",547 "avatar_template": "/user_avatar/discuss.pytorch.org/miquel_espinosa/{size}/47180_2.png",548 "created_at": "2022-12-20T10:19:22.317Z",549 "cooked": "<p>In the documentation it seems that using <code>torch.utils.data.distributed.DistributedSampler</code> is not compatible with an Iter-style dataset. I was just wondering if there is any way of making it compatible.<br>\nSome people have suggested some <a href=\"https://discuss.pytorch.org/t/iterable-pytorch-dataset-with-multiple-workers/135475/3\">solutions</a> when using multiple workers in <code>IterDataPipes</code>.</p>",550 "post_number": 3,551 "post_type": 1,552 "posts_count": 3,553 "updated_at": "2022-12-20T10:19:22.317Z",554 "reply_count": 0,555 "reply_to_post_number": null,556 "quote_count": 0,557 "incoming_link_count": 4,558 "reads": 11,559 "readers_count": 10,560 "score": 22.2,561 "yours": false,562 "topic_id": 168629,563 "topic_slug": "iterdatapipe-and-ddp",564 "display_username": "Miquel Espinosa",565 "primary_group_name": null,566 "flair_name": null,567 "flair_url": null,568 "flair_bg_color": null,569 "flair_color": null,570 "flair_group_id": null,571 "badges_granted": [],572 "version": 1,573 "can_edit": false,574 "can_delete": false,575 "can_recover": false,576 "can_see_hidden_post": false,577 "can_wiki": false,578 "link_counts": [579 {580 "url": "https://discuss.pytorch.org/t/iterable-pytorch-dataset-with-multiple-workers/135475/3",581 "internal": true,582 "reflection": false,583 "title": "Iterable pytorch dataset with multiple workers",584 "clicks": 43585 }586 ],587 "read": true,588 "user_title": null,589 "bookmarked": false,590 "actions_summary": [],591 "moderator": false,592 "admin": false,593 "staff": false,594 "user_id": 53692,595 "hidden": false,596 "trust_level": 2,597 "deleted_at": null,598 "user_deleted": false,599 "edit_reason": null,600 "can_view_edit_history": true,601 "wiki": false,602 "post_url": "/t/iterdatapipe-and-ddp/168629/3",603 "can_accept_answer": false,604 "can_unaccept_answer": false,605 "accepted_answer": false,606 "topic_accepted_answer": null607 }608 ],609 "stream": [610 379691,611 379733,612 379809613 ]614 },615 "timeline_lookup": [616 [617 1,618 1041619 ],620 [621 3,622 1040623 ]624 ],625 "suggested_topics": [626 {627 "fancy_title": "How to load a large text file into datasets for pretraining llm",628 "id": 214357,629 "title": "How to load a large text file into datasets for pretraining llm",630 "slug": "how-to-load-a-large-text-file-into-datasets-for-pretraining-llm",631 "posts_count": 3,632 "reply_count": 1,633 "highest_post_number": 3,634 "image_url": null,635 "created_at": "2024-12-18T09:53:07.657Z",636 "last_posted_at": "2024-12-19T04:27:59.983Z",637 "bumped": true,638 "bumped_at": "2024-12-19T04:27:59.983Z",639 "archetype": "regular",640 "unseen": false,641 "pinned": false,642 "unpinned": null,643 "visible": true,644 "closed": false,645 "archived": false,646 "bookmarked": null,647 "liked": null,648 "tags_descriptions": {},649 "like_count": 1,650 "views": 195,651 "category_id": 37,652 "featured_link": null,653 "has_accepted_answer": false,654 "posters": [655 {656 "extras": "latest",657 "description": "Original Poster, Most Recent Poster",658 "user": {659 "id": 50549,660 "username": "jinooooo",661 "name": "Jino Rohit",662 "avatar_template": "/user_avatar/discuss.pytorch.org/jinooooo/{size}/72578_2.png",663 "trust_level": 1664 }665 },666 {667 "extras": null,668 "description": "Frequent Poster",669 "user": {670 "id": 3534,671 "username": "ptrblck",672 "name": "",673 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",674 "admin": true,675 "moderator": true,676 "trust_level": 2677 }678 }679 ]680 },681 {682 "fancy_title": "How to deal with having multiple images per subject for just one of my inputs while only having one image per subject for other inputs?",683 "id": 215835,684 "title": "How to deal with having multiple images per subject for just one of my inputs while only having one image per subject for other inputs?",685 "slug": "how-to-deal-with-having-multiple-images-per-subject-for-just-one-of-my-inputs-while-only-having-one-image-per-subject-for-other-inputs",686 "posts_count": 3,687 "reply_count": 1,688 "highest_post_number": 3,689 "image_url": null,690 "created_at": "2025-01-24T20:18:22.860Z",691 "last_posted_at": "2025-01-30T21:06:57.311Z",692 "bumped": true,693 "bumped_at": "2025-01-30T21:06:57.311Z",694 "archetype": "regular",695 "unseen": false,696 "pinned": false,697 "unpinned": null,698 "visible": true,699 "closed": false,700 "archived": false,701 "bookmarked": null,702 "liked": null,703 "tags_descriptions": {},704 "like_count": 1,705 "views": 61,706 "category_id": 37,707 "featured_link": null,708 "has_accepted_answer": false,709 "posters": [710 {711 "extras": "latest",712 "description": "Original Poster, Most Recent Poster",713 "user": {714 "id": 82298,715 "username": "jaykay",716 "name": null,717 "avatar_template": "/letter_avatar_proxy/v4/letter/j/54ee81/{size}.png",718 "trust_level": 1719 }720 },721 {722 "extras": null,723 "description": "Frequent Poster",724 "user": {725 "id": 18088,726 "username": "KFrank",727 "name": "K. Frank",728 "avatar_template": "/letter_avatar_proxy/v4/letter/k/ecb155/{size}.png",729 "trust_level": 2730 }731 }732 ]733 },734 {735 "fancy_title": "[Question] How to Parallelizing the Loading of Serialized Tensor Files?",736 "id": 213385,737 "title": "[Question] How to Parallelizing the Loading of Serialized Tensor Files?",738 "slug": "question-how-to-parallelizing-the-loading-of-serialized-tensor-files",739 "posts_count": 1,740 "reply_count": 0,741 "highest_post_number": 1,742 "image_url": null,743 "created_at": "2024-11-24T21:46:02.560Z",744 "last_posted_at": "2024-11-24T21:46:02.610Z",745 "bumped": true,746 "bumped_at": "2024-11-24T21:46:02.610Z",747 "archetype": "regular",748 "unseen": false,749 "pinned": false,750 "unpinned": null,751 "visible": true,752 "closed": false,753 "archived": false,754 "bookmarked": null,755 "liked": null,756 "tags_descriptions": {},757 "like_count": 1,758 "views": 89,759 "category_id": 37,760 "featured_link": null,761 "has_accepted_answer": false,762 "posters": [763 {764 "extras": "latest single",765 "description": "Original Poster, Most Recent Poster",766 "user": {767 "id": 81105,768 "username": "HyperHyper",769 "name": "HyperHyper",770 "avatar_template": "/user_avatar/discuss.pytorch.org/hyperhyper/{size}/74168_2.png",771 "trust_level": 1772 }773 }774 ]775 },776 {777 "fancy_title": "GPU utilization at 5% when using HDF5 dataloader",778 "id": 214125,779 "title": "GPU utilization at 5% when using HDF5 dataloader",780 "slug": "gpu-utilization-at-5-when-using-hdf5-dataloader",781 "posts_count": 1,782 "reply_count": 0,783 "highest_post_number": 1,784 "image_url": "https://discuss.pytorch.org/uploads/default/optimized/3X/b/e/be5d516dc841a152218e9fa106b86cfac4176b3a_2_1024x401.png",785 "created_at": "2024-12-11T21:06:54.680Z",786 "last_posted_at": "2024-12-11T21:06:54.789Z",787 "bumped": true,788 "bumped_at": "2024-12-11T21:09:10.878Z",789 "archetype": "regular",790 "unseen": false,791 "pinned": false,792 "unpinned": null,793 "visible": true,794 "closed": false,795 "archived": false,796 "bookmarked": null,797 "liked": null,798 "tags_descriptions": {},799 "like_count": 0,800 "views": 133,801 "category_id": 37,802 "featured_link": null,803 "has_accepted_answer": false,804 "posters": [805 {806 "extras": "latest single",807 "description": "Original Poster, Most Recent Poster",808 "user": {809 "id": 81458,810 "username": "radon_me",811 "name": "",812 "avatar_template": "/user_avatar/discuss.pytorch.org/radon_me/{size}/74477_2.png",813 "trust_level": 0814 }815 }816 ]817 },818 {819 "fancy_title": "Why does IterableDataset and DataLoader cause issues with training metrics?",820 "id": 216360,821 "title": "Why does IterableDataset and DataLoader cause issues with training metrics?",822 "slug": "why-does-iterabledataset-and-dataloader-cause-issues-with-training-metrics",823 "posts_count": 4,824 "reply_count": 1,825 "highest_post_number": 4,826 "image_url": null,827 "created_at": "2025-02-07T12:27:54.150Z",828 "last_posted_at": "2025-02-10T11:46:55.533Z",829 "bumped": true,830 "bumped_at": "2025-02-10T11:46:55.533Z",831 "archetype": "regular",832 "unseen": false,833 "pinned": false,834 "unpinned": null,835 "visible": true,836 "closed": false,837 "archived": false,838 "bookmarked": null,839 "liked": null,840 "tags_descriptions": {},841 "like_count": 0,842 "views": 108,843 "category_id": 37,844 "featured_link": null,845 "has_accepted_answer": true,846 "posters": [847 {848 "extras": "latest",849 "description": "Original Poster, Most Recent Poster, Accepted Answer",850 "user": {851 "id": 82544,852 "username": "saff",853 "name": "",854 "avatar_template": "/user_avatar/discuss.pytorch.org/saff/{size}/75527_2.png",855 "trust_level": 1856 }857 },858 {859 "extras": null,860 "description": "Frequent Poster",861 "user": {862 "id": 3534,863 "username": "ptrblck",864 "name": "",865 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",866 "admin": true,867 "moderator": true,868 "trust_level": 2869 }870 }871 ]872 }873 ],874 "tags_descriptions": {},875 "fancy_title": "IterDataPipe and DDP",876 "id": 168629,877 "title": "IterDataPipe and DDP",878 "posts_count": 3,879 "created_at": "2022-12-19T12:59:57.370Z",880 "views": 727,881 "reply_count": 0,882 "like_count": 0,883 "last_posted_at": "2022-12-20T10:19:22.317Z",884 "visible": true,885 "closed": false,886 "archived": false,887 "has_summary": false,888 "archetype": "regular",889 "slug": "iterdatapipe-and-ddp",890 "category_id": 37,891 "word_count": 123,892 "deleted_at": null,893 "user_id": 53692,894 "featured_link": null,895 "pinned_globally": false,896 "pinned_at": null,897 "pinned_until": null,898 "image_url": null,899 "slow_mode_seconds": 0,900 "draft": null,901 "draft_key": "topic_168629",902 "draft_sequence": null,903 "unpinned": null,904 "pinned": false,905 "current_post_number": 1,906 "highest_post_number": 3,907 "deleted_by": null,908 "actions_summary": [909 {910 "id": 4,911 "count": 0,912 "hidden": false,913 "can_act": false914 },915 {916 "id": 8,917 "count": 0,918 "hidden": false,919 "can_act": false920 },921 {922 "id": 10,923 "count": 0,924 "hidden": false,925 "can_act": false926 },927 {928 "id": 7,929 "count": 0,930 "hidden": false,931 "can_act": false932 }933 ],934 "chunk_size": 20,935 "bookmarked": false,936 "topic_timer": null,937 "message_bus_last_id": 0,938 "participant_count": 2,939 "show_read_indicator": false,940 "thumbnails": null,941 "slow_mode_enabled_until": null,942 "can_vote": false,943 "vote_count": 0,944 "user_voted": false,945 "discourse_zendesk_plugin_zendesk_id": null,946 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",947 "details": {948 "can_edit": false,949 "notification_level": 1,950 "participants": [951 {952 "id": 53692,953 "username": "Miquel_Espinosa",954 "name": "Miquel Espinosa",955 "avatar_template": "/user_avatar/discuss.pytorch.org/miquel_espinosa/{size}/47180_2.png",956 "post_count": 2,957 "primary_group_name": null,958 "flair_name": null,959 "flair_url": null,960 "flair_color": null,961 "flair_bg_color": null,962 "flair_group_id": null,963 "trust_level": 2964 },965 {966 "id": 37796,967 "username": "ejguan",968 "name": "Erjia",969 "avatar_template": "/letter_avatar_proxy/v4/letter/e/5f8ce5/{size}.png",970 "post_count": 1,971 "primary_group_name": null,972 "flair_name": null,973 "flair_url": null,974 "flair_color": null,975 "flair_bg_color": null,976 "flair_group_id": null,977 "trust_level": 2978 }979 ],980 "created_by": {981 "id": 53692,982 "username": "Miquel_Espinosa",983 "name": "Miquel Espinosa",984 "avatar_template": "/user_avatar/discuss.pytorch.org/miquel_espinosa/{size}/47180_2.png"985 },986 "last_poster": {987 "id": 53692,988 "username": "Miquel_Espinosa",989 "name": "Miquel Espinosa",990 "avatar_template": "/user_avatar/discuss.pytorch.org/miquel_espinosa/{size}/47180_2.png"991 },992 "links": [993 {994 "url": "https://discuss.pytorch.org/t/iterable-pytorch-dataset-with-multiple-workers/135475/3",995 "title": "Iterable pytorch dataset with multiple workers",996 "internal": true,997 "attachment": false,998 "reflection": false,999 "clicks": 43,1000 "user_id": 53692,1001 "domain": "discuss.pytorch.org",1002 "root_domain": "pytorch.org"1003 }1004 ]1005 },1006 "bookmarks": []1007 },1008 {1009 "post_stream": {1010 "posts": [1011 {1012 "id": 379804,1013 "name": "Fredrik OLSSON",1014 "username": "Fredrik_OLSSON",1015 "avatar_template": "/user_avatar/discuss.pytorch.org/fredrik_olsson/{size}/33156_2.png",1016 "created_at": "2022-12-20T09:28:44.197Z",1017 "cooked": "<p>Hi,<br>\nI am very new to Pytorch. I am trying to set up a custom dataset where I want to use Unet and train it for semantic segmentation. I have 41 images and 41 label images where each label image may contain 5 different categories. The label images are png images with a specific grayscale for background, category 1, category 2 etc. How should I set up my annotation csv file?</p>\n<p>Thanks for any help.</p>",1018 "post_number": 1,1019 "post_type": 1,1020 "posts_count": 1,1021 "updated_at": "2022-12-20T09:28:44.197Z",1022 "reply_count": 0,1023 "reply_to_post_number": null,1024 "quote_count": 0,1025 "incoming_link_count": 32,1026 "reads": 4,1027 "readers_count": 3,1028 "score": 160.8,1029 "yours": false,1030 "topic_id": 168697,1031 "topic_slug": "how-to-set-up-annotation-cvs-file-when-each-label-image-contains-multiple-categories",1032 "display_username": "Fredrik OLSSON",1033 "primary_group_name": null,1034 "flair_name": null,1035 "flair_url": null,1036 "flair_bg_color": null,1037 "flair_color": null,1038 "flair_group_id": null,1039 "badges_granted": [],1040 "version": 1,1041 "can_edit": false,1042 "can_delete": false,1043 "can_recover": false,1044 "can_see_hidden_post": false,1045 "can_wiki": false,1046 "read": true,1047 "user_title": null,1048 "bookmarked": false,1049 "actions_summary": [],1050 "moderator": false,1051 "admin": false,1052 "staff": false,1053 "user_id": 61935,1054 "hidden": false,1055 "trust_level": 0,1056 "deleted_at": null,1057 "user_deleted": false,1058 "edit_reason": null,1059 "can_view_edit_history": true,1060 "wiki": false,1061 "post_url": "/t/how-to-set-up-annotation-cvs-file-when-each-label-image-contains-multiple-categories/168697/1",1062 "can_accept_answer": false,1063 "can_unaccept_answer": false,1064 "accepted_answer": false,1065 "topic_accepted_answer": null,1066 "can_vote": false1067 }1068 ],1069 "stream": [1070 3798041071 ]1072 },1073 "timeline_lookup": [1074 [1075 1,1076 10401077 ]1078 ],1079 "suggested_topics": [1080 {1081 "fancy_title": "Handling sparse batches to speed up training",1082 "id": 215034,1083 "title": "Handling sparse batches to speed up training",1084 "slug": "handling-sparse-batches-to-speed-up-training",1085 "posts_count": 3,1086 "reply_count": 2,1087 "highest_post_number": 3,1088 "image_url": null,1089 "created_at": "2025-01-06T15:37:26.418Z",1090 "last_posted_at": "2025-01-18T18:55:40.447Z",1091 "bumped": true,1092 "bumped_at": "2025-01-18T21:57:40.276Z",1093 "archetype": "regular",1094 "unseen": false,1095 "pinned": false,1096 "unpinned": null,1097 "visible": true,1098 "closed": false,1099 "archived": false,1100 "bookmarked": null,1101 "liked": null,1102 "tags_descriptions": {},1103 "like_count": 0,1104 "views": 160,1105 "category_id": 37,1106 "featured_link": null,1107 "has_accepted_answer": true,1108 "posters": [1109 {1110 "extras": "latest",1111 "description": "Original Poster, Most Recent Poster, Accepted Answer",1112 "user": {1113 "id": 81902,1114 "username": "czuczo_morales",1115 "name": "Czuczo Morales",1116 "avatar_template": "/letter_avatar_proxy/v4/letter/c/3ab097/{size}.png",1117 "trust_level": 01118 }1119 },1120 {1121 "extras": null,1122 "description": "Frequent Poster",1123 "user": {1124 "id": 76307,1125 "username": "Tlotlo_Oepeng",1126 "name": "Tlotlo Oepeng",1127 "avatar_template": "/user_avatar/discuss.pytorch.org/tlotlo_oepeng/{size}/70463_2.png",1128 "trust_level": 11129 }1130 }1131 ]1132 },1133 {1134 "fancy_title": "RuntimeError: result type Float can’t be cast to the desired output type Long—",1135 "id": 215625,1136 "title": "RuntimeError: result type Float can't be cast to the desired output type Long---",1137 "slug": "runtimeerror-result-type-float-cant-be-cast-to-the-desired-output-type-long",1138 "posts_count": 3,1139 "reply_count": 2,1140 "highest_post_number": 4,1141 "image_url": null,1142 "created_at": "2025-01-20T12:55:19.831Z",1143 "last_posted_at": "2025-01-24T06:58:11.891Z",1144 "bumped": true,1145 "bumped_at": "2025-01-24T06:58:11.891Z",1146 "archetype": "regular",1147 "unseen": false,1148 "pinned": false,1149 "unpinned": null,1150 "visible": true,1151 "closed": false,1152 "archived": false,1153 "bookmarked": null,1154 "liked": null,1155 "tags_descriptions": {},1156 "like_count": 0,1157 "views": 101,1158 "category_id": 37,1159 "featured_link": null,1160 "has_accepted_answer": false,1161 "posters": [1162 {1163 "extras": "latest",1164 "description": "Original Poster, Most Recent Poster",1165 "user": {1166 "id": 82195,1167 "username": "fuad47",1168 "name": "fuad",1169 "avatar_template": "/user_avatar/discuss.pytorch.org/fuad47/{size}/75208_2.png",1170 "trust_level": 01171 }1172 },1173 {1174 "extras": null,1175 "description": "Frequent Poster",1176 "user": {1177 "id": 3534,1178 "username": "ptrblck",1179 "name": "",1180 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",1181 "admin": true,1182 "moderator": true,1183 "trust_level": 21184 }1185 }1186 ]1187 },1188 {1189 "fancy_title": "Dataloader: transfer tensors to cuda stalls",1190 "id": 215696,1191 "title": "Dataloader: transfer tensors to cuda stalls",1192 "slug": "dataloader-transfer-tensors-to-cuda-stalls",1193 "posts_count": 1,1194 "reply_count": 0,1195 "highest_post_number": 1,1196 "image_url": null,1197 "created_at": "2025-01-22T04:55:54.911Z",1198 "last_posted_at": "2025-01-22T04:55:54.959Z",1199 "bumped": true,1200 "bumped_at": "2025-01-22T04:58:57.843Z",