RuntimeError - NPL with transformers book - 02_classification.ipynb

Hi,
I’m new to the Hugging Face library and getting started with NPL with transformers book. I’ve run the code in 02_classification.ipynb (section: Training the model) verbatim several times in Colab and got the same RuntimeError: Expected all tensors to be on the same device.

I can’t find any reference for this error and can’t see where I’m going wrong as the code was run my Colab is identical to notebooks/02_classification.ipynb at main · nlp-with-transformers/notebooks · GitHub

Hi Jay

This is being addressed in this Github issue: When running the Trainer cell, it found two devices (cuda:0 and CPU) · Issue #31 · nlp-with-transformers/notebooks · GitHub

There is a propsed workaround in the thread, hope that helps.

Cheers
Heiko