StartHua / Comfyui_CXH_joy_caption

Recommended based on comfyui node pictures:Joy_caption + MiniCPMv2_6-prompt-generator + florence2
Apache License 2.0
266 stars 14 forks source link

Expected `device_type` of type `str`, got: `<class 'torch.device'>` #36

Open langbowang opened 2 weeks ago

langbowang commented 2 weeks ago

image

ComfyUI Error Report

Error Details

langbowang commented 2 weeks ago

image

mirek190 commented 2 weeks ago
Joy_caption
Expected `device_type` of type `str`, got: `<class 'torch.device'>`

The same error

If you switch off Joy_caption and leave Florence 2 and MiniCPM v2_6 then works. Seems error causing only Joy_caption node.

qtnrtnd commented 1 week ago

yep, same problem here

train147369 commented 1 week ago

同样错误,双gpu

qtnrtnd commented 1 week ago

It worked for me when integrating the changes of #23 in ComfyUI\custom_nodes\ComfyUI_HF_Servelress_Inference\nodes\Joy_Caption.py

train147369 commented 1 week ago

D:\AIProject\ComfyUI\custom_nodes\ComfyUI_HF_Servelress_Inference\nodes\ 找到这一行: pythonCopywith torch.amp.autocast_mode.autocast(DEVICE, enabled=True):

将其更改为: pythonCopywith torch.amp.autocast_mode.autocast(DEVICE.type if isinstance(DEVICE, torch.device) else DEVICE, enabled=True):

mirek190 commented 6 days ago

Joy_Caption.py

Works thank you!

Just small update:

IF Joy_caption has error:
"Expected device_type of type str, got: <class 'torch.device'>"
Under 
ComfyUI\custom_nodes\ComfyUI_HF_Servelress_Inference\nodes\Joy_Caption.py
replace
"with torch.amp.autocast_mode.autocast(DEVICE, enabled=True):"
to
"with torch.amp.autocast_mode.autocast(DEVICE.type if isinstance(DEVICE, torch.device) else DEVICE, enabled=True):"