Anurag1734/cuda-error-resolution-analysis
07
1[2 {3 "post_stream": {4 "posts": [5 {6 "id": 335289,7 "name": "Satish 1542",8 "username": "Satish_1542",9 "avatar_template": "/user_avatar/discuss.pytorch.org/satish_1542/{size}/47406_2.png",10 "created_at": "2022-03-10T12:30:09.706Z",11 "cooked": "<ul>\n<li>I am building binary classification model using neural network.</li>\n<li>All features are categorical variables, hence I am using nn.embedding layer. Features are [‘action’, ‘subtype_action’, ‘user’] . I have written model at the end the query.</li>\n<li>I need to update this model every day and each day new users will come. Let us say maximum number of users are 50K for lifetime of a model and each day 1K new users join.</li>\n<li>In that case can I add embedding layer of (Max_num_users, embedding_size_for_users) from day one. Or else is there any better way to increase embedding layer 1K each day.</li>\n</ul>\n<p>Below is my model</p>\n<p>BinaryClassification(<br>\n(emb_layers): ModuleList(<br>\n(0): Embedding(4, 2)<br>\n(1): Embedding(18, 2)<br>\n(2): Embedding(1000, 8)<br>\n)<br>\n(linear_layers): ModuleList(<br>\n(0): Linear(in_features=14, out_features=8, bias=True)<br>\n)<br>\n(output_layer): Linear(in_features=8, out_features=1, bias=False</p>",12 "post_number": 1,13 "post_type": 1,14 "posts_count": 1,15 "updated_at": "2022-03-10T12:37:07.440Z",16 "reply_count": 0,17 "reply_to_post_number": null,18 "quote_count": 0,19 "incoming_link_count": 48,20 "reads": 7,21 "readers_count": 6,22 "score": 241.4,23 "yours": false,24 "topic_id": 146054,25 "topic_slug": "how-to-add-new-embeedings-dynamically",26 "display_username": "Satish 1542",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": 2,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": 53908,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/how-to-add-new-embeedings-dynamically/146054/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 33528965 ]66 },67 "timeline_lookup": [68 [69 1,70 132571 ]72 ],73 "suggested_topics": [74 {75 "fancy_title": "How to train two independent networks",76 "id": 217349,77 "title": "How to train two independent networks",78 "slug": "how-to-train-two-independent-networks",79 "posts_count": 3,80 "reply_count": 0,81 "highest_post_number": 3,82 "image_url": null,83 "created_at": "2025-03-02T17:19:35.426Z",84 "last_posted_at": "2025-03-04T15:35:08.387Z",85 "bumped": true,86 "bumped_at": "2025-03-04T15:35:08.387Z",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": 83,99 "category_id": 8,100 "featured_link": null,101 "has_accepted_answer": false,102 "posters": [103 {104 "extras": null,105 "description": "Original Poster",106 "user": {107 "id": 83023,108 "username": "estebarb",109 "name": "Esteban",110 "avatar_template": "/user_avatar/discuss.pytorch.org/estebarb/{size}/75332_2.png",111 "trust_level": 1112 }113 },114 {115 "extras": null,116 "description": "Frequent Poster",117 "user": {118 "id": 3534,119 "username": "ptrblck",120 "name": "",121 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",122 "admin": true,123 "moderator": true,124 "trust_level": 2125 }126 },127 {128 "extras": "latest",129 "description": "Most Recent Poster",130 "user": {131 "id": 41458,132 "username": "J_Johnson",133 "name": "J Johnson",134 "avatar_template": "/user_avatar/discuss.pytorch.org/j_johnson/{size}/55494_2.png",135 "trust_level": 2136 }137 }138 ]139 },140 {141 "fancy_title": "Torch using two GPUs with NV link",142 "id": 212483,143 "title": "Torch using two GPUs with NV link",144 "slug": "torch-using-two-gpus-with-nv-link",145 "posts_count": 9,146 "reply_count": 7,147 "highest_post_number": 10,148 "image_url": null,149 "created_at": "2024-11-03T22:15:14.885Z",150 "last_posted_at": "2024-11-05T09:29:43.969Z",151 "bumped": true,152 "bumped_at": "2024-11-05T09:29:43.969Z",153 "archetype": "regular",154 "unseen": false,155 "pinned": false,156 "unpinned": null,157 "visible": true,158 "closed": false,159 "archived": false,160 "bookmarked": null,161 "liked": null,162 "tags_descriptions": {},163 "like_count": 0,164 "views": 785,165 "category_id": 8,166 "featured_link": null,167 "has_accepted_answer": false,168 "posters": [169 {170 "extras": "latest",171 "description": "Original Poster, Most Recent Poster",172 "user": {173 "id": 77701,174 "username": "MLangner",175 "name": "",176 "avatar_template": "/letter_avatar_proxy/v4/letter/m/34f0e0/{size}.png",177 "trust_level": 1178 }179 },180 {181 "extras": null,182 "description": "Frequent Poster",183 "user": {184 "id": 3534,185 "username": "ptrblck",186 "name": "",187 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",188 "admin": true,189 "moderator": true,190 "trust_level": 2191 }192 }193 ]194 },195 {196 "fancy_title": "AutoModelForCausalLM dataset process",197 "id": 212746,198 "title": "AutoModelForCausalLM dataset process",199 "slug": "automodelforcausallm-dataset-process",200 "posts_count": 2,201 "reply_count": 0,202 "highest_post_number": 2,203 "image_url": null,204 "created_at": "2024-11-09T15:19:48.859Z",205 "last_posted_at": "2024-11-09T16:51:43.042Z",206 "bumped": true,207 "bumped_at": "2024-11-09T16:51:43.042Z",208 "archetype": "regular",209 "unseen": false,210 "pinned": false,211 "unpinned": null,212 "visible": true,213 "closed": false,214 "archived": false,215 "bookmarked": null,216 "liked": null,217 "tags_descriptions": {},218 "like_count": 0,219 "views": 325,220 "category_id": 8,221 "featured_link": null,222 "has_accepted_answer": false,223 "posters": [224 {225 "extras": null,226 "description": "Original Poster",227 "user": {228 "id": 80790,229 "username": "hbao4148",230 "name": "宝 涵",231 "avatar_template": "/user_avatar/discuss.pytorch.org/hbao4148/{size}/73885_2.png",232 "trust_level": 1233 }234 },235 {236 "extras": "latest",237 "description": "Most Recent Poster",238 "user": {239 "id": 80780,240 "username": "Rajatavaa",241 "name": "Rajatava Ghosh",242 "avatar_template": "/user_avatar/discuss.pytorch.org/rajatavaa/{size}/73875_2.png",243 "trust_level": 0244 }245 }246 ]247 },248 {249 "fancy_title": "TransformerDecoder masks shape error using model.eval()",250 "id": 215775,251 "title": "TransformerDecoder masks shape error using model.eval()",252 "slug": "transformerdecoder-masks-shape-error-using-model-eval",253 "posts_count": 4,254 "reply_count": 1,255 "highest_post_number": 4,256 "image_url": null,257 "created_at": "2025-01-23T14:27:08.766Z",258 "last_posted_at": "2025-01-27T15:14:26.282Z",259 "bumped": true,260 "bumped_at": "2025-01-27T15:14:26.282Z",261 "archetype": "regular",262 "unseen": false,263 "pinned": false,264 "unpinned": null,265 "visible": true,266 "closed": false,267 "archived": false,268 "bookmarked": null,269 "liked": null,270 "tags_descriptions": {},271 "like_count": 0,272 "views": 267,273 "category_id": 8,274 "featured_link": null,275 "has_accepted_answer": false,276 "posters": [277 {278 "extras": "latest",279 "description": "Original Poster, Most Recent Poster",280 "user": {281 "id": 82267,282 "username": "Mateo-drr",283 "name": "Mateo Rodriguez",284 "avatar_template": "/user_avatar/discuss.pytorch.org/mateo-drr/{size}/75262_2.png",285 "trust_level": 0286 }287 },288 {289 "extras": null,290 "description": "Frequent Poster",291 "user": {292 "id": 3534,293 "username": "ptrblck",294 "name": "",295 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",296 "admin": true,297 "moderator": true,298 "trust_level": 2299 }300 }301 ]302 },303 {304 "fancy_title": "Gemma 3 throws RuntimeError CUDA misaligned address",305 "id": 220507,306 "title": "Gemma 3 throws RuntimeError CUDA misaligned address",307 "slug": "gemma-3-throws-runtimeerror-cuda-misaligned-address",308 "posts_count": 2,309 "reply_count": 0,310 "highest_post_number": 2,311 "image_url": null,312 "created_at": "2025-06-02T07:00:32.299Z",313 "last_posted_at": "2025-06-03T22:25:43.492Z",314 "bumped": true,315 "bumped_at": "2025-06-03T22:25:43.492Z",316 "archetype": "regular",317 "unseen": false,318 "pinned": false,319 "unpinned": null,320 "visible": true,321 "closed": false,322 "archived": false,323 "bookmarked": null,324 "liked": null,325 "tags_descriptions": {},326 "like_count": 0,327 "views": 116,328 "category_id": 8,329 "featured_link": null,330 "has_accepted_answer": false,331 "posters": [332 {333 "extras": null,334 "description": "Original Poster",335 "user": {336 "id": 84544,337 "username": "msi-sbraun-11",338 "name": "",339 "avatar_template": "/user_avatar/discuss.pytorch.org/msi-sbraun-11/{size}/77240_2.png",340 "trust_level": 0341 }342 },343 {344 "extras": "latest",345 "description": "Most Recent Poster",346 "user": {347 "id": 3534,348 "username": "ptrblck",349 "name": "",350 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",351 "admin": true,352 "moderator": true,353 "trust_level": 2354 }355 }356 ]357 }358 ],359 "tags_descriptions": {},360 "fancy_title": "How to add new embeedings dynamically",361 "id": 146054,362 "title": "How to add new embeedings dynamically",363 "posts_count": 1,364 "created_at": "2022-03-10T12:30:09.639Z",365 "views": 510,366 "reply_count": 0,367 "like_count": 0,368 "last_posted_at": "2022-03-10T12:30:09.706Z",369 "visible": true,370 "closed": false,371 "archived": false,372 "has_summary": false,373 "archetype": "regular",374 "slug": "how-to-add-new-embeedings-dynamically",375 "category_id": 8,376 "word_count": 136,377 "deleted_at": null,378 "user_id": 53908,379 "featured_link": null,380 "pinned_globally": false,381 "pinned_at": null,382 "pinned_until": null,383 "image_url": null,384 "slow_mode_seconds": 0,385 "draft": null,386 "draft_key": "topic_146054",387 "draft_sequence": null,388 "unpinned": null,389 "pinned": false,390 "current_post_number": 1,391 "highest_post_number": 1,392 "deleted_by": null,393 "actions_summary": [394 {395 "id": 4,396 "count": 0,397 "hidden": false,398 "can_act": false399 },400 {401 "id": 8,402 "count": 0,403 "hidden": false,404 "can_act": false405 },406 {407 "id": 10,408 "count": 0,409 "hidden": false,410 "can_act": false411 },412 {413 "id": 7,414 "count": 0,415 "hidden": false,416 "can_act": false417 }418 ],419 "chunk_size": 20,420 "bookmarked": false,421 "topic_timer": null,422 "message_bus_last_id": 0,423 "participant_count": 1,424 "show_read_indicator": false,425 "thumbnails": null,426 "slow_mode_enabled_until": null,427 "can_vote": false,428 "vote_count": 0,429 "user_voted": false,430 "discourse_zendesk_plugin_zendesk_id": null,431 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",432 "details": {433 "can_edit": false,434 "notification_level": 1,435 "participants": [436 {437 "id": 53908,438 "username": "Satish_1542",439 "name": "Satish 1542",440 "avatar_template": "/user_avatar/discuss.pytorch.org/satish_1542/{size}/47406_2.png",441 "post_count": 1,442 "primary_group_name": null,443 "flair_name": null,444 "flair_url": null,445 "flair_color": null,446 "flair_bg_color": null,447 "flair_group_id": null,448 "trust_level": 1449 }450 ],451 "created_by": {452 "id": 53908,453 "username": "Satish_1542",454 "name": "Satish 1542",455 "avatar_template": "/user_avatar/discuss.pytorch.org/satish_1542/{size}/47406_2.png"456 },457 "last_poster": {458 "id": 53908,459 "username": "Satish_1542",460 "name": "Satish 1542",461 "avatar_template": "/user_avatar/discuss.pytorch.org/satish_1542/{size}/47406_2.png"462 }463 },464 "bookmarks": []465 },466 {467 "post_stream": {468 "posts": [469 {470 "id": 335125,471 "name": "",472 "username": "a_friend",473 "avatar_template": "/letter_avatar_proxy/v4/letter/a/9de053/{size}.png",474 "created_at": "2022-03-09T14:50:12.518Z",475 "cooked": "<p>I am following the <a href=\"https://colab.research.google.com/drive/1QtTW9-ukX2HKZGvt0QvVGqjuqEykoZKI#scrollTo=B9ErX0ZvYYHI\" rel=\"noopener nofollow ugc\">Detectron/ Detic tutorial </a> in order to auto crop a large training dataset from the <a href=\"https://www.kaggle.com/c/happy-whale-and-dolphin/data\" rel=\"noopener nofollow ugc\">Kaggle Whale and dolphin competition</a>.</p>\n<p>The config <code>cfg</code>, vocabulary etc. are the same as in the tutorial. I have asked a <a href=\"https://discuss.pytorch.org/t/detectron2-test-loader-error/145190\">different question</a> about my code. The solution to that specific problem, seems to be pasting an exact copy of the built-in <code>collate_fn</code> function into the notebook(!)</p>\n<p>However, I have not been able to run a complete evalutation/ forward run of the dataset yet. The <code>model.eval()</code> procedure runs for at least 30 minutes on a Tesla T4, then stops with the traceback presented below. Any ideas why?</p>\n<p>Trying</p>\n<pre><code class=\"lang-auto\">image =Image.open('/home/jupyter/happy-whale-and-dolphin/train_images/00021adfb725ed.jpg')\nimage.mode\n\n</code></pre>\n<p>returns ‘RGB’.</p>\n<p>Here is a snippet of my code:</p>\n<pre><code class=\"lang-auto\">def my_dataset_generator():\n data_list = []\n for index, observation in df.iterrows():\n data_dict = {}\n data_dict[\"file_name\"] = observation['file_path']\n data_dict['image_id'] = observation['image']\n data_list.append(data_dict)\n data_list = np.array(data_list)\n print(data_list[0])\n return data_list\n\nDatasetCatalog.register(\"my_whales5\", my_dataset_generator)\ndata = DatasetCatalog.get('my_whales5')\n#print(type(data), data[0])\nmodel = build_model(cfg) # returns a torch.nn.Module\ntest_loader = build_detection_test_loader(cfg, \n 'my_whales5', \n batch_size=32,\n collate_fn = custom_collate,\n mapper=DatasetMapper(cfg, augmentations=[T.Resize((90, 90))]))\n\nmodel.eval()\nwith torch.no_grad():\n outputs = model(test_loader)\n</code></pre>\n<p>which yields</p>\n<pre><code class=\"lang-auto\">---------------------------------------------------------------------------\nValueError Traceback (most recent call last)\n/tmp/ipykernel_13624/1901225259.py in <module>\n 2 model.eval()\n 3 with torch.no_grad():\n----> 4 outputs = model(test_loader)\n 5 \n 6 print('Stopped running at: {}'.format(datetime.now().strftime('%H:%M')))\n\n/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)\n 1100 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks\n 1101 or _global_forward_hooks or _global_forward_pre_hooks):\n-> 1102 return forward_call(*input, **kwargs)\n 1103 # Do not call functions when jit is used\n 1104 full_backward_hooks, non_full_backward_hooks = [], []\n\n~/Detic/detic/modeling/meta_arch/custom_rcnn.py in forward(self, batched_inputs)\n 113 \"\"\"\n 114 if not self.training:\n--> 115 return self.inference(batched_inputs)\n 116 \n 117 images = self.preprocess_image(batched_inputs)\n\n~/Detic/detic/modeling/meta_arch/custom_rcnn.py in inference(self, batched_inputs, detected_instances, do_postprocess)\n 95 \n 96 images = self.preprocess_image(batched_inputs)\n---> 97 features = self.backbone(images.tensor)\n 98 proposals, _ = self.proposal_generator(images, features, None)\n 99 results, _ = self.roi_heads(images, features, proposals)\n\n/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)\n 1100 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks\n 1101 or _global_forward_hooks or _global_forward_pre_hooks):\n-> 1102 return forward_call(*input, **kwargs)\n 1103 # Do not call functions when jit is used\n 1104 full_backward_hooks, non_full_backward_hooks = [], []\n\n/opt/conda/lib/python3.7/site-packages/detectron2/modeling/backbone/fpn.py in forward(self, x)\n 124 [\"p2\", \"p3\", ..., \"p6\"].\n 125 \"\"\"\n--> 126 bottom_up_features = self.bottom_up(x)\n 127 results = []\n 128 prev_features = self.lateral_convs[0](bottom_up_features[self.in_features[-1]])\n\n/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)\n 1100 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks\n 1101 or _global_forward_hooks or _global_forward_pre_hooks):\n-> 1102 return forward_call(*input, **kwargs)\n 1103 # Do not call functions when jit is used\n 1104 full_backward_hooks, non_full_backward_hooks = [], []\n\n~/Detic/detic/modeling/backbone/swintransformer.py in forward(self, x)\n 602 def forward(self, x):\n 603 \"\"\"Forward function.\"\"\"\n--> 604 x = self.patch_embed(x)\n 605 \n 606 Wh, Ww = x.size(2), x.size(3)\n\n/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)\n 1100 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks\n 1101 or _global_forward_hooks or _global_forward_pre_hooks):\n-> 1102 return forward_call(*input, **kwargs)\n 1103 # Do not call functions when jit is used\n 1104 full_backward_hooks, non_full_backward_hooks = [], []\n\n~/Detic/detic/modeling/backbone/swintransformer.py in forward(self, x)\n 427 \"\"\"Forward function.\"\"\"\n 428 # padding\n--> 429 _, _, H, W = x.size()\n 430 if W % self.patch_size[1] != 0:\n 431 x = F.pad(x, (0, self.patch_size[1] - W % self.patch_size[1]))\n\nValueError: too many values to unpack (expected 4)\n</code></pre>",476 "post_number": 1,477 "post_type": 1,478 "posts_count": 3,479 "updated_at": "2022-03-09T15:36:11.633Z",480 "reply_count": 0,481 "reply_to_post_number": null,482 "quote_count": 0,483 "incoming_link_count": 71,484 "reads": 8,485 "readers_count": 7,486 "score": 356.6,487 "yours": false,488 "topic_id": 145966,489 "topic_slug": "detic-valueerror-from-swintransformer-py",490 "display_username": "",491 "primary_group_name": null,492 "flair_name": null,493 "flair_url": null,494 "flair_bg_color": null,495 "flair_color": null,496 "flair_group_id": null,497 "badges_granted": [],498 "version": 3,499 "can_edit": false,500 "can_delete": false,501 "can_recover": false,502 "can_see_hidden_post": false,503 "can_wiki": false,504 "link_counts": [505 {506 "url": "https://colab.research.google.com/drive/1QtTW9-ukX2HKZGvt0QvVGqjuqEykoZKI#scrollTo=B9ErX0ZvYYHI",507 "internal": false,508 "reflection": false,509 "title": "Google Colab",510 "clicks": 7511 },512 {513 "url": "https://www.kaggle.com/c/happy-whale-and-dolphin/data",514 "internal": false,515 "reflection": false,516 "title": "Happywhale - Whale and Dolphin Identification | Kaggle",517 "clicks": 1518 },519 {520 "url": "https://discuss.pytorch.org/t/detectron2-test-loader-error/145190",521 "internal": true,522 "reflection": false,523 "title": "Detectron2 test loader, error",524 "clicks": 1525 },526 {527 "url": "https://discuss.pytorch.org/t/detectron2-test-loader-error/145190/8",528 "internal": true,529 "reflection": true,530 "title": "Detectron2 test loader, error",531 "clicks": 1532 }533 ],534 "read": true,535 "user_title": null,536 "bookmarked": false,537 "actions_summary": [],538 "moderator": false,539 "admin": false,540 "staff": false,541 "user_id": 53626,542 "hidden": false,543 "trust_level": 1,544 "deleted_at": null,545 "user_deleted": false,546 "edit_reason": null,547 "can_view_edit_history": true,548 "wiki": false,549 "post_url": "/t/detic-valueerror-from-swintransformer-py/145966/1",550 "can_accept_answer": false,551 "can_unaccept_answer": false,552 "accepted_answer": false,553 "topic_accepted_answer": null,554 "can_vote": false555 },556 {557 "id": 335241,558 "name": "",559 "username": "ptrblck",560 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",561 "created_at": "2022-03-10T08:38:49.177Z",562 "cooked": "<p>It seems this internal method:</p>\n<pre><code class=\"lang-python\">_, _, H, W = x.size()\n</code></pre>\n<p>expects <code>x</code> to have 4 dimensions, which isn’t the case in your script.<br>\nCould you check which input shape is expected and what you are currently passing to the model?</p>",563 "post_number": 2,564 "post_type": 1,565 "posts_count": 3,566 "updated_at": "2022-03-10T08:38:49.177Z",567 "reply_count": 0,568 "reply_to_post_number": null,569 "quote_count": 0,570 "incoming_link_count": 0,571 "reads": 6,572 "readers_count": 5,573 "score": 16.2,574 "yours": false,575 "topic_id": 145966,576 "topic_slug": "detic-valueerror-from-swintransformer-py",577 "display_username": "",578 "primary_group_name": null,579 "flair_name": null,580 "flair_url": null,581 "flair_bg_color": null,582 "flair_color": null,583 "flair_group_id": null,584 "badges_granted": [],585 "version": 1,586 "can_edit": false,587 "can_delete": false,588 "can_recover": false,589 "can_see_hidden_post": false,590 "can_wiki": false,591 "read": true,592 "user_title": "",593 "bookmarked": false,594 "actions_summary": [595 {596 "id": 2,597 "count": 1598 }599 ],600 "moderator": true,601 "admin": true,602 "staff": true,603 "user_id": 3534,604 "hidden": false,605 "trust_level": 2,606 "deleted_at": null,607 "user_deleted": false,608 "edit_reason": null,609 "can_view_edit_history": true,610 "wiki": false,611 "post_url": "/t/detic-valueerror-from-swintransformer-py/145966/2",612 "can_accept_answer": false,613 "can_unaccept_answer": false,614 "accepted_answer": false,615 "topic_accepted_answer": null616 },617 {618 "id": 335272,619 "name": "",620 "username": "a_friend",621 "avatar_template": "/letter_avatar_proxy/v4/letter/a/9de053/{size}.png",622 "created_at": "2022-03-10T10:50:09.443Z",623 "cooked": "<p>Thanks, I found that the dimension of the tensor given to the Detic machinery is 5, namely <code>[<Number of batches>, <batch size>, <number of channels>, <height>, <width>]</code></p>\n<p>I solved the specific error by changing</p>\n<pre><code class=\"lang-auto\">_, _, H, W = x.size()\n</code></pre>\n<p>to</p>\n<pre><code class=\"lang-auto\">try:\n H = x.size()[-2]\n W = x.size()[-1]\nexcept ValueError:\n logging.info('Crash: {}'.format(x.size()))\n</code></pre>\n<p>That fixed the issue, but gave this traceback later in the evaluation:</p>\n<p><code>RuntimeError: Expected 4-dimensional input for 4-dimensional weight [128, 3, 4, 4], but got 5-dimensional input of size [3189, 16, 3, 96, 96] instead</code></p>\n<p>As mentioned, I have copypasted the <code>default_collate</code> function into my notebook, and renamed it <code>custom_collate</code>. Since I am in a cloud Jupyter environment, my debugging options are limited. Without being able to step through, I find the <code>default_collate</code> function a bit dense for reverse engineering.</p>\n<p>Any clues to where I should modify my code, in order to strip the fifth dimension of my tensors being passed to Detic?</p>",624 "post_number": 3,625 "post_type": 1,626 "posts_count": 3,627 "updated_at": "2022-03-10T11:46:10.199Z",628 "reply_count": 0,629 "reply_to_post_number": null,630 "quote_count": 0,631 "incoming_link_count": 0,632 "reads": 6,633 "readers_count": 5,634 "score": 1.2,635 "yours": false,636 "topic_id": 145966,637 "topic_slug": "detic-valueerror-from-swintransformer-py",638 "display_username": "",639 "primary_group_name": null,640 "flair_name": null,641 "flair_url": null,642 "flair_bg_color": null,643 "flair_color": null,644 "flair_group_id": null,645 "badges_granted": [],646 "version": 2,647 "can_edit": false,648 "can_delete": false,649 "can_recover": false,650 "can_see_hidden_post": false,651 "can_wiki": false,652 "read": true,653 "user_title": null,654 "bookmarked": false,655 "actions_summary": [],656 "moderator": false,657 "admin": false,658 "staff": false,659 "user_id": 53626,660 "hidden": false,661 "trust_level": 1,662 "deleted_at": null,663 "user_deleted": false,664 "edit_reason": null,665 "can_view_edit_history": true,666 "wiki": false,667 "post_url": "/t/detic-valueerror-from-swintransformer-py/145966/3",668 "can_accept_answer": false,669 "can_unaccept_answer": false,670 "accepted_answer": false,671 "topic_accepted_answer": null672 }673 ],674 "stream": [675 335125,676 335241,677 335272678 ]679 },680 "timeline_lookup": [681 [682 1,683 1326684 ],685 [686 3,687 1325688 ]689 ],690 "suggested_topics": [691 {692 "fancy_title": "Pickling entire dataloader when n_workers > 0 causing GCP issues",693 "id": 217100,694 "title": "Pickling entire dataloader when n_workers > 0 causing GCP issues",695 "slug": "pickling-entire-dataloader-when-n-workers-0-causing-gcp-issues",696 "posts_count": 1,697 "reply_count": 0,698 "highest_post_number": 1,699 "image_url": null,700 "created_at": "2025-02-24T15:08:21.491Z",701 "last_posted_at": "2025-02-24T15:08:21.530Z",702 "bumped": true,703 "bumped_at": "2025-02-24T15:08:21.530Z",704 "archetype": "regular",705 "unseen": false,706 "pinned": false,707 "unpinned": null,708 "visible": true,709 "closed": false,710 "archived": false,711 "bookmarked": null,712 "liked": null,713 "tags_descriptions": {},714 "like_count": 0,715 "views": 34,716 "category_id": 37,717 "featured_link": null,718 "has_accepted_answer": false,719 "posters": [720 {721 "extras": "latest single",722 "description": "Original Poster, Most Recent Poster",723 "user": {724 "id": 62809,725 "username": "JLenz",726 "name": "Julian Lenz",727 "avatar_template": "/user_avatar/discuss.pytorch.org/jlenz/{size}/56737_2.png",728 "trust_level": 1729 }730 }731 ]732 },733 {734 "fancy_title": "Losing Mask Data",735 "id": 213711,736 "title": "Losing Mask Data",737 "slug": "losing-mask-data",738 "posts_count": 5,739 "reply_count": 1,740 "highest_post_number": 5,741 "image_url": null,742 "created_at": "2024-12-02T15:28:21.758Z",743 "last_posted_at": "2024-12-04T13:32:52.827Z",744 "bumped": true,745 "bumped_at": "2024-12-04T13:32:52.827Z",746 "archetype": "regular",747 "unseen": false,748 "pinned": false,749 "unpinned": null,750 "visible": true,751 "closed": false,752 "archived": false,753 "bookmarked": null,754 "liked": null,755 "tags_descriptions": {},756 "like_count": 0,757 "views": 268,758 "category_id": 37,759 "featured_link": null,760 "has_accepted_answer": false,761 "posters": [762 {763 "extras": null,764 "description": "Original Poster",765 "user": {766 "id": 81251,767 "username": "NoahKling",768 "name": "Noah Kling",769 "avatar_template": "/user_avatar/discuss.pytorch.org/noahkling/{size}/74303_2.png",770 "trust_level": 0771 }772 },773 {774 "extras": "latest",775 "description": "Most Recent Poster",776 "user": {777 "id": 3534,778 "username": "ptrblck",779 "name": "",780 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",781 "admin": true,782 "moderator": true,783 "trust_level": 2784 }785 }786 ]787 },788 {789 "fancy_title": "How should I organize my dataset to use it as training data in PyTorch?",790 "id": 212366,791 "title": "How should I organize my dataset to use it as training data in PyTorch?",792 "slug": "how-should-i-organize-my-dataset-to-use-it-as-training-data-in-pytorch",793 "posts_count": 2,794 "reply_count": 0,795 "highest_post_number": 2,796 "image_url": "https://discuss.pytorch.org/uploads/default/optimized/3X/f/e/feb7e05d31053c71f6dcdf6c4b77d0e706454513_2_1024x423.png",797 "created_at": "2024-10-31T12:21:29.950Z",798 "last_posted_at": "2024-11-02T00:32:52.263Z",799 "bumped": true,800 "bumped_at": "2024-11-02T00:32:52.263Z",801 "archetype": "regular",802 "unseen": false,803 "pinned": false,804 "unpinned": null,805 "visible": true,806 "closed": false,807 "archived": false,808 "bookmarked": null,809 "liked": null,810 "tags_descriptions": {},811 "like_count": 1,812 "views": 105,813 "category_id": 37,814 "featured_link": null,815 "has_accepted_answer": false,816 "posters": [817 {818 "extras": null,819 "description": "Original Poster",820 "user": {821 "id": 75691,822 "username": "VictorVidigal",823 "name": "Victor Vidigal Ribeiro",824 "avatar_template": "/user_avatar/discuss.pytorch.org/victorvidigal/{size}/69914_2.png",825 "trust_level": 1826 }827 },828 {829 "extras": "latest",830 "description": "Most Recent Poster",831 "user": {832 "id": 3534,833 "username": "ptrblck",834 "name": "",835 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",836 "admin": true,837 "moderator": true,838 "trust_level": 2839 }840 }841 ]842 },843 {844 "fancy_title": "Unexpected behavior when slicing numpy array with torch tensor",845 "id": 216722,846 "title": "Unexpected behavior when slicing numpy array with torch tensor",847 "slug": "unexpected-behavior-when-slicing-numpy-array-with-torch-tensor",848 "posts_count": 1,849 "reply_count": 0,850 "highest_post_number": 1,851 "image_url": null,852 "created_at": "2025-02-15T17:35:58.461Z",853 "last_posted_at": "2025-02-15T17:35:58.501Z",854 "bumped": true,855 "bumped_at": "2025-02-15T17:42:55.427Z",856 "archetype": "regular",857 "unseen": false,858 "pinned": false,859 "unpinned": null,860 "visible": true,861 "closed": false,862 "archived": false,863 "bookmarked": null,864 "liked": null,865 "tags_descriptions": {},866 "like_count": 0,867 "views": 45,868 "category_id": 37,869 "featured_link": null,870 "has_accepted_answer": false,871 "posters": [872 {873 "extras": "latest single",874 "description": "Original Poster, Most Recent Poster",875 "user": {876 "id": 82710,877 "username": "Thunderz",878 "name": "",879 "avatar_template": "/letter_avatar_proxy/v4/letter/t/9d8465/{size}.png",880 "trust_level": 1881 }882 }883 ]884 },885 {886 "fancy_title": "How can I implement a chunked dataset in Torch?",887 "id": 217360,888 "title": "How can I implement a chunked dataset in Torch?",889 "slug": "how-can-i-implement-a-chunked-dataset-in-torch",890 "posts_count": 1,891 "reply_count": 0,892 "highest_post_number": 1,893 "image_url": null,894 "created_at": "2025-03-03T01:02:33.085Z",895 "last_posted_at": "2025-03-03T01:02:33.123Z",896 "bumped": true,897 "bumped_at": "2025-03-03T01:02:33.123Z",898 "archetype": "regular",899 "unseen": false,900 "pinned": false,901 "unpinned": null,902 "visible": true,903 "closed": false,904 "archived": false,905 "bookmarked": null,906 "liked": null,907 "tags_descriptions": {},908 "like_count": 0,909 "views": 32,910 "category_id": 37,911 "featured_link": null,912 "has_accepted_answer": false,913 "posters": [914 {915 "extras": "latest single",916 "description": "Original Poster, Most Recent Poster",917 "user": {918 "id": 83029,919 "username": "s5j3",920 "name": "",921 "avatar_template": "/letter_avatar_proxy/v4/letter/s/278dde/{size}.png",922 "trust_level": 0923 }924 }925 ]926 }927 ],928 "tags_descriptions": {},929 "fancy_title": "Detic, ValueError from swintransformer.py",930 "id": 145966,931 "title": "Detic, ValueError from swintransformer.py",932 "posts_count": 3,933 "created_at": "2022-03-09T14:50:12.394Z",934 "views": 831,935 "reply_count": 0,936 "like_count": 1,937 "last_posted_at": "2022-03-10T10:50:09.443Z",938 "visible": true,939 "closed": false,940 "archived": false,941 "has_summary": false,942 "archetype": "regular",943 "slug": "detic-valueerror-from-swintransformer-py",944 "category_id": 37,945 "word_count": 875,946 "deleted_at": null,947 "user_id": 53626,948 "featured_link": null,949 "pinned_globally": false,950 "pinned_at": null,951 "pinned_until": null,952 "image_url": null,953 "slow_mode_seconds": 0,954 "draft": null,955 "draft_key": "topic_145966",956 "draft_sequence": null,957 "unpinned": null,958 "pinned": false,959 "current_post_number": 1,960 "highest_post_number": 3,961 "deleted_by": null,962 "actions_summary": [963 {964 "id": 4,965 "count": 0,966 "hidden": false,967 "can_act": false968 },969 {970 "id": 8,971 "count": 0,972 "hidden": false,973 "can_act": false974 },975 {976 "id": 10,977 "count": 0,978 "hidden": false,979 "can_act": false980 },981 {982 "id": 7,983 "count": 0,984 "hidden": false,985 "can_act": false986 }987 ],988 "chunk_size": 20,989 "bookmarked": false,990 "topic_timer": null,991 "message_bus_last_id": 0,992 "participant_count": 2,993 "show_read_indicator": false,994 "thumbnails": null,995 "slow_mode_enabled_until": null,996 "can_vote": false,997 "vote_count": 0,998 "user_voted": false,999 "discourse_zendesk_plugin_zendesk_id": null,1000 "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",1001 "details": {1002 "can_edit": false,1003 "notification_level": 1,1004 "participants": [1005 {1006 "id": 53626,1007 "username": "a_friend",1008 "name": "",1009 "avatar_template": "/letter_avatar_proxy/v4/letter/a/9de053/{size}.png",1010 "post_count": 2,1011 "primary_group_name": null,1012 "flair_name": null,1013 "flair_url": null,1014 "flair_color": null,1015 "flair_bg_color": null,1016 "flair_group_id": null,1017 "trust_level": 11018 },1019 {1020 "id": 3534,1021 "username": "ptrblck",1022 "name": "",1023 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",1024 "post_count": 1,1025 "primary_group_name": null,1026 "flair_name": null,1027 "flair_url": null,1028 "flair_color": null,1029 "flair_bg_color": null,1030 "flair_group_id": null,1031 "admin": true,1032 "moderator": true,1033 "trust_level": 21034 }1035 ],1036 "created_by": {1037 "id": 53626,1038 "username": "a_friend",1039 "name": "",1040 "avatar_template": "/letter_avatar_proxy/v4/letter/a/9de053/{size}.png"1041 },1042 "last_poster": {1043 "id": 53626,1044 "username": "a_friend",1045 "name": "",1046 "avatar_template": "/letter_avatar_proxy/v4/letter/a/9de053/{size}.png"1047 },1048 "links": [1049 {1050 "url": "https://colab.research.google.com/drive/1QtTW9-ukX2HKZGvt0QvVGqjuqEykoZKI#scrollTo=B9ErX0ZvYYHI",1051 "title": "Google Colab",1052 "internal": false,1053 "attachment": false,1054 "reflection": false,1055 "clicks": 7,1056 "user_id": 53626,1057 "domain": "colab.research.google.com",1058 "root_domain": "google.com"1059 },1060 {1061 "url": "https://discuss.pytorch.org/t/detectron2-test-loader-error/145190",1062 "title": "Detectron2 test loader, error",1063 "internal": true,1064 "attachment": false,1065 "reflection": false,1066 "clicks": 1,1067 "user_id": 53626,1068 "domain": "discuss.pytorch.org",1069 "root_domain": "pytorch.org"1070 },1071 {1072 "url": "https://discuss.pytorch.org/t/detectron2-test-loader-error/145190/8",1073 "title": "Detectron2 test loader, error",1074 "internal": true,1075 "attachment": false,1076 "reflection": true,1077 "clicks": 1,1078 "user_id": 53626,1079 "domain": "discuss.pytorch.org",1080 "root_domain": "pytorch.org"1081 },1082 {1083 "url": "https://www.kaggle.com/c/happy-whale-and-dolphin/data",1084 "title": "Happywhale - Whale and Dolphin Identification | Kaggle",1085 "internal": false,1086 "attachment": false,1087 "reflection": false,1088 "clicks": 1,1089 "user_id": 53626,1090 "domain": "www.kaggle.com",1091 "root_domain": "kaggle.com"1092 }1093 ]1094 },1095 "bookmarks": []1096 },1097 {1098 "post_stream": {1099 "posts": [1100 {1101 "id": 334958,1102 "name": "Roua Rouatbi",1103 "username": "Roua_Rouatbi",1104 "avatar_template": "/user_avatar/discuss.pytorch.org/roua_rouatbi/{size}/41425_2.png",1105 "created_at": "2022-03-08T13:45:19.851Z",1106 "cooked": "<p>I’m trying to change my data shape from:<br>\n[array([[[<br>\n…,<br>\n, dtype=float32),<br>\narray([[[<br>\n…,<br>\n, dtype=float32),<br>\n…]</p>\n<p>to array([[[[ … ]]],<br>\n[[[ … ]]],<br>\n…]]]])</p>\n<p>This is how I’m loading the images</p>\n<pre><code class=\"lang-auto\">import torchvision.transforms as T\npreprocess = T.Compose([\n T.ToPILImage(),\n T.ToTensor(),\n #T.Resize(32),\n T.Normalize(\n mean=[0.485, 0.456, 0.406],\n std=[0.229, 0.224, 0.225]\n ),\n T.Grayscale(num_output_channels=1)\n \n])\n\ndef NormalizeData(data):\n return (data - np.min(data)) / (np.max(data) - np.min(data))\n\nimport glob\nimage_list = []\nfor filename in glob.glob(path+'*.tif'): \n im=cv2.imread(filename)\n im=preprocess(im)\n im= np.array(im)\n im = NormalizeData(im)\n image_list.append(im)\n</code></pre>\n<p>The next step is to load this into a data loader</p>\n<pre><code class=\"lang-auto\">imgset_test =image_list.astype(np.float64)\nimgset_test = imgset_test/ (2**14)\n\nimgset_test = imgset_test.reshape(imgset_test.shape[0],1,32,32)\nimgset_loader = DataLoader(dataset=imgset_test, batch_size=batch_size, shuffle=False)\n</code></pre>\n<p>imgset_test shape should be (number of images,1,32,32)<br>\nmy images are already greyscale now and 32x32 pixels</p>",1107 "post_number": 1,1108 "post_type": 1,1109 "posts_count": 3,1110 "updated_at": "2022-03-08T13:45:46.198Z",1111 "reply_count": 0,1112 "reply_to_post_number": null,1113 "quote_count": 0,1114 "incoming_link_count": 52,1115 "reads": 6,1116 "readers_count": 5,1117 "score": 261.2,1118 "yours": false,1119 "topic_id": 145888,1120 "topic_slug": "change-data-shape",1121 "display_username": "Roua Rouatbi",1122 "primary_group_name": null,1123 "flair_name": null,1124 "flair_url": null,1125 "flair_bg_color": null,1126 "flair_color": null,1127 "flair_group_id": null,1128 "badges_granted": [],1129 "version": 1,1130 "can_edit": false,1131 "can_delete": false,1132 "can_recover": false,1133 "can_see_hidden_post": false,1134 "can_wiki": false,1135 "read": true,1136 "user_title": null,1137 "bookmarked": false,1138 "actions_summary": [],1139 "moderator": false,1140 "admin": false,1141 "staff": false,1142 "user_id": 48263,1143 "hidden": false,1144 "trust_level": 1,1145 "deleted_at": null,1146 "user_deleted": false,1147 "edit_reason": null,1148 "can_view_edit_history": true,1149 "wiki": false,1150 "post_url": "/t/change-data-shape/145888/1",1151 "can_accept_answer": false,1152 "can_unaccept_answer": false,1153 "accepted_answer": false,1154 "topic_accepted_answer": null,1155 "can_vote": false1156 },1157 {1158 "id": 335065,1159 "name": "",1160 "username": "ptrblck",1161 "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",1162 "created_at": "2022-03-09T06:39:24.290Z",1163 "cooked": "<p>Could you describe what issue you are hitting using the approach?<br>\nI guess one of the posted operation fails or would you like to check if your approach sounds reasonable (it does)?</p>",1164 "post_number": 2,1165 "post_type": 1,1166 "posts_count": 3,1167 "updated_at": "2022-03-09T06:39:24.290Z",1168 "reply_count": 1,1169 "reply_to_post_number": null,1170 "quote_count": 0,1171 "incoming_link_count": 0,1172 "reads": 4,1173 "readers_count": 3,1174 "score": 5.8,1175 "yours": false,1176 "topic_id": 145888,1177 "topic_slug": "change-data-shape",1178 "display_username": "",1179 "primary_group_name": null,1180 "flair_name": null,1181 "flair_url": null,1182 "flair_bg_color": null,1183 "flair_color": null,1184 "flair_group_id": null,1185 "badges_granted": [],1186 "version": 1,1187 "can_edit": false,1188 "can_delete": false,1189 "can_recover": false,1190 "can_see_hidden_post": false,1191 "can_wiki": false,1192 "read": true,1193 "user_title": "",1194 "bookmarked": false,1195 "actions_summary": [],1196 "moderator": true,1197 "admin": true,1198 "staff": true,1199 "user_id": 3534,1200 "hidden": false,