Open langbowang opened 2 months ago
Got the same error, even when switching to cpu
File ".../custom_nodes/ComfyUI_HF_Servelress_Inference/nodes/Joy_Caption.py", line 171, in gen with torch.amp.autocast_mode.autocast(DEVICE, enabled=True): File ".../ComfyUI_windows_portable/python_embeded/Lib/site-packages/torch/amp/autocast_mode.py", line 241, in init raise RuntimeError( RuntimeError: User specified an unsupported autocast device_type 'cpu'
Perhaps a "autocast_mode.py" problem?
same here
No solution?
You can fix it by modifying the Joy_caption_node.py file. Specifically, change the line:
with torch.amp.autocast_mode.autocast(str(DEVICE), enabled=True):
to
with torch.amp.autocast_mode.autocast(device_type=DEVICE.type, enabled=True):
This change ensures that autocast receives the correct device type ('cuda' or 'cpu') instead of the specific device name ('cuda:0').
with torch.amp.autocast_mode.autocast(DEVICE, enabled=True):
to
with torch.cuda.amp.autocast(enabled=True):
with torch.amp.autocast_mode.autocast(DEVICE, enabled=True):
towith torch.cuda.amp.autocast(enabled=True):
which file? Joy_caption_node.py?
with torch.amp.autocast_mode.autocast(DEVICE, enabled=True):
towith torch.cuda.amp.autocast(enabled=True):
which file? Joy_caption_node.py?
yes, Joy_caption_node.py
You can fix it by modifying the Joy_caption_node.py file. Specifically, change the line:
with torch.amp.autocast_mode.autocast(str(DEVICE), enabled=True):
to
with torch.amp.autocast_mode.autocast(device_type=DEVICE.type, enabled=True):
This change ensures that autocast receives the correct device type ('cuda' or 'cpu') instead of the specific device name ('cuda:0').
thank you,it works for me!改完这一行代码,保存后,就正常运行了
Doesnt work for me. Nor with torch.cuda.amp.autocast(enabled=True): nor with torch.amp.autocast_mode.autocast(device_type=DEVICE.type, enabled=True):
replacing DEVICE = get_torch_device()
with DEVICE = torch.device("cuda")
also can help
ComfyUI Error Report
Error Details
Exception Message: User specified an unsupported autocast device_type 'cuda:0'
Stack Trace