StartHua / Comfyui_CXH_joy_caption

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

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

Open langbowang opened 2 months ago

langbowang commented 2 months ago

image

ComfyUI Error Report

Error Details

langbowang commented 2 months ago

image

mirek190 commented 2 months 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 2 months ago

yep, same problem here

train147369 commented 2 months ago

同样错误,双gpu

qtnrtnd commented 2 months 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 2 months 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 2 months 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):"