--

Hi, thank you for your comment.

I have re-run the same code in Colab and I cannot reproduce the error.

I can run the code in the blog post with no exceptions and reproduce the expected results.

Could you provide a bit of context around the error? (where it occurs, what was changed in the code/data, ...).

From the above message, one of the possible explanations is that the model is expecting a shape <torch.Size([16])>, because 16 is the batch size. Instead, for some reasons it is seeing a different size: <torch.Size([16, 2])>.

For instance, you may start by checking the variables "text" and "labels" in this blog, and verify that they match in type/shape your implementation through all the steps. Hope this helps.

--

--

Nicolo Cosimo Albanese
Nicolo Cosimo Albanese

No responses yet