Anurag1734/cuda-error-resolution-analysis
07
1[2 {3 "post_stream": {4 "posts": [5 {6 "id": 245183,7 "name": "Sam Lerman",8 "username": "Sam_Lerman",9 "avatar_template": "/user_avatar/discuss.pytorch.org/sam_lerman/{size}/37165_2.png",10 "created_at": "2020-11-18T19:08:58.931Z",11 "cooked": "<p>I know it’s trivial for a parameter vector, but when I iterate through the params in, for example:</p>\n<p><code>torch.cat([param.flatten() for param in self.policy.model.parameters()])</code></p>\n<p>setting requires_grad to false returns an error. How do I turn off the gradient for the individual param scalar weights?</p>",12 "post_number": 1,13 "post_type": 1,14 "posts_count": 8,15 "updated_at": "2020-11-18T19:08:58.931Z",16 "reply_count": 0,17 "reply_to_post_number": null,18 "quote_count": 0,19 "incoming_link_count": 8608,20 "reads": 136,21 "readers_count": 135,22 "score": 43012.2,23 "yours": false,24 "topic_id": 103303,25 "topic_slug": "how-to-turn-off-requires-grad-for-individual-params",26 "display_username": "Sam Lerman",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": 1,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": 30780,48 "hidden": false,49 "trust_level": 2,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/how-to-turn-off-requires-grad-for-individual-params/103303/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 "id": 245187,64 "name": "Alban D",65 "username": "albanD",66 "avatar_template": "/user_avatar/discuss.pytorch.org/alband/{size}/215_2.png",67 "created_at": "2020-11-18T19:16:02.216Z",68 "cooked": "<p>Hi,</p>\n<p>Could you share a code sample of what you’re trying to do exactly and what is the exact error please?</p>",69 "post_number": 2,70 "post_type": 1,71 "posts_count": 8,72 "updated_at": "2020-11-18T19:16:02.216Z",73 "reply_count": 0,74 "reply_to_post_number": null,75 "quote_count": 0,76 "incoming_link_count": 93,77 "reads": 136,78 "readers_count": 135,79 "score": 482.2,80 "yours": false,81 "topic_id": 103303,82 "topic_slug": "how-to-turn-off-requires-grad-for-individual-params",83 "display_username": "Alban D",84 "primary_group_name": null,85 "flair_name": null,86 "flair_url": null,87 "flair_bg_color": null,88 "flair_color": null,89 "flair_group_id": null,90 "badges_granted": [],91 "version": 1,92 "can_edit": false,93 "can_delete": false,94 "can_recover": false,95 "can_see_hidden_post": false,96 "can_wiki": false,97 "read": true,98 "user_title": "",99 "bookmarked": false,100 "actions_summary": [],101 "moderator": true,102 "admin": true,103 "staff": true,104 "user_id": 211,105 "hidden": false,106 "trust_level": 4,107 "deleted_at": null,108 "user_deleted": false,109 "edit_reason": null,110 "can_view_edit_history": true,111 "wiki": false,112 "post_url": "/t/how-to-turn-off-requires-grad-for-individual-params/103303/2",113 "can_accept_answer": false,114 "can_unaccept_answer": false,115 "accepted_answer": false,116 "topic_accepted_answer": null117 },118 {119 "id": 245191,120 "name": "Sam Lerman",121 "username": "Sam_Lerman",122 "avatar_template": "/user_avatar/discuss.pytorch.org/sam_lerman/{size}/37165_2.png",123 "created_at": "2020-11-18T19:21:17.381Z",124 "cooked": "<p>I have a <code>model</code> and I want to disable some of the weights, so I flatten the weights of the model in order to iterate through them and turn off <code>requires_grad</code> for a subset:</p>\n<pre><code class=\"lang-auto\">params = torch.cat([param.flatten() for param in model.parameters()])\nfor i, param in enumerate(params):\n if should_be_disabled[i]:\n param.requires_grad_(False)\n</code></pre>\n<p>This returns error that <code>requires_grad</code> can only be changed for leaves.</p>",125 "post_number": 3,126 "post_type": 1,127 "posts_count": 8,128 "updated_at": "2020-11-18T19:21:17.381Z",129 "reply_count": 1,130 "reply_to_post_number": null,131 "quote_count": 0,132 "incoming_link_count": 97,133 "reads": 136,134 "readers_count": 135,135 "score": 517.2,136 "yours": false,137 "topic_id": 103303,138 "topic_slug": "how-to-turn-off-requires-grad-for-individual-params",139 "display_username": "Sam Lerman",140 "primary_group_name": null,141 "flair_name": null,142 "flair_url": null,143 "flair_bg_color": null,144 "flair_color": null,145 "flair_group_id": null,146 "badges_granted": [],147 "version": 1,148 "can_edit": false,149 "can_delete": false,150 "can_recover": false,151 "can_see_hidden_post": false,152 "can_wiki": false,153 "read": true,154 "user_title": null,155 "bookmarked": false,156 "actions_summary": [],157 "moderator": false,158 "admin": false,159 "staff": false,160 "user_id": 30780,161 "hidden": false,162 "trust_level": 2,163 "deleted_at": null,164 "user_deleted": false,165 "edit_reason": null,166 "can_view_edit_history": true,167 "wiki": false,168 "post_url": "/t/how-to-turn-off-requires-grad-for-individual-params/103303/3",169 "can_accept_answer": false,170 "can_unaccept_answer": false,171 "accepted_answer": false,172 "topic_accepted_answer": null173 },174 {175 "id": 245193,176 "name": "Alban D",177 "username": "albanD",178 "avatar_template": "/user_avatar/discuss.pytorch.org/alband/{size}/215_2.png",179 "created_at": "2020-11-18T19:25:52.704Z",180 "cooked": "<p>Hi,</p>\n<p>Your first line actually concatenates all the parameters in a single big Tensor in a differentiable manner.<br>\nSo the new Tensor params requires_grad property is independent from the one in your parameters.<br>\nYou can disable gradients for the Tensors in <code>model.parameters()</code> though:</p>\n<pre><code class=\"lang-python\">for j, p in enumerate(model.parameters()):\n if should_be_disabled[j]:\n p.requires_grad_(False)\n</code></pre>",181 "post_number": 4,182 "post_type": 1,183 "posts_count": 8,184 "updated_at": "2020-11-18T19:25:52.704Z",185 "reply_count": 1,186 "reply_to_post_number": 3,187 "quote_count": 0,188 "incoming_link_count": 47,189 "reads": 124,190 "readers_count": 123,191 "score": 294.8,192 "yours": false,193 "topic_id": 103303,194 "topic_slug": "how-to-turn-off-requires-grad-for-individual-params",195 "display_username": "Alban D",196 "primary_group_name": null,197 "flair_name": null,198 "flair_url": null,199 "flair_bg_color": null,200 "flair_color": null,201 "flair_group_id": null,202 "badges_granted": [],203 "version": 1,204 "can_edit": false,205 "can_delete": false,206 "can_recover": false,207 "can_see_hidden_post": false,208 "can_wiki": false,209 "read": true,210 "user_title": "",211 "reply_to_user": {212 "id": 30780,213 "username": "Sam_Lerman",214 "name": "Sam Lerman",215 "avatar_template": "/user_avatar/discuss.pytorch.org/sam_lerman/{size}/37165_2.png"216 },217 "bookmarked": false,218 "actions_summary": [219 {220 "id": 2,221 "count": 2222 }223 ],224 "moderator": true,225 "admin": true,226 "staff": true,227 "user_id": 211,228 "hidden": false,229 "trust_level": 4,230 "deleted_at": null,231 "user_deleted": false,232 "edit_reason": null,233 "can_view_edit_history": true,234 "wiki": false,235 "post_url": "/t/how-to-turn-off-requires-grad-for-individual-params/103303/4",236 "can_accept_answer": false,237 "can_unaccept_answer": false,238 "accepted_answer": false,239 "topic_accepted_answer": null240 },241 {242 "id": 245194,243 "name": "Sam Lerman",244 "username": "Sam_Lerman",245 "avatar_template": "/user_avatar/discuss.pytorch.org/sam_lerman/{size}/37165_2.png",246 "created_at": "2020-11-18T19:27:25.364Z",247 "cooked": "<p>The problem is that <code>p</code> is a vector in your example and I would like to disable individual scalar weights within that vector. (A subset of them)</p>",248 "post_number": 5,249 "post_type": 1,250 "posts_count": 8,251 "updated_at": "2020-11-18T19:29:01.205Z",252 "reply_count": 1,253 "reply_to_post_number": 4,254 "quote_count": 0,255 "incoming_link_count": 19,256 "reads": 103,257 "readers_count": 102,258 "score": 120.6,259 "yours": false,260 "topic_id": 103303,261 "topic_slug": "how-to-turn-off-requires-grad-for-individual-params",262 "display_username": "Sam Lerman",263 "primary_group_name": null,264 "flair_name": null,265 "flair_url": null,266 "flair_bg_color": null,267 "flair_color": null,268 "flair_group_id": null,269 "badges_granted": [],270 "version": 1,271 "can_edit": false,272 "can_delete": false,273 "can_recover": false,274 "can_see_hidden_post": false,275 "can_wiki": false,276 "read": true,277 "user_title": null,278 "reply_to_user": {279 "id": 211,280 "username": "albanD",281 "name": "Alban D",282 "avatar_template": "/user_avatar/discuss.pytorch.org/alband/{size}/215_2.png"283 },284 "bookmarked": false,285 "actions_summary": [],286 "moderator": false,287 "admin": false,288 "staff": false,289 "user_id": 30780,290 "hidden": false,291 "trust_level": 2,292 "deleted_at": null,293 "user_deleted": false,294 "edit_reason": null,295 "can_view_edit_history": true,296 "wiki": false,297 "post_url": "/t/how-to-turn-off-requires-grad-for-individual-params/103303/5",298 "can_accept_answer": false,299 "can_unaccept_answer": false,300 "accepted_answer": false,301 "topic_accepted_answer": null302 },303 {304 "id": 245196,305 "name": "Alban D",306 "username": "albanD",307 "avatar_template": "/user_avatar/discuss.pytorch.org/alband/{size}/215_2.png",308 "created_at": "2020-11-18T19:38:12.486Z",309 "cooked": "<p>I am afraid that this is not possible. Tensors are “elementary” autograd objects. And so either the whole Tensor requires gradients or not.</p>\n<p>Note that you can just zero-out the gradients after they are computed if you just want to not have gradients for some entries in there. (you can even do that with a hook to make sure it happens every time a gradient is computed for that Tensor).</p>",310 "post_number": 6,311 "post_type": 1,312 "posts_count": 8,313 "updated_at": "2020-11-18T19:38:12.486Z",314 "reply_count": 1,315 "reply_to_post_number": 5,316 "quote_count": 0,317 "incoming_link_count": 31,318 "reads": 95,319 "readers_count": 94,320 "score": 179.0,321 "yours": false,322 "topic_id": 103303,323 "topic_slug": "how-to-turn-off-requires-grad-for-individual-params",324 "display_username": "Alban D",325 "primary_group_name": null,326 "flair_name": null,327 "flair_url": null,328 "flair_bg_color": null,329 "flair_color": null,330 "flair_group_id": null,331 "badges_granted": [],332 "version": 1,333 "can_edit": false,334 "can_delete": false,335 "can_recover": false,336 "can_see_hidden_post": false,337 "can_wiki": false,338 "read": true,339 "user_title": "",340 "reply_to_user": {341 "id": 30780,342 "username": "Sam_Lerman",343 "name": "Sam Lerman",344 "avatar_template": "/user_avatar/discuss.pytorch.org/sam_lerman/{size}/37165_2.png"345 },346 "bookmarked": false,347 "actions_summary": [],348 "moderator": true,349 "admin": true,350 "staff": true,351 "user_id": 211,352 "hidden": false,353 "trust_level": 4,354 "deleted_at": null,355 "user_deleted": false,356 "edit_reason": null,357 "can_view_edit_history": true,358 "wiki": false,359 "post_url": "/t/how-to-turn-off-requires-grad-for-individual-params/103303/6",360 "can_accept_answer": false,361 "can_unaccept_answer": false,362 "accepted_answer": false,363 "topic_accepted_answer": null364 },365 {366 "id": 245197,367 "name": "Sam Lerman",368 "username": "Sam_Lerman",369 "avatar_template": "/user_avatar/discuss.pytorch.org/sam_lerman/{size}/37165_2.png",370 "created_at": "2020-11-18T19:40:20.888Z",371 "cooked": "<p>That would still be good. Thanks! Could you provide an example of this please?</p>\n<p>My only concern is that I do three separate backwards passes for three separate loss terms, and I’m worried it’ll get convoluted because each one requires different gradients to be zeroed out.</p>",372 "post_number": 7,373 "post_type": 1,374 "posts_count": 8,375 "updated_at": "2020-11-18T19:40:20.888Z",376 "reply_count": 1,377 "reply_to_post_number": 6,378 "quote_count": 0,379 "incoming_link_count": 49,380 "reads": 76,381 "readers_count": 75,382 "score": 265.2,383 "yours": false,384 "topic_id": 103303,385 "topic_slug": "how-to-turn-off-requires-grad-for-individual-params",386 "display_username": "Sam Lerman",387 "primary_group_name": null,388 "flair_name": null,389 "flair_url": null,390 "flair_bg_color": null,391 "flair_color": null,392 "flair_group_id": null,393 "badges_granted": [],394 "version": 1,395 "can_edit": false,396 "can_delete": false,397 "can_recover": false,398 "can_see_hidden_post": false,399 "can_wiki": false,400 "read": true,401 "user_title": null,402 "reply_to_user": {403 "id": 211,404 "username": "albanD",405 "name": "Alban D",406 "avatar_template": "/user_avatar/discuss.pytorch.org/alband/{size}/215_2.png"407 },408 "bookmarked": false,409 "actions_summary": [],410 "moderator": false,411 "admin": false,412 "staff": false,413 "user_id": 30780,414 "hidden": false,415 "trust_level": 2,416 "deleted_at": null,417 "user_deleted": false,418 "edit_reason": null,419 "can_view_edit_history": true,420 "wiki": false,421 "post_url": "/t/how-to-turn-off-requires-grad-for-individual-params/103303/7",422 "can_accept_answer": false,423 "can_unaccept_answer": false,424 "accepted_answer": false,425 "topic_accepted_answer": null426 },427 {428 "id": 245201,429 "name": "Alban D",430 "username": "albanD",431 "avatar_template": "/user_avatar/discuss.pytorch.org/alband/{size}/215_2.png",432 "created_at": "2020-11-18T20:02:39.416Z",433 "cooked": "<p>Sure</p>\n<pre><code class=\"lang-python\">def get_hook(param_idx):\n def hook(grad):\n grad = grad.clone() # NEVER change the given grad inplace\n # Assumes 1D but can be generalized\n for i in grad.size(0):\n if should_be_disabled[param_idx][i]:\n grad[i] = 0\n return grad\n return hook\n\nfor j, p in enumerate(model.parameters()):\n p.register_hook(get_hook(j))\n \n</code></pre>",434 "post_number": 8,435 "post_type": 1,436 "posts_count": 8,437 "updated_at": "2020-11-18T20:02:39.416Z",438 "reply_count": 0,439 "reply_to_post_number": 7,440 "quote_count": 0,441 "incoming_link_count": 34,442 "reads": 67,443 "readers_count": 66,444 "score": 198.4,445 "yours": false,446 "topic_id": 103303,447 "topic_slug": "how-to-turn-off-requires-grad-for-individual-params",448 "display_username": "Alban D",449 "primary_group_name": null,450 "flair_name": null,451 "flair_url": null,452 "flair_bg_color": null,453 "flair_color": null,454 "flair_group_id": null,455 "badges_granted": [],456 "version": 1,457 "can_edit": false,458 "can_delete": false,459 "can_recover": false,460 "can_see_hidden_post": false,461 "can_wiki": false,462 "read": true,463 "user_title": "",464 "reply_to_user": {465 "id": 30780,466 "username": "Sam_Lerman",467 "name": "Sam Lerman",468 "avatar_template": "/user_avatar/discuss.pytorch.org/sam_lerman/{size}/37165_2.png"469 },470 "bookmarked": false,471 "actions_summary": [472 {473 "id": 2,474 "count": 1475 }476 ],477 "moderator": true,478 "admin": true,479 "staff": true,480 "user_id": 211,481 "hidden": false,482 "trust_level": 4,483 "deleted_at": null,484 "user_deleted": false,485 "edit_reason": null,486 "can_view_edit_history": true,487 "wiki": false,488 "post_url": "/t/how-to-turn-off-requires-grad-for-individual-params/103303/8",489 "can_accept_answer": false,490 "can_unaccept_answer": false,491 "accepted_answer": false,492 "topic_accepted_answer": null493 }494 ],495 "stream": [496 245183,497 245187,498 245191,499 245193,500 245194,501 245196,502 245197,503 245201504 ]505 },506 "timeline_lookup": [507 [508 1,509 1802510 ]511 ],512 "suggested_topics": [513 {514 "fancy_title": "[CPU] Train network using float 16?",515 "id": 213486,516 "title": "[CPU] Train network using float 16?",517 "slug": "cpu-train-network-using-float-16",518 "posts_count": 2,519 "reply_count": 2,520 "highest_post_number": 2,521 "image_url": null,522 "created_at": "2024-11-26T19:22:22.622Z",523 "last_posted_at": "2024-11-26T21:13:26.532Z",524 "bumped": true,525 "bumped_at": "2024-11-27T03:07:04.265Z",526 "archetype": "regular",527 "unseen": false,528 "pinned": false,529 "unpinned": null,530 "visible": true,531 "closed": false,532 "archived": false,533 "bookmarked": null,534 "liked": null,535 "tags_descriptions": {},536 "like_count": 1,537 "views": 457,538 "category_id": 1,539 "featured_link": null,540 "has_accepted_answer": true,541 "posters": [542 {543 "extras": null,544 "description": "Original Poster",545 "user": {546 "id": 81089,547 "username": "Aknw_Fen",548 "name": "Aknw Fen",549 "avatar_template": "/user_avatar/discuss.pytorch.org/aknw_fen/{size}/74156_2.png",550 "trust_level": 2551 }552 },553 {554 "extras": "latest",555 "description": "Most Recent Poster, Accepted Answer",556 "user": {557 "id": 3534,558 "username": "ptrblck",559 "name": "",560 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",561 "admin": true,562 "moderator": true,563 "trust_level": 2564 }565 }566 ]567 },568 {569 "fancy_title": "Issues with exporting Pytorch model as ONNX",570 "id": 216394,571 "title": "Issues with exporting Pytorch model as ONNX",572 "slug": "issues-with-exporting-pytorch-model-as-onnx",573 "posts_count": 2,574 "reply_count": 0,575 "highest_post_number": 2,576 "image_url": null,577 "created_at": "2025-02-08T07:17:05.792Z",578 "last_posted_at": "2025-02-12T22:06:03.976Z",579 "bumped": true,580 "bumped_at": "2025-02-12T22:06:03.976Z",581 "archetype": "regular",582 "unseen": false,583 "pinned": false,584 "unpinned": null,585 "visible": true,586 "closed": false,587 "archived": false,588 "bookmarked": null,589 "liked": null,590 "tags_descriptions": {},591 "like_count": 1,592 "views": 1467,593 "category_id": 1,594 "featured_link": null,595 "has_accepted_answer": false,596 "posters": [597 {598 "extras": null,599 "description": "Original Poster",600 "user": {601 "id": 82028,602 "username": "the-ml-bulldog",603 "name": "",604 "avatar_template": "/user_avatar/discuss.pytorch.org/the-ml-bulldog/{size}/75057_2.png",605 "trust_level": 1606 }607 },608 {609 "extras": "latest",610 "description": "Most Recent Poster",611 "user": {612 "id": 82649,613 "username": "onedeadmatch",614 "name": "dani",615 "avatar_template": "/user_avatar/discuss.pytorch.org/onedeadmatch/{size}/75627_2.png",616 "trust_level": 1617 }618 }619 ]620 },621 {622 "fancy_title": "Loaded pytorch model gives different results than originally trained model",623 "id": 216571,624 "title": "Loaded pytorch model gives different results than originally trained model",625 "slug": "loaded-pytorch-model-gives-different-results-than-originally-trained-model",626 "posts_count": 12,627 "reply_count": 9,628 "highest_post_number": 14,629 "image_url": null,630 "created_at": "2025-02-12T08:19:54.183Z",631 "last_posted_at": "2025-03-08T20:05:24.756Z",632 "bumped": true,633 "bumped_at": "2025-03-08T20:05:24.756Z",634 "archetype": "regular",635 "unseen": false,636 "pinned": false,637 "unpinned": null,638 "visible": true,639 "closed": false,640 "archived": false,641 "bookmarked": null,642 "liked": null,643 "tags_descriptions": {},644 "like_count": 1,645 "views": 669,646 "category_id": 1,647 "featured_link": null,648 "has_accepted_answer": false,649 "posters": [650 {651 "extras": "latest",652 "description": "Original Poster, Most Recent Poster",653 "user": {654 "id": 82640,655 "username": "Riggins",656 "name": "Tom",657 "avatar_template": "/letter_avatar_proxy/v4/letter/r/ce73a5/{size}.png",658 "trust_level": 1659 }660 },661 {662 "extras": null,663 "description": "Frequent Poster",664 "user": {665 "id": 82012,666 "username": "Ansh_Upadhyay",667 "name": "Ansh Upadhyay",668 "avatar_template": "/user_avatar/discuss.pytorch.org/ansh_upadhyay/{size}/75038_2.png",669 "trust_level": 1670 }671 },672 {673 "extras": null,674 "description": "Frequent Poster",675 "user": {676 "id": 3534,677 "username": "ptrblck",678 "name": "",679 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",680 "admin": true,681 "moderator": true,682 "trust_level": 2683 }684 }685 ]686 },687 {688 "fancy_title": "Problem with controlnet(sd-controlnet-canny)",689 "id": 216817,690 "title": "Problem with controlnet(sd-controlnet-canny)",691 "slug": "problem-with-controlnet-sd-controlnet-canny",692 "posts_count": 1,693 "reply_count": 0,694 "highest_post_number": 1,695 "image_url": null,696 "created_at": "2025-02-18T11:10:46.305Z",697 "last_posted_at": "2025-02-18T11:10:46.352Z",698 "bumped": true,699 "bumped_at": "2025-02-18T11:10:46.352Z",700 "archetype": "regular",701 "unseen": false,702 "pinned": false,703 "unpinned": null,704 "visible": true,705 "closed": false,706 "archived": false,707 "bookmarked": null,708 "liked": null,709 "tags_descriptions": {},710 "like_count": 0,711 "views": 59,712 "category_id": 1,713 "featured_link": null,714 "has_accepted_answer": false,715 "posters": [716 {717 "extras": "latest single",718 "description": "Original Poster, Most Recent Poster",719 "user": {720 "id": 82738,721 "username": "Dmitr",722 "name": "",723 "avatar_template": "/letter_avatar_proxy/v4/letter/d/13edae/{size}.png",724 "trust_level": 1725 }726 }727 ]728 },729 {730 "fancy_title": "Can I ask for feedback on a custom-built PyTorch (CUDA 12.8 / RTX 5070 Ti)?",731 "id": 218174,732 "title": "Can I ask for feedback on a custom-built PyTorch (CUDA 12.8 / RTX 5070 Ti)?",733 "slug": "can-i-ask-for-feedback-on-a-custom-built-pytorch-cuda-12-8-rtx-5070-ti",734 "posts_count": 3,735 "reply_count": 1,736 "highest_post_number": 3,737 "image_url": null,738 "created_at": "2025-03-23T16:37:54.914Z",739 "last_posted_at": "2025-03-23T17:21:47.469Z",740 "bumped": true,741 "bumped_at": "2025-03-23T17:21:47.469Z",742 "archetype": "regular",743 "unseen": false,744 "pinned": false,745 "unpinned": null,746 "visible": true,747 "closed": false,748 "archived": false,749 "bookmarked": null,750 "liked": null,751 "tags_descriptions": {},752 "like_count": 0,753 "views": 385,754 "category_id": 1,755 "featured_link": null,756 "has_accepted_answer": false,757 "posters": [758 {759 "extras": "latest",760 "description": "Original Poster, Most Recent Poster",761 "user": {762 "id": 83428,763 "username": "gradiuse",764 "name": "hcc1shot",765 "avatar_template": "/user_avatar/discuss.pytorch.org/gradiuse/{size}/76303_2.png",766 "trust_level": 0767 }768 },769 {770 "extras": null,771 "description": "Frequent Poster",772 "user": {773 "id": 3534,774 "username": "ptrblck",775 "name": "",776 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",777 "admin": true,778 "moderator": true,779 "trust_level": 2780 }781 }782 ]783 }784 ],785 "tags_descriptions": {},786 "fancy_title": "How to turn off requires_grad for individual params?",787 "id": 103303,788 "title": "How to turn off requires_grad for individual params?",789 "posts_count": 8,790 "created_at": "2020-11-18T19:08:58.864Z",791 "views": 9455,792 "reply_count": 5,793 "like_count": 3,794 "last_posted_at": "2020-11-18T20:02:39.416Z",795 "visible": true,796 "closed": false,797 "archived": false,798 "has_summary": false,799 "archetype": "regular",800 "slug": "how-to-turn-off-requires-grad-for-individual-params",801 "category_id": 1,802 "word_count": 394,803 "deleted_at": null,804 "user_id": 30780,805 "featured_link": null,806 "pinned_globally": false,807 "pinned_at": null,808 "pinned_until": null,809 "image_url": null,810 "slow_mode_seconds": 0,811 "draft": null,812 "draft_key": "topic_103303",813 "draft_sequence": null,814 "unpinned": null,815 "pinned": false,816 "current_post_number": 1,817 "highest_post_number": 8,818 "deleted_by": null,819 "actions_summary": [820 {821 "id": 4,822 "count": 0,823 "hidden": false,824 "can_act": false825 },826 {827 "id": 8,828 "count": 0,829 "hidden": false,830 "can_act": false831 },832 {833 "id": 10,834 "count": 0,835 "hidden": false,836 "can_act": false837 },838 {839 "id": 7,840 "count": 0,841 "hidden": false,842 "can_act": false843 }844 ],845 "chunk_size": 20,846 "bookmarked": false,847 "topic_timer": null,848 "message_bus_last_id": 0,849 "participant_count": 2,850 "show_read_indicator": false,851 "thumbnails": null,852 "slow_mode_enabled_until": null,853 "can_vote": false,854 "vote_count": 0,855 "user_voted": false,856 "discourse_zendesk_plugin_zendesk_id": null,857 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",858 "details": {859 "can_edit": false,860 "notification_level": 1,861 "participants": [862 {863 "id": 211,864 "username": "albanD",865 "name": "Alban D",866 "avatar_template": "/user_avatar/discuss.pytorch.org/alband/{size}/215_2.png",867 "post_count": 4,868 "primary_group_name": null,869 "flair_name": null,870 "flair_url": null,871 "flair_color": null,872 "flair_bg_color": null,873 "flair_group_id": null,874 "admin": true,875 "moderator": true,876 "trust_level": 4877 },878 {879 "id": 30780,880 "username": "Sam_Lerman",881 "name": "Sam Lerman",882 "avatar_template": "/user_avatar/discuss.pytorch.org/sam_lerman/{size}/37165_2.png",883 "post_count": 4,884 "primary_group_name": null,885 "flair_name": null,886 "flair_url": null,887 "flair_color": null,888 "flair_bg_color": null,889 "flair_group_id": null,890 "trust_level": 2891 }892 ],893 "created_by": {894 "id": 30780,895 "username": "Sam_Lerman",896 "name": "Sam Lerman",897 "avatar_template": "/user_avatar/discuss.pytorch.org/sam_lerman/{size}/37165_2.png"898 },899 "last_poster": {900 "id": 211,901 "username": "albanD",902 "name": "Alban D",903 "avatar_template": "/user_avatar/discuss.pytorch.org/alband/{size}/215_2.png"904 }905 },906 "bookmarks": []907 },908 {909 "post_stream": {910 "posts": [911 {912 "id": 245199,913 "name": "",914 "username": "Tomash",915 "avatar_template": "/letter_avatar_proxy/v4/letter/t/858c86/{size}.png",916 "created_at": "2020-11-18T19:52:27.886Z",917 "cooked": "<p>Hi guys,<br>\nI am trying to train model on a modified COCO database. During loading data to <code>dataloaders</code> (images and targets - code in the end of post) <code>htop</code> command shows me that I am running like 100 process and every one of it uses 60 GB of <code>VIRT</code> and about 40 GB of <code>RES</code>, but summary the <code>mem bar</code> shows only 50 GB/ 504 GB. How to understand it? How to be sure that I will not use to much memory?</p>\n<p>Can you look on my code if I am doing it alright?</p>\n<blockquote>\n<pre><code>class LoadDataset(Dataset):\ndef __init__(self): \n self.images = []\n self.targets = []\n \n img_path, ann_path = (\n \"path_to_images\",\n \"path_to_annotations_json\",\n )\n coco_ds = torchvision.datasets.CocoDetection(img_path, ann_path)\n for i in range(0, len(coco_ds)):\n img, ann = coco_ds[i]\n for a in ann:\n images, targets = collate(\n [img.copy(), img.copy()], [[a], [a]], coco_ds.coco\n )\n for t in targets:\n self.targets.append(t)\n for image in images:\n self.images.append(image)\n \ndef __len__(self):\n return len(self.images)\n\ndef __getitem__(self, idx):\n img = self.images[idx]\n target = self.targets[idx]\n \n return (\n img,\n target,\n )\n</code></pre>\n<p>and later in code: …</p>\n<p>train_loader = DataLoader(LoadDataset, batch_size=24, shuffle=True)</p>\n</blockquote>",918 "post_number": 1,919 "post_type": 1,920 "posts_count": 1,921 "updated_at": "2020-11-18T19:52:27.886Z",922 "reply_count": 0,923 "reply_to_post_number": null,924 "quote_count": 0,925 "incoming_link_count": 14,926 "reads": 5,927 "readers_count": 4,928 "score": 71.0,929 "yours": false,930 "topic_id": 103306,931 "topic_slug": "how-to-understand-memory-usage-with-pytorch",932 "display_username": "",933 "primary_group_name": null,934 "flair_name": null,935 "flair_url": null,936 "flair_bg_color": null,937 "flair_color": null,938 "flair_group_id": null,939 "badges_granted": [],940 "version": 1,941 "can_edit": false,942 "can_delete": false,943 "can_recover": false,944 "can_see_hidden_post": false,945 "can_wiki": false,946 "read": true,947 "user_title": null,948 "bookmarked": false,949 "actions_summary": [],950 "moderator": false,951 "admin": false,952 "staff": false,953 "user_id": 35504,954 "hidden": false,955 "trust_level": 1,956 "deleted_at": null,957 "user_deleted": false,958 "edit_reason": null,959 "can_view_edit_history": true,960 "wiki": false,961 "post_url": "/t/how-to-understand-memory-usage-with-pytorch/103306/1",962 "can_accept_answer": false,963 "can_unaccept_answer": false,964 "accepted_answer": false,965 "topic_accepted_answer": null,966 "can_vote": false967 }968 ],969 "stream": [970 245199971 ]972 },973 "timeline_lookup": [974 [975 1,976 1802977 ]978 ],979 "suggested_topics": [980 {981 "fancy_title": "Suggestion for ML approach to mimic FEM results?",982 "id": 213993,983 "title": "Suggestion for ML approach to mimic FEM results?",984 "slug": "suggestion-for-ml-approach-to-mimic-fem-results",985 "posts_count": 1,986 "reply_count": 0,987 "highest_post_number": 1,988 "image_url": null,989 "created_at": "2024-12-09T12:34:40.329Z",990 "last_posted_at": "2024-12-09T12:34:40.382Z",991 "bumped": true,992 "bumped_at": "2024-12-09T13:19:10.610Z",993 "archetype": "regular",994 "unseen": false,995 "pinned": false,996 "unpinned": null,997 "visible": true,998 "closed": false,999 "archived": false,1000 "bookmarked": null,1001 "liked": null,1002 "tags_descriptions": {},1003 "like_count": 0,1004 "views": 46,1005 "category_id": 1,1006 "featured_link": null,1007 "has_accepted_answer": false,1008 "posters": [1009 {1010 "extras": "latest single",1011 "description": "Original Poster, Most Recent Poster",1012 "user": {1013 "id": 81403,1014 "username": "LainuUrdin",1015 "name": "Laino Urdin",1016 "avatar_template": "/user_avatar/discuss.pytorch.org/lainuurdin/{size}/74437_2.png",1017 "trust_level": 01018 }1019 }1020 ]1021 },1022 {1023 "fancy_title": "Jit trace tuple construct and unpack; can’t keep track of inputs",1024 "id": 215323,1025 "title": "Jit trace tuple construct and unpack; can't keep track of inputs",1026 "slug": "jit-trace-tuple-construct-and-unpack-cant-keep-track-of-inputs",1027 "posts_count": 1,1028 "reply_count": 0,1029 "highest_post_number": 1,1030 "image_url": "https://discuss.pytorch.org/uploads/default/original/3X/b/8/b8026c9f675e3298109d3cea395e8ff583233b7c.png",1031 "created_at": "2025-01-13T11:36:10.798Z",1032 "last_posted_at": "2025-01-13T11:36:10.855Z",1033 "bumped": true,1034 "bumped_at": "2025-01-13T11:41:25.178Z",1035 "archetype": "regular",1036 "unseen": false,1037 "pinned": false,1038 "unpinned": null,1039 "visible": true,1040 "closed": false,1041 "archived": false,1042 "bookmarked": null,1043 "liked": null,1044 "tags_descriptions": {},1045 "like_count": 0,1046 "views": 34,1047 "category_id": 1,1048 "featured_link": null,1049 "has_accepted_answer": false,1050 "posters": [1051 {1052 "extras": "latest single",1053 "description": "Original Poster, Most Recent Poster",1054 "user": {1055 "id": 82053,1056 "username": "Mohamed_Hassan1",1057 "name": "Mohamed Hassan",1058 "avatar_template": "/user_avatar/discuss.pytorch.org/mohamed_hassan1/{size}/75076_2.png",1059 "trust_level": 11060 }1061 }1062 ]1063 },1064 {1065 "fancy_title": "VGG16 performs poorly in training process",1066 "id": 215772,1067 "title": "VGG16 performs poorly in training process",1068 "slug": "vgg16-performs-poorly-in-training-process",1069 "posts_count": 2,1070 "reply_count": 0,1071 "highest_post_number": 2,1072 "image_url": null,1073 "created_at": "2025-01-23T12:36:03.463Z",1074 "last_posted_at": "2025-01-26T14:02:35.861Z",1075 "bumped": true,1076 "bumped_at": "2025-01-26T14:02:35.861Z",1077 "archetype": "regular",1078 "unseen": false,1079 "pinned": false,1080 "unpinned": null,1081 "visible": true,1082 "closed": false,1083 "archived": false,1084 "bookmarked": null,1085 "liked": null,1086 "tags_descriptions": {},1087 "like_count": 0,1088 "views": 118,1089 "category_id": 1,1090 "featured_link": null,1091 "has_accepted_answer": false,1092 "posters": [1093 {1094 "extras": "latest single",1095 "description": "Original Poster, Most Recent Poster",1096 "user": {1097 "id": 82264,1098 "username": "Becker",1099 "name": "",1100 "avatar_template": "/user_avatar/discuss.pytorch.org/becker/{size}/75259_2.png",1101 "trust_level": 11102 }1103 }1104 ]1105 },1106 {1107 "fancy_title": "RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation torch version 2.0.0",1108 "id": 216978,1109 "title": "RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation torch version 2.0.0",1110 "slug": "runtimeerror-one-of-the-variables-needed-for-gradient-computation-has-been-modified-by-an-inplace-operation-torch-version-2-0-0",1111 "posts_count": 2,1112 "reply_count": 0,1113 "highest_post_number": 2,1114 "image_url": null,1115 "created_at": "2025-02-21T07:01:27.534Z",1116 "last_posted_at": "2025-02-21T17:57:30.658Z",1117 "bumped": true,1118 "bumped_at": "2025-02-21T17:57:30.658Z",1119 "archetype": "regular",1120 "unseen": false,1121 "pinned": false,1122 "unpinned": null,1123 "visible": true,1124 "closed": false,1125 "archived": false,1126 "bookmarked": null,1127 "liked": null,1128 "tags_descriptions": {},1129 "like_count": 0,1130 "views": 23,1131 "category_id": 1,1132 "featured_link": null,1133 "has_accepted_answer": false,1134 "posters": [1135 {1136 "extras": null,1137 "description": "Original Poster",1138 "user": {1139 "id": 82832,1140 "username": "hj_feng",1141 "name": "hj feng",1142 "avatar_template": "/user_avatar/discuss.pytorch.org/hj_feng/{size}/75792_2.png",1143 "trust_level": 01144 }1145 },1146 {1147 "extras": "latest",1148 "description": "Most Recent Poster",1149 "user": {1150 "id": 18088,1151 "username": "KFrank",1152 "name": "K. Frank",1153 "avatar_template": "/letter_avatar_proxy/v4/letter/k/ecb155/{size}.png",1154 "trust_level": 21155 }1156 }1157 ]1158 },1159 {1160 "fancy_title": "How to share a model in multi process?",1161 "id": 212232,1162 "title": "How to share a model in multi process?",1163 "slug": "how-to-share-a-model-in-multi-process",1164 "posts_count": 1,1165 "reply_count": 0,1166 "highest_post_number": 1,1167 "image_url": null,1168 "created_at": "2024-10-29T02:34:33.270Z",1169 "last_posted_at": "2024-10-29T02:34:33.328Z",1170 "bumped": true,1171 "bumped_at": "2024-10-29T02:34:33.328Z",1172 "archetype": "regular",1173 "unseen": false,1174 "pinned": false,1175 "unpinned": null,1176 "visible": true,1177 "closed": false,1178 "archived": false,1179 "bookmarked": null,1180 "liked": null,1181 "tags_descriptions": {},1182 "like_count": 0,1183 "views": 23,1184 "category_id": 1,1185 "featured_link": null,1186 "has_accepted_answer": false,1187 "posters": [1188 {1189 "extras": "latest single",1190 "description": "Original Poster, Most Recent Poster",1191 "user": {1192 "id": 79055,1193 "username": "hello_e",1194 "name": "hhhh",1195 "avatar_template": "/letter_avatar_proxy/v4/letter/h/f9ae1b/{size}.png",1196 "trust_level": 11197 }1198 }1199 ]1200 }