我已经解决这个问题一个多星期了,因为这个问题在任何类型的日志中都留下了零痕迹。我问这个问题是为了看看其他人有没有遇到过这种情况。
无论我使用什么笔记本,或者安装、升级或卸载什么模块,Trainer() 模块都会导致虚拟机立即关闭。
我认为它与 GPU 相关,因为我在 CPU 上运行它没有任何问题。
我已使设备可见 (0,1) 我还启用/禁用了 wandb 并设置 report_to="none"
Is cuda available? True
Cuda torch version? 12.1
Is cuDNN version: 8902
cuDNN enabled? True
Device count? 1
Current device? 0
Device name? NVIDIA A30
tensor([[0.4543, 0.0545, 0.9293],
[0.7722, 0.6535, 0.1276],
[0.9957, 0.5621, 0.1621],
[0.3164, 0.2845, 0.6874],
[0.5489, 0.7582, 0.7139]])
# setting device on GPU if available, else CPU
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print('Using device:', device)
print()
#Additional Info when using cuda
if device.type == 'cuda':
print(torch.cuda.get_device_name(0))
print('Memory Usage:')
print('Allocated:', round(torch.cuda.memory_allocated(0)/1024**3,1), 'GB')
print('Cached: ', round(torch.cuda.memory_reserved(0)/1024**3,1), 'GB')
有人经历过这种事吗?
这可能是两件事之一
我倾向于#2。查看下面的链接,它可能有助于解决您的问题。您的 GPU 通路设置可能不正确。
https://mathiashueber.com/windows-virtual-machine-gpu-passthrough-ubuntu/