CoolFace
Datasetpublic

Anurag1734/cuda-error-resolution-analysis

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes7downloads
topics_batch_478.json64304 linesDownload Raw Back to raw
1[2  {3    "post_stream": {4      "posts": [5        {6          "id": 197828,7          "name": "",8          "username": "helloWorld",9          "avatar_template": "/letter_avatar_proxy/v4/letter/h/b782af/{size}.png",10          "created_at": "2020-05-28T19:59:50.442Z",11          "cooked": "<p>I have an app that uses <a href=\"https://github.com/timesler/facenet-pytorch/blob/master/models/utils/training.py\" rel=\"nofollow noopener\">facenet-pytorch</a> to generate embedded vectors for images of faces. The model I’m using is InceptionResnetV1 trained on vggface2. The output layer of this model is a 512d tensor.</p>\n<p>I’m trying to write a TFGSM attack that will allow me to send an Image to the resnet model and get back an embeddeing vector that is simillar to embedded vector of someone specific.</p>\n<p>For example, I took 10 images of Eylon Musk , passed them to the model and got 10 embedded vectors. I created one average embedded vector from all of those vectors and this new vector is an embedded vector that represents Eylon Musk. I have an image of Barak Obama` face. I want to run an TFGSM attack that will change some pixels in the image , so that when I’ll forward this image in the resnet model I will get a vector that is simillar to the vector of Eylon Mask(L2 distance will be less than some threshold…).<br>\nI got 2 questions :</p>\n<p>I’m trying to understand what  <strong>LOSS function</strong> should I use. I checked CosineSimilarity and CosineEmbeddingLoss . I’m not sure why I need the y parameter in COsineMbeddingLoss since I got 2 vectors… And what is the main difference between them ?</p>\n<p>My attack code :</p>\n<pre><code class=\"lang-auto\">def TFGSM(image:torch.Tensor, model, target_vector,epsilon):\n    loss = nn.CosineSimilarity()\n    #loss = nn.CosineEmbeddingLoss()\n    loss = loss(model(image), target_vector)\n    #loss = loss(model(image), target_vector,torch.Tensor([[1]*512]))\n    model.zero_grad()\n    loss.backward()\n    data_grad = image.grad.data\n    sign_data_grad = data_grad.sign()\n    image_with_noise = image + epsilon*sign_data_grad\n    image_with_noise = torch.clamp(image_with_noise, 0, 1)\n    return image_with_noise\n</code></pre>\n<p>It doesnt matter If I’m using the CosineEmbeddinngLoss or the CosineSimilarity I’m getting the following exception in both case :<br>\n<code>RuntimeError: Trying to backward through the graph a second time, but the buffers have already been freed. Specify retain_graph=True when calling backward the first time.</code><br>\nTried adding retain_graph=True but it didnt help.</p>",12          "post_number": 1,13          "post_type": 1,14          "posts_count": 3,15          "updated_at": "2020-05-29T13:19:40.362Z",16          "reply_count": 0,17          "reply_to_post_number": null,18          "quote_count": 0,19          "incoming_link_count": 206,20          "reads": 21,21          "readers_count": 20,22          "score": 1034.2,23          "yours": false,24          "topic_id": 83278,25          "topic_slug": "loss-function-of-embedded-vectors",26          "display_username": "",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": 7,35          "can_edit": false,36          "can_delete": false,37          "can_recover": false,38          "can_see_hidden_post": false,39          "can_wiki": false,40          "link_counts": [41            {42              "url": "https://github.com/timesler/facenet-pytorch/blob/master/models/utils/training.py",43              "internal": false,44              "reflection": false,45              "title": "facenet-pytorch/training.py at master · timesler/facenet-pytorch · GitHub",46              "clicks": 047            }48          ],49          "read": true,50          "user_title": null,51          "bookmarked": false,52          "actions_summary": [],53          "moderator": false,54          "admin": false,55          "staff": false,56          "user_id": 26304,57          "hidden": false,58          "trust_level": 1,59          "deleted_at": null,60          "user_deleted": false,61          "edit_reason": null,62          "can_view_edit_history": true,63          "wiki": false,64          "post_url": "/t/loss-function-of-embedded-vectors/83278/1",65          "can_accept_answer": false,66          "can_unaccept_answer": false,67          "accepted_answer": false,68          "topic_accepted_answer": null,69          "can_vote": false70        },71        {72          "id": 198136,73          "name": "",74          "username": "helloWorld",75          "avatar_template": "/letter_avatar_proxy/v4/letter/h/b782af/{size}.png",76          "created_at": "2020-05-29T20:18:26.745Z",77          "cooked": "<p>Any idea maybe why I’m getting the RuntimeError ?</p>",78          "post_number": 2,79          "post_type": 1,80          "posts_count": 3,81          "updated_at": "2020-05-29T20:18:26.745Z",82          "reply_count": 1,83          "reply_to_post_number": null,84          "quote_count": 0,85          "incoming_link_count": 1,86          "reads": 11,87          "readers_count": 10,88          "score": 12.2,89          "yours": false,90          "topic_id": 83278,91          "topic_slug": "loss-function-of-embedded-vectors",92          "display_username": "",93          "primary_group_name": null,94          "flair_name": null,95          "flair_url": null,96          "flair_bg_color": null,97          "flair_color": null,98          "flair_group_id": null,99          "badges_granted": [],100          "version": 1,101          "can_edit": false,102          "can_delete": false,103          "can_recover": false,104          "can_see_hidden_post": false,105          "can_wiki": false,106          "read": true,107          "user_title": null,108          "bookmarked": false,109          "actions_summary": [],110          "moderator": false,111          "admin": false,112          "staff": false,113          "user_id": 26304,114          "hidden": false,115          "trust_level": 1,116          "deleted_at": null,117          "user_deleted": false,118          "edit_reason": null,119          "can_view_edit_history": true,120          "wiki": false,121          "post_url": "/t/loss-function-of-embedded-vectors/83278/2",122          "can_accept_answer": false,123          "can_unaccept_answer": false,124          "accepted_answer": false,125          "topic_accepted_answer": null126        },127        {128          "id": 198427,129          "name": "",130          "username": "ptrblck",131          "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",132          "created_at": "2020-05-31T06:04:59.469Z",133          "cooked": "<p>Which line of code is raising this error?</p>\n<p>This should be unrelated to the current error message, but note that you override the <code>loss</code> criterion with the <code>loss</code> tensor, which might yield other issues, if you are trying to call the same criterion again.</p>",134          "post_number": 3,135          "post_type": 1,136          "posts_count": 3,137          "updated_at": "2020-05-31T06:04:59.469Z",138          "reply_count": 0,139          "reply_to_post_number": 2,140          "quote_count": 0,141          "incoming_link_count": 0,142          "reads": 7,143          "readers_count": 6,144          "score": 1.4,145          "yours": false,146          "topic_id": 83278,147          "topic_slug": "loss-function-of-embedded-vectors",148          "display_username": "",149          "primary_group_name": null,150          "flair_name": null,151          "flair_url": null,152          "flair_bg_color": null,153          "flair_color": null,154          "flair_group_id": null,155          "badges_granted": [],156          "version": 1,157          "can_edit": false,158          "can_delete": false,159          "can_recover": false,160          "can_see_hidden_post": false,161          "can_wiki": false,162          "read": true,163          "user_title": "",164          "reply_to_user": {165            "id": 26304,166            "username": "helloWorld",167            "name": "",168            "avatar_template": "/letter_avatar_proxy/v4/letter/h/b782af/{size}.png"169          },170          "bookmarked": false,171          "actions_summary": [],172          "moderator": true,173          "admin": true,174          "staff": true,175          "user_id": 3534,176          "hidden": false,177          "trust_level": 2,178          "deleted_at": null,179          "user_deleted": false,180          "edit_reason": null,181          "can_view_edit_history": true,182          "wiki": false,183          "post_url": "/t/loss-function-of-embedded-vectors/83278/3",184          "can_accept_answer": false,185          "can_unaccept_answer": false,186          "accepted_answer": false,187          "topic_accepted_answer": null188        }189      ],190      "stream": [191        197828,192        198136,193        198427194      ]195    },196    "timeline_lookup": [197      [198        1,199        1976200      ],201      [202        2,203        1975204      ],205      [206        3,207        1974208      ]209    ],210    "suggested_topics": [211      {212        "fancy_title": "Randomly masking a variable number of selected positions in a 2D tensor",213        "id": 215554,214        "title": "Randomly masking a variable number of selected positions in a 2D tensor",215        "slug": "randomly-masking-a-variable-number-of-selected-positions-in-a-2d-tensor",216        "posts_count": 2,217        "reply_count": 0,218        "highest_post_number": 2,219        "image_url": null,220        "created_at": "2025-01-18T12:00:29.986Z",221        "last_posted_at": "2025-01-19T23:42:00.120Z",222        "bumped": true,223        "bumped_at": "2025-01-19T23:42:00.120Z",224        "archetype": "regular",225        "unseen": false,226        "pinned": false,227        "unpinned": null,228        "visible": true,229        "closed": false,230        "archived": false,231        "bookmarked": null,232        "liked": null,233        "tags_descriptions": {},234        "like_count": 0,235        "views": 50,236        "category_id": 1,237        "featured_link": null,238        "has_accepted_answer": false,239        "posters": [240          {241            "extras": null,242            "description": "Original Poster",243            "user": {244              "id": 53086,245              "username": "Norix",246              "name": "",247              "avatar_template": "/letter_avatar_proxy/v4/letter/n/9f8e36/{size}.png",248              "trust_level": 1249            }250          },251          {252            "extras": "latest",253            "description": "Most Recent Poster",254            "user": {255              "id": 18088,256              "username": "KFrank",257              "name": "K. Frank",258              "avatar_template": "/letter_avatar_proxy/v4/letter/k/ecb155/{size}.png",259              "trust_level": 2260            }261          }262        ]263      },264      {265        "fancy_title": "What does dataloader.dataset and dataloader.dataset.targets do?",266        "id": 216979,267        "title": "What does dataloader.dataset and dataloader.dataset.targets do?",268        "slug": "what-does-dataloader-dataset-and-dataloader-dataset-targets-do",269        "posts_count": 2,270        "reply_count": 1,271        "highest_post_number": 2,272        "image_url": null,273        "created_at": "2025-02-21T07:43:58.172Z",274        "last_posted_at": "2025-02-21T14:00:00.511Z",275        "bumped": true,276        "bumped_at": "2025-03-24T04:13:16.818Z",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": 1,288        "views": 30,289        "category_id": 1,290        "featured_link": null,291        "has_accepted_answer": false,292        "posters": [293          {294            "extras": null,295            "description": "Original Poster",296            "user": {297              "id": 82705,298              "username": "make1234",299              "name": "",300              "avatar_template": "/user_avatar/discuss.pytorch.org/make1234/{size}/74826_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        "fancy_title": "Inference with only certain layers of a model",321        "id": 214520,322        "title": "Inference with only certain layers of a model",323        "slug": "inference-with-only-certain-layers-of-a-model",324        "posts_count": 9,325        "reply_count": 7,326        "highest_post_number": 9,327        "image_url": null,328        "created_at": "2024-12-21T23:42:29.834Z",329        "last_posted_at": "2024-12-31T17:09:54.008Z",330        "bumped": true,331        "bumped_at": "2024-12-31T17:09:54.008Z",332        "archetype": "regular",333        "unseen": false,334        "pinned": false,335        "unpinned": null,336        "visible": true,337        "closed": false,338        "archived": false,339        "bookmarked": null,340        "liked": null,341        "tags_descriptions": {},342        "like_count": 8,343        "views": 163,344        "category_id": 1,345        "featured_link": null,346        "has_accepted_answer": false,347        "posters": [348          {349            "extras": "latest",350            "description": "Original Poster, Most Recent Poster",351            "user": {352              "id": 81645,353              "username": "comradepepega",354              "name": "",355              "avatar_template": "/user_avatar/discuss.pytorch.org/comradepepega/{size}/74666_2.png",356              "trust_level": 1357            }358          },359          {360            "extras": null,361            "description": "Frequent Poster",362            "user": {363              "id": 41396,364              "username": "soulitzer",365              "name": "",366              "avatar_template": "/letter_avatar_proxy/v4/letter/s/839c29/{size}.png",367              "trust_level": 2368            }369          }370        ]371      },372      {373        "fancy_title": "RuntimeError: mat1 and mat2 shapes cannot be multiplied (1x3 and 20x10)",374        "id": 213493,375        "title": "RuntimeError: mat1 and mat2 shapes cannot be multiplied (1x3 and 20x10)",376        "slug": "runtimeerror-mat1-and-mat2-shapes-cannot-be-multiplied-1x3-and-20x10",377        "posts_count": 1,378        "reply_count": 0,379        "highest_post_number": 1,380        "image_url": null,381        "created_at": "2024-11-26T21:12:05.959Z",382        "last_posted_at": "2024-11-26T21:12:06.050Z",383        "bumped": true,384        "bumped_at": "2024-11-26T21:12:06.050Z",385        "archetype": "regular",386        "unseen": false,387        "pinned": false,388        "unpinned": null,389        "visible": true,390        "closed": false,391        "archived": false,392        "bookmarked": null,393        "liked": null,394        "tags_descriptions": {},395        "like_count": 0,396        "views": 23,397        "category_id": 1,398        "featured_link": null,399        "has_accepted_answer": false,400        "posters": [401          {402            "extras": "latest single",403            "description": "Original Poster, Most Recent Poster",404            "user": {405              "id": 81152,406              "username": "dpalate",407              "name": "Devashish Palate",408              "avatar_template": "/user_avatar/discuss.pytorch.org/dpalate/{size}/74220_2.png",409              "trust_level": 0410            }411          }412        ]413      },414      {415        "fancy_title": "Seeking Guidance on Model Accuracy Evaluation",416        "id": 220121,417        "title": "Seeking Guidance on Model Accuracy Evaluation",418        "slug": "seeking-guidance-on-model-accuracy-evaluation",419        "posts_count": 1,420        "reply_count": 0,421        "highest_post_number": 1,422        "image_url": null,423        "created_at": "2025-05-17T09:33:02.659Z",424        "last_posted_at": "2025-05-17T09:33:02.699Z",425        "bumped": true,426        "bumped_at": "2025-05-17T09:35:58.813Z",427        "archetype": "regular",428        "unseen": false,429        "pinned": false,430        "unpinned": null,431        "visible": true,432        "closed": false,433        "archived": false,434        "bookmarked": null,435        "liked": null,436        "tags_descriptions": {},437        "like_count": 0,438        "views": 21,439        "category_id": 1,440        "featured_link": null,441        "has_accepted_answer": false,442        "posters": [443          {444            "extras": "latest single",445            "description": "Original Poster, Most Recent Poster",446            "user": {447              "id": 84327,448              "username": "ZeeJay",449              "name": "ZeeJay",450              "avatar_template": "/letter_avatar_proxy/v4/letter/z/b5ac83/{size}.png",451              "trust_level": 1452            }453          }454        ]455      }456    ],457    "tags_descriptions": {},458    "fancy_title": "Loss function of embedded vectors",459    "id": 83278,460    "title": "Loss function of embedded vectors",461    "posts_count": 3,462    "created_at": "2020-05-28T19:59:50.384Z",463    "views": 675,464    "reply_count": 1,465    "like_count": 0,466    "last_posted_at": "2020-05-31T06:04:59.469Z",467    "visible": true,468    "closed": false,469    "archived": false,470    "has_summary": false,471    "archetype": "regular",472    "slug": "loss-function-of-embedded-vectors",473    "category_id": 1,474    "word_count": 389,475    "deleted_at": null,476    "user_id": 26304,477    "featured_link": null,478    "pinned_globally": false,479    "pinned_at": null,480    "pinned_until": null,481    "image_url": null,482    "slow_mode_seconds": 0,483    "draft": null,484    "draft_key": "topic_83278",485    "draft_sequence": null,486    "unpinned": null,487    "pinned": false,488    "current_post_number": 1,489    "highest_post_number": 3,490    "deleted_by": null,491    "actions_summary": [492      {493        "id": 4,494        "count": 0,495        "hidden": false,496        "can_act": false497      },498      {499        "id": 8,500        "count": 0,501        "hidden": false,502        "can_act": false503      },504      {505        "id": 10,506        "count": 0,507        "hidden": false,508        "can_act": false509      },510      {511        "id": 7,512        "count": 0,513        "hidden": false,514        "can_act": false515      }516    ],517    "chunk_size": 20,518    "bookmarked": false,519    "topic_timer": null,520    "message_bus_last_id": 0,521    "participant_count": 2,522    "show_read_indicator": false,523    "thumbnails": null,524    "slow_mode_enabled_until": null,525    "can_vote": false,526    "vote_count": 0,527    "user_voted": false,528    "discourse_zendesk_plugin_zendesk_id": null,529    "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",530    "details": {531      "can_edit": false,532      "notification_level": 1,533      "participants": [534        {535          "id": 26304,536          "username": "helloWorld",537          "name": "",538          "avatar_template": "/letter_avatar_proxy/v4/letter/h/b782af/{size}.png",539          "post_count": 2,540          "primary_group_name": null,541          "flair_name": null,542          "flair_url": null,543          "flair_color": null,544          "flair_bg_color": null,545          "flair_group_id": null,546          "trust_level": 1547        },548        {549          "id": 3534,550          "username": "ptrblck",551          "name": "",552          "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",553          "post_count": 1,554          "primary_group_name": null,555          "flair_name": null,556          "flair_url": null,557          "flair_color": null,558          "flair_bg_color": null,559          "flair_group_id": null,560          "admin": true,561          "moderator": true,562          "trust_level": 2563        }564      ],565      "created_by": {566        "id": 26304,567        "username": "helloWorld",568        "name": "",569        "avatar_template": "/letter_avatar_proxy/v4/letter/h/b782af/{size}.png"570      },571      "last_poster": {572        "id": 3534,573        "username": "ptrblck",574        "name": "",575        "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png"576      }577    },578    "bookmarks": []579  },580  {581    "post_stream": {582      "posts": [583        {584          "id": 198044,585          "name": "Barthelemymp",586          "username": "barthelemymp",587          "avatar_template": "/user_avatar/discuss.pytorch.org/barthelemymp/{size}/14354_2.png",588          "created_at": "2020-05-29T13:31:14.412Z",589          "cooked": "<p>Hello,</p>\n<p>On my current project I’m using the google word2vec embedding googlenews-vectors-negative300.bin<br>\nHowever I was surprised that a lot of word in my text are nor referenced in the embedding(like xenophobia, submissive etc).</p>\n<p>Firstly, I wanted to know how I can extand a  <code>nn.Embedding</code> with new words. I guess I should then activate backpropagation on this part of the embedding for it to be learned.</p>\n<p>Secondly, I don’t know why but I need to pass by gensim to load the embedding, Indeed</p>\n<pre><code class=\"lang-auto\">text_field = data.Field(sequential=True, tokenize=_tokenize_str)\ndataset = TabularDataset(\n    path='mydata.csv',\n    format='csv',\n    fields=[('id',None),('content',text_field )],\n    skip_header=False)\ntext_field.build_vocab(dataset)\nvectors = vocab.Vectors('/data/GoogleNews-vectors-negative300.bin.gz')\ntext_field.vocab.set_vectors(vectors.stoi, vectors.vectors, vectors.dim)\nembedding = nn.Embedding.from_pretrained(torch.FloatTensor(text_field.vocab.vectors))\n</code></pre>\n<p>does not work, instead I need to do first:</p>\n<pre><code class=\"lang-auto\">model = gensim.models.KeyedVectors.load_word2vec_format('data/GoogleNews-vectors-negative300.bin.gz', binary=True)\nmodel.wv.save_word2vec_format('data/myGoogleEmbedding.bin')\nvectors = vocab.Vectors('/content/drive/My Drive/ActNews/data/myGoogleEmbedding.bin') \ntext_field.vocab.set_vectors(vectors.stoi, vectors.vectors, vectors.dim)\nembedding = nn.Embedding.from_pretrained(torch.FloatTensor(text_field.vocab.vectors))\n</code></pre>\n<p>Best regards,</p>\n<p>Barthélémy</p>",590          "post_number": 1,591          "post_type": 1,592          "posts_count": 2,593          "updated_at": "2020-05-29T13:32:09.706Z",594          "reply_count": 0,595          "reply_to_post_number": null,596          "quote_count": 0,597          "incoming_link_count": 951,598          "reads": 22,599          "readers_count": 21,600          "score": 4759.4,601          "yours": false,602          "topic_id": 83370,603          "topic_slug": "expanding-pretrained-embedding",604          "display_username": "Barthelemymp",605          "primary_group_name": null,606          "flair_name": null,607          "flair_url": null,608          "flair_bg_color": null,609          "flair_color": null,610          "flair_group_id": null,611          "badges_granted": [],612          "version": 1,613          "can_edit": false,614          "can_delete": false,615          "can_recover": false,616          "can_see_hidden_post": false,617          "can_wiki": false,618          "read": true,619          "user_title": null,620          "bookmarked": false,621          "actions_summary": [],622          "moderator": false,623          "admin": false,624          "staff": false,625          "user_id": 19569,626          "hidden": false,627          "trust_level": 2,628          "deleted_at": null,629          "user_deleted": false,630          "edit_reason": null,631          "can_view_edit_history": true,632          "wiki": false,633          "post_url": "/t/expanding-pretrained-embedding/83370/1",634          "can_accept_answer": false,635          "can_unaccept_answer": false,636          "accepted_answer": false,637          "topic_accepted_answer": null,638          "can_vote": false639        },640        {641          "id": 198425,642          "name": "",643          "username": "ptrblck",644          "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",645          "created_at": "2020-05-31T05:52:49.711Z",646          "cooked": "<p>You could try to concatenate the pretrained weight matrix with a newly initialized tensor to create the new weight matrix with the extended vocabulary.<br>\nTo keep the pretrained embedding matrix constant, you could register a hook to zero out the gradients of this part of the <code>weight</code>.<br>\nHere is a small code snippet to demonstrate this approach:</p>\n<pre><code class=\"lang-python\">vocab_size = 2\nembedding_dim = 10\nemb = nn.Embedding(vocab_size, embedding_dim)\n\n# Add vocab\nemb.weight = nn.Parameter(\n    torch.cat((emb.weight, torch.randn(2, embedding_dim))))\n\n# Register hook to zero out gradients of pretrained embedding weights\nmask = torch.zeros_like(emb.weight)\nmask[2:] = 1.\nemb.weight.register_hook(lambda grad: grad*mask)\n\n# Training\nx = torch.randint(0, 4, (10,))\nout = emb(x)\nout.mean().backward()\n\n# Should pring zeros in first half\nprint(emb.weight.grad)\n</code></pre>\n<p>Let me know, if this would work for you.</p>",647          "post_number": 2,648          "post_type": 1,649          "posts_count": 2,650          "updated_at": "2020-05-31T05:52:49.711Z",651          "reply_count": 0,652          "reply_to_post_number": null,653          "quote_count": 0,654          "incoming_link_count": 36,655          "reads": 18,656          "readers_count": 17,657          "score": 198.6,658          "yours": false,659          "topic_id": 83370,660          "topic_slug": "expanding-pretrained-embedding",661          "display_username": "",662          "primary_group_name": null,663          "flair_name": null,664          "flair_url": null,665          "flair_bg_color": null,666          "flair_color": null,667          "flair_group_id": null,668          "badges_granted": [],669          "version": 1,670          "can_edit": false,671          "can_delete": false,672          "can_recover": false,673          "can_see_hidden_post": false,674          "can_wiki": false,675          "read": true,676          "user_title": "",677          "bookmarked": false,678          "actions_summary": [679            {680              "id": 2,681              "count": 1682            }683          ],684          "moderator": true,685          "admin": true,686          "staff": true,687          "user_id": 3534,688          "hidden": false,689          "trust_level": 2,690          "deleted_at": null,691          "user_deleted": false,692          "edit_reason": null,693          "can_view_edit_history": true,694          "wiki": false,695          "post_url": "/t/expanding-pretrained-embedding/83370/2",696          "can_accept_answer": false,697          "can_unaccept_answer": false,698          "accepted_answer": false,699          "topic_accepted_answer": null700        }701      ],702      "stream": [703        198044,704        198425705      ]706    },707    "timeline_lookup": [708      [709        1,710        1975711      ],712      [713        2,714        1974715      ]716    ],717    "suggested_topics": [718      {719        "fancy_title": "A question for batch-training RNN",720        "id": 222402,721        "title": "A question for batch-training RNN",722        "slug": "a-question-for-batch-training-rnn",723        "posts_count": 4,724        "reply_count": 2,725        "highest_post_number": 4,726        "image_url": "https://discuss.pytorch.org/uploads/default/original/3X/4/4/440da3b6c9137829f920dbb36869068895b48257.png",727        "created_at": "2025-08-16T15:29:15.431Z",728        "last_posted_at": "2025-08-19T02:50:54.214Z",729        "bumped": true,730        "bumped_at": "2025-08-19T02:50:54.214Z",731        "archetype": "regular",732        "unseen": false,733        "pinned": false,734        "unpinned": null,735        "visible": true,736        "closed": false,737        "archived": false,738        "bookmarked": null,739        "liked": null,740        "tags_descriptions": {},741        "like_count": 1,742        "views": 40,743        "category_id": 8,744        "featured_link": null,745        "has_accepted_answer": false,746        "posters": [747          {748            "extras": null,749            "description": "Original Poster",750            "user": {751              "id": 74088,752              "username": "citystrawman",753              "name": "Citystrawman",754              "avatar_template": "/user_avatar/discuss.pytorch.org/citystrawman/{size}/68437_2.png",755              "trust_level": 0756            }757          },758          {759            "extras": "latest",760            "description": "Most Recent Poster",761            "user": {762              "id": 41458,763              "username": "J_Johnson",764              "name": "J Johnson",765              "avatar_template": "/user_avatar/discuss.pytorch.org/j_johnson/{size}/55494_2.png",766              "trust_level": 2767            }768          }769        ]770      },771      {772        "fancy_title": "How does one set the pad token correctly (not to eos) during fine-tuning to avoid model not predicting EOS?",773        "id": 213619,774        "title": "How does one set the pad token correctly (not to eos) during fine-tuning to avoid model not predicting EOS?",775        "slug": "how-does-one-set-the-pad-token-correctly-not-to-eos-during-fine-tuning-to-avoid-model-not-predicting-eos",776        "posts_count": 1,777        "reply_count": 0,778        "highest_post_number": 1,779        "image_url": null,780        "created_at": "2024-11-29T17:47:47.630Z",781        "last_posted_at": "2024-11-29T17:47:47.686Z",782        "bumped": true,783        "bumped_at": "2024-11-29T17:47:47.686Z",784        "archetype": "regular",785        "unseen": false,786        "pinned": false,787        "unpinned": null,788        "visible": true,789        "closed": false,790        "archived": false,791        "bookmarked": null,792        "liked": null,793        "tags_descriptions": {},794        "like_count": 0,795        "views": 1062,796        "category_id": 8,797        "featured_link": null,798        "has_accepted_answer": false,799        "posters": [800          {801            "extras": "latest single",802            "description": "Original Poster, Most Recent Poster",803            "user": {804              "id": 2282,805              "username": "Brando_Miranda",806              "name": "MirandaAgent",807              "avatar_template": "/user_avatar/discuss.pytorch.org/brando_miranda/{size}/14355_2.png",808              "trust_level": 2809            }810          }811        ]812      },813      {814        "fancy_title": "Computation of nn.Linear and nn.Embedding",815        "id": 212568,816        "title": "Computation of nn.Linear and nn.Embedding",817        "slug": "computation-of-nn-linear-and-nn-embedding",818        "posts_count": 2,819        "reply_count": 0,820        "highest_post_number": 2,821        "image_url": null,822        "created_at": "2024-11-05T17:51:48.881Z",823        "last_posted_at": "2024-11-22T23:08:53.550Z",824        "bumped": true,825        "bumped_at": "2024-11-22T23:33:05.777Z",826        "archetype": "regular",827        "unseen": false,828        "pinned": false,829        "unpinned": null,830        "visible": true,831        "closed": false,832        "archived": false,833        "bookmarked": null,834        "liked": null,835        "tags_descriptions": {},836        "like_count": 0,837        "views": 227,838        "category_id": 8,839        "featured_link": null,840        "has_accepted_answer": false,841        "posters": [842          {843            "extras": null,844            "description": "Original Poster",845            "user": {846              "id": 80540,847              "username": "na50r",848              "name": "",849              "avatar_template": "/user_avatar/discuss.pytorch.org/na50r/{size}/73632_2.png",850              "trust_level": 1851            }852          },853          {854            "extras": "latest",855            "description": "Most Recent Poster",856            "user": {857              "id": 81077,858              "username": "T0BIAS",859              "name": "",860              "avatar_template": "/user_avatar/discuss.pytorch.org/t0bias/{size}/74141_2.png",861              "trust_level": 1862            }863          }864        ]865      },866      {867        "fancy_title": "Need help with Recurrent lstms",868        "id": 215195,869        "title": "Need help with Recurrent lstms",870        "slug": "need-help-with-recurrent-lstms",871        "posts_count": 1,872        "reply_count": 0,873        "highest_post_number": 1,874        "image_url": "https://discuss.pytorch.org/uploads/default/original/3X/b/4/b499c6589da3192d332d676dc1096093ba3df607.jpeg",875        "created_at": "2025-01-10T08:06:38.992Z",876        "last_posted_at": "2025-01-10T08:06:39.052Z",877        "bumped": true,878        "bumped_at": "2025-01-10T08:40:23.002Z",879        "archetype": "regular",880        "unseen": false,881        "pinned": false,882        "unpinned": null,883        "visible": true,884        "closed": false,885        "archived": false,886        "bookmarked": null,887        "liked": null,888        "tags_descriptions": {},889        "like_count": 0,890        "views": 28,891        "category_id": 8,892        "featured_link": null,893        "has_accepted_answer": false,894        "posters": [895          {896            "extras": "latest single",897            "description": "Original Poster, Most Recent Poster",898            "user": {899              "id": 81982,900              "username": "MD_Shahadat_Hossain",901              "name": "MD. Shahadat Hossain Shahal",902              "avatar_template": "/user_avatar/discuss.pytorch.org/md_shahadat_hossain/{size}/75009_2.png",903              "trust_level": 0904            }905          }906        ]907      },908      {909        "fancy_title": "RuntimeError: The size of tensor a (2) must match the size of tensor b (0) at non-singleton dimension 1",910        "id": 223491,911        "title": "RuntimeError: The size of tensor a (2) must match the size of tensor b (0) at non-singleton dimension 1",912        "slug": "runtimeerror-the-size-of-tensor-a-2-must-match-the-size-of-tensor-b-0-at-non-singleton-dimension-1",913        "posts_count": 1,914        "reply_count": 0,915        "highest_post_number": 1,916        "image_url": null,917        "created_at": "2025-10-06T20:34:56.792Z",918        "last_posted_at": "2025-10-06T20:34:56.850Z",919        "bumped": true,920        "bumped_at": "2025-10-06T20:34:56.850Z",921        "archetype": "regular",922        "unseen": false,923        "pinned": false,924        "unpinned": null,925        "visible": true,926        "closed": false,927        "archived": false,928        "bookmarked": null,929        "liked": null,930        "tags_descriptions": {},931        "like_count": 0,932        "views": 21,933        "category_id": 8,934        "featured_link": null,935        "has_accepted_answer": false,936        "posters": [937          {938            "extras": "latest single",939            "description": "Original Poster, Most Recent Poster",940            "user": {941              "id": 78715,942              "username": "pryce",943              "name": "Pryce Houck",944              "avatar_template": "/letter_avatar_proxy/v4/letter/p/5e9695/{size}.png",945              "trust_level": 0946            }947          }948        ]949      }950    ],951    "tags_descriptions": {},952    "fancy_title": "Expanding pretrained embedding",953    "id": 83370,954    "title": "Expanding pretrained embedding",955    "posts_count": 2,956    "created_at": "2020-05-29T13:31:14.352Z",957    "views": 2038,958    "reply_count": 0,959    "like_count": 1,960    "last_posted_at": "2020-05-31T05:52:49.711Z",961    "visible": true,962    "closed": false,963    "archived": false,964    "has_summary": false,965    "archetype": "regular",966    "slug": "expanding-pretrained-embedding",967    "category_id": 8,968    "word_count": 338,969    "deleted_at": null,970    "user_id": 19569,971    "featured_link": null,972    "pinned_globally": false,973    "pinned_at": null,974    "pinned_until": null,975    "image_url": null,976    "slow_mode_seconds": 0,977    "draft": null,978    "draft_key": "topic_83370",979    "draft_sequence": null,980    "unpinned": null,981    "pinned": false,982    "current_post_number": 1,983    "highest_post_number": 2,984    "deleted_by": null,985    "actions_summary": [986      {987        "id": 4,988        "count": 0,989        "hidden": false,990        "can_act": false991      },992      {993        "id": 8,994        "count": 0,995        "hidden": false,996        "can_act": false997      },998      {999        "id": 10,1000        "count": 0,1001        "hidden": false,1002        "can_act": false1003      },1004      {1005        "id": 7,1006        "count": 0,1007        "hidden": false,1008        "can_act": false1009      }1010    ],1011    "chunk_size": 20,1012    "bookmarked": false,1013    "topic_timer": null,1014    "message_bus_last_id": 0,1015    "participant_count": 2,1016    "show_read_indicator": false,1017    "thumbnails": null,1018    "slow_mode_enabled_until": null,1019    "can_vote": false,1020    "vote_count": 0,1021    "user_voted": false,1022    "discourse_zendesk_plugin_zendesk_id": null,1023    "discourse_zendesk_plugin_zendesk_url": "https://your-url.zendesk.com/agent/tickets/",1024    "details": {1025      "can_edit": false,1026      "notification_level": 1,1027      "participants": [1028        {1029          "id": 3534,1030          "username": "ptrblck",1031          "name": "",1032          "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png",1033          "post_count": 1,1034          "primary_group_name": null,1035          "flair_name": null,1036          "flair_url": null,1037          "flair_color": null,1038          "flair_bg_color": null,1039          "flair_group_id": null,1040          "admin": true,1041          "moderator": true,1042          "trust_level": 21043        },1044        {1045          "id": 19569,1046          "username": "barthelemymp",1047          "name": "Barthelemymp",1048          "avatar_template": "/user_avatar/discuss.pytorch.org/barthelemymp/{size}/14354_2.png",1049          "post_count": 1,1050          "primary_group_name": null,1051          "flair_name": null,1052          "flair_url": null,1053          "flair_color": null,1054          "flair_bg_color": null,1055          "flair_group_id": null,1056          "trust_level": 21057        }1058      ],1059      "created_by": {1060        "id": 19569,1061        "username": "barthelemymp",1062        "name": "Barthelemymp",1063        "avatar_template": "/user_avatar/discuss.pytorch.org/barthelemymp/{size}/14354_2.png"1064      },1065      "last_poster": {1066        "id": 3534,1067        "username": "ptrblck",1068        "name": "",1069        "avatar_template": "/user_avatar/discuss.pytorch.org/ptrblck/{size}/1823_2.png"1070      }1071    },1072    "bookmarks": []1073  },1074  {1075    "post_stream": {1076      "posts": [1077        {1078          "id": 114159,1079          "name": "Enrico Guiraud",1080          "username": "bluehood",1081          "avatar_template": "/user_avatar/discuss.pytorch.org/bluehood/{size}/10820_2.png",1082          "created_at": "2019-05-29T22:04:39.594Z",1083          "cooked": "<p>Hi,<br>\nmy application spends most of its time doing a particular tensor operation:</p>\n<pre><code class=\"lang-python\">&gt;&gt;&gt; a # shape (..., N, M)\n&gt;&gt;&gt; b # shape (N, M)\n&gt;&gt;&gt; (a*b).sum(dim=-1)\n</code></pre>\n<p>With <code>einsum</code>, the operation can be written as</p>\n<pre><code class=\"lang-python\">&gt;&gt;&gt; torch.einsum('...ij,ij-&gt;...i', (a,b))\n</code></pre>\n<p>Einsum is actually faster (maybe because it doesn’t need to allocate the temporary <code>a*b</code>?) in all of my tests, both on CPU and GPU…</p>\n<p>Since this particular computation is <em>the</em> bottleneck in my application, I thought I’d check whether someone here knows how to speed it up even more – I’m not sure whether jitting would help (never used it)?</p>\n<p>Thanks in advance,<br>\nEnrico</p>\n<p>EDIT: permutated versions of the tensors are free: I can produce these tensors with whatever shapes make computation faster.</p>",1084          "post_number": 1,1085          "post_type": 1,1086          "posts_count": 3,1087          "updated_at": "2019-05-29T22:08:35.575Z",1088          "reply_count": 0,1089          "reply_to_post_number": null,1090          "quote_count": 0,1091          "incoming_link_count": 432,1092          "reads": 30,1093          "readers_count": 29,1094          "score": 2156.0,1095          "yours": false,1096          "topic_id": 46588,1097          "topic_slug": "speeding-up-a-sum-of-products-that-is-not-a-matmul",1098          "display_username": "Enrico Guiraud",1099          "primary_group_name": null,1100          "flair_name": null,1101          "flair_url": null,1102          "flair_bg_color": null,1103          "flair_color": null,1104          "flair_group_id": null,1105          "badges_granted": [],1106          "version": 2,1107          "can_edit": false,1108          "can_delete": false,1109          "can_recover": false,1110          "can_see_hidden_post": false,1111          "can_wiki": false,1112          "read": true,1113          "user_title": null,1114          "bookmarked": false,1115          "actions_summary": [],1116          "moderator": false,1117          "admin": false,1118          "staff": false,1119          "user_id": 16586,1120          "hidden": false,1121          "trust_level": 1,1122          "deleted_at": null,1123          "user_deleted": false,1124          "edit_reason": null,1125          "can_view_edit_history": true,1126          "wiki": false,1127          "post_url": "/t/speeding-up-a-sum-of-products-that-is-not-a-matmul/46588/1",1128          "can_accept_answer": false,1129          "can_unaccept_answer": false,1130          "accepted_answer": false,1131          "topic_accepted_answer": null,1132          "can_vote": false1133        },1134        {1135          "id": 114917,1136          "name": "Enrico Guiraud",1137          "username": "bluehood",1138          "avatar_template": "/user_avatar/discuss.pytorch.org/bluehood/{size}/10820_2.png",1139          "created_at": "2019-06-03T12:59:16.343Z",1140          "cooked": "<p>Bump – I promise to not bump again</p>",1141          "post_number": 2,1142          "post_type": 1,1143          "posts_count": 3,1144          "updated_at": "2019-06-03T12:59:16.343Z",1145          "reply_count": 0,1146          "reply_to_post_number": null,1147          "quote_count": 0,1148          "incoming_link_count": 2,1149          "reads": 23,1150          "readers_count": 22,1151          "score": 29.6,1152          "yours": false,1153          "topic_id": 46588,1154          "topic_slug": "speeding-up-a-sum-of-products-that-is-not-a-matmul",1155          "display_username": "Enrico Guiraud",1156          "primary_group_name": null,1157          "flair_name": null,1158          "flair_url": null,1159          "flair_bg_color": null,1160          "flair_color": null,1161          "flair_group_id": null,1162          "badges_granted": [],1163          "version": 1,1164          "can_edit": false,1165          "can_delete": false,1166          "can_recover": false,1167          "can_see_hidden_post": false,1168          "can_wiki": false,1169          "read": true,1170          "user_title": null,1171          "bookmarked": false,1172          "actions_summary": [1173            {1174              "id": 2,1175              "count": 11176            }1177          ],1178          "moderator": false,1179          "admin": false,1180          "staff": false,1181          "user_id": 16586,1182          "hidden": false,1183          "trust_level": 1,1184          "deleted_at": null,1185          "user_deleted": false,1186          "edit_reason": null,1187          "can_view_edit_history": true,1188          "wiki": false,1189          "post_url": "/t/speeding-up-a-sum-of-products-that-is-not-a-matmul/46588/2",1190          "can_accept_answer": false,1191          "can_unaccept_answer": false,1192          "accepted_answer": false,1193          "topic_accepted_answer": null1194        },1195        {1196          "id": 198407,1197          "name": "Vector",1198          "username": "Vector",1199          "avatar_template": "/letter_avatar_proxy/v4/letter/v/dc4da7/{size}.png",1200          "created_at": "2020-05-31T03:56:45.006Z",

Showing the first 1,200 of 64304 lines. Download the file for the rest.