I modified, it  still not work
I changed all “to(device)”  to  “cuda()” and model=DataParallelModel(model)
It reports
RuntimeError: CUDA out of memory. Tried to allocate 512.00 MiB (GPU 0; 10.92 GiB total capacity; 10.21 GiB already allocated; 89.50 MiB free; 9.64 MiB cached)