In this case, the data and models are generally one in the CPU, one in the GPU, or the data used for calculation. Some have been put in the GPU, and some still exist in the CPU. Here is an idea.
First, find the error reporting line, see which variables or data are used in the calculation, and then use. Is_ CUDA this attribute to check which are on the GPU and which are on the CPU, and then put them on the CPU or GPU. for instance:
The error message indicates that there is a problem in line 46 of utils.py. Then enter the file and locate line 46
Print idx_ Range and reverse_ Mapping to check whether it is on the GPU or the CPU at the same time,
print(idx_ range.is_cuda,reverse_mapping.is_cuda)
After verification, IDX was found_ Range on CPU, reverse_ Mapping on GPU, idx_ Range on GPU (IDX)_ Range. To (device)), problem-solving
Read More:
- Tensor for argument #2 ‘mat1‘ is on CPU, but expected it to be on GPU (while checking arguments for
- RuntimeError: stack expects each tensor to be equal size, but got [x] at entry 0 and [x] at entry 1
- [Solved] Pytorch Error: RuntimeError: expected scalar type Double but found Float
- [Solved] RuntimeError: expected scalar type Long but found Float
- Pytorch Error: runtimeerror: expected scalar type double but found float
- [Solved] RuntimeError: cuda runtime error (100) : no CUDA-capable device is detected at
- How to Solve RuntimeError: cuDNN error: CUDNN_STATUS_EXECUTION_FAILED
- [Solved] PyTorch Caught RuntimeError in DataLoader worker process 0和invalid argument 0: Sizes of tensors mus
- RuntimeError: Not implemented on the CPU [How to Solve]
- [Solved] RuntimeError: function ALSQPlusBackward returned a gradient different than None at position 3, but t
- [Solved] RuntimeError (note: full exception trace is shown but execution is paused at: <module>)
- [Solved] ValueError: only one element tensors can be converted to Python scalars
- How to Solve Error: RuntimeError CUDA out of memory
- [Solved] RuntimeError: unexpected EOF, expected 73963 more bytes. The file might be corrupted.
- [Solved] Runtime error: expected scalar type Float but found Double
- pytorch: RuntimeError CUDA error device-side assert triggered
- [Solved] RuntimeError: scatter(): Expected dtype int64 for index
- [Solved] Pyinstaller Package and Run Error: RuntimeError: Unable to open/read ui device
- [Solved] RuntimeError: cuda runtime error: device-side assert trigger
- [DL Common Issue] RuntimeError: CUDA error 59: Device-side assert triggered