Using Trainer with LayoutXLM for classification

When using LayoutXLM for classification with the Huggingface Trainer I need to set dataloader_pin_memory as False following the traceback from this error:
RuntimeError: cannot pin ‘torch.cuda.LongTensor’ only dense CPU tensors can be pinned
When doing that I get the following error… :
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:1 and cuda:0!
Any ideas?

1 Like