salaniz / pytorch-gve-lrcn

PyTorch implementations for "Generating Visual Explanations" (GVE) and "Long-term Recurrent Convolutional Networks" (LRCN)
MIT License
92 stars 22 forks source link

Lengths of data too long while training GVE #15

Closed Elendor11 closed 1 year ago

Elendor11 commented 3 years ago

There is an issue I had while training GVE, the length that LRCN outputs gets way too big for the data, resulting eventually in memory issues when trying to use the Sentence Classifier. I've found that line 133 of the LRCN class: "active_batches = (~reached_end)" does not switch the zeros to ones, but rather switches them to 255 in this version of Pytorch. A simple fix I've found for this is to use (reached_end^1), this solved the problem for me! I hope this can help others with a similar issue!

Ellyuca commented 2 years ago

hi @Elendor11. Did you manage to train the gve? if so, could you share your pretrained model?

Thanks.

katelyn98 commented 1 year ago

This solution (reached_end^1) also fixed the training for me. Thank you!

salaniz commented 1 year ago

The behavior of pytorch changed some time ago, so I fixed the code to use a boolean tensor now.