RuntimeError: cublas runtime error : resource allocation failed at THCGeneral.cpp:250

pytorch报错:
RuntimeError: cublas runtime error : resource allocation failed at THCGeneral.cpp:250 #10

Troubleshooting method:
If the model itself does not have the problem of insufficient GPU storage, then consider using torch.nn.Embedding() in addition to the problem.

embedding_layer = th.nn.Embedding(num_embeddings=3, embedding_dim= self.embedding_dim)

Then the value range of the id input to embedding_layer should be in [0,num_embeddings), the above problem is likely to be caused by the range not in it.

Therefore, make sure that the input id is in the range of [0, num_embeddings).

In addition, when debugging bugs, you don't need to use GPU for debugging! Debugging uses the CPU to run the model.

Guess you like

Origin blog.csdn.net/jmh1996/article/details/115312543