Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'ImageModelDescriptor' object has no attribute 'cpu' #172

Open
WangGosh opened this issue May 31, 2024 · 3 comments
Open

Comments

@WangGosh
Copy link

I deployed ComfyUI on the DSW server of Alibaba Cloud. When I tried to zoom in with the enlarged model, it displayed this error
image
image
image

@WangGosh
Copy link
Author

pytorch2.1.2tensorflow2.14.0-gpu-py310-cu121-ubuntu22.04
This is my system environment

@Moxie1776
Copy link

Moxie1776 commented Jun 6, 2024

I stopped using a1111 for a few months. When I tried it today again today, I'm getting the same error...

@speters
Copy link

speters commented Jun 28, 2024

Can confirm this when trying out the DemonCore Workflow from Civitai, which depends on these nodes for upscaling.

After having searched and found a hint on stackoverflow, I made a desperate attempt that finally worked:

diff --git a/nodes/functions_upscale.py b/nodes/functions_upscale.py
index 2c25f03..a6c748c 100644
--- a/nodes/functions_upscale.py
+++ b/nodes/functions_upscale.py
@@ -54,7 +54,8 @@ def upscale_with_model(upscale_model, image):
             if tile < 128:
                 raise e

-    upscale_model.cpu()
+    device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
+    upscale_model.to(device)
     s = torch.clamp(s.movedim(-3,-1), min=0, max=1.0)
     return s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants