Comfy-Org / Comfy-Org/ComfyUI

Using the Ascend NPU card, go to the CUDA branch,props = torch.cuda.get_device_properties(device),AssertionError: Torch not compiled with CUDA enabled

Open
#6,483 1 comment 0 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

Description

### Expected Behavior

Add two lines of code to solve this problem
![image](https://github.com/user-attachments/assets/22a9d091-fcaf-479f-906d-730f642da31e)
@statelesshz

### Actual Behavior

I installed CANN 8.0.RC3, torch_npu 2.1.0
![image](https://github.com/user-attachments/assets/1bf0e3ad-5eaf-4cb0-a79f-74a196290a2a)

### Steps to Reproduce

ASCEND_LAUNCH_BLOCKING=1 python main.py --fp16-vae

### Debug Logs

```powershell
To see the GUI go to: http://127.0.0.1:8188
got prompt
model weight dtype torch.float16, manual cast: None
model_type EPS
Using pytorch attention in VAE
Using pytorch attention in VAE
!!! Exception during processing !!! Torch not compiled with CUDA enabled
Traceback (most recent call last):
File "/home/ma-user/work/ComfyUI-master/execution.py", line 327, in execute
output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
File "/home/ma-user/work/ComfyUI-master/execution.py", line 202, in get_output_data
return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
File "/home/ma-user/work/ComfyUI-master/execution.py", line 174, in _map_node_over_list
process_inputs(input_dict, i)
File "/home/ma-user/work/ComfyUI-master/execution.py", line 163, in process_inputs
results.append(getattr(obj, func)(**inputs))
File "/home/ma-user/work/ComfyUI-master/nodes.py", line 568, in load_checkpoint
out = comfy.sd.load_checkpoint_guess_config(ckpt_path, output_vae=True, output_clip=True, embedding_directory=folder_paths.get_folder_paths("embeddings"))
File "/home/ma-user/work/ComfyUI-master/comfy/sd.py", line 827, in load_checkpoint_guess_config
out = load_state_dict_guess_config(sd, output_vae, output_clip, output_clipvision, embedding_directory, output_model, model_options, te_model_options=te_model_options)
File "/home/ma-user/work/ComfyUI-master/comfy/sd.py", line 873, in load_state_dict_guess_config
vae = VAE(sd=vae_sd)
File "/home/ma-user/work/ComfyUI-master/comfy/sd.py", line 400, in __init__
dtype = model_management.vae_dtype(self.device, self.working_dtypes)
File "/home/ma-user/work/ComfyUI-master/comfy/model_management.py", line 788, in vae_dtype
if d == torch.bfloat16 and (not is_amd()) and should_use_bf16(device):
File "/home/ma-user/work/ComfyUI-master/comfy/model_management.py", line 1081, in should_use_bf16
props = torch.cuda.get_device_properties(device)
File "/home/ma-user/anaconda3/envs/py310_torch2.1/lib/python3.10/site-packages/torch/cuda/__init__.py", line 449, in get_device_properties
_lazy_init() # will define _get_device_properties
File "/home/ma-user/anaconda3/envs/py310_torch2.1/lib/python3.10/site-packages/torch/cuda/__init__.py", line 289, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

Prompt executed in 2.20 seconds
```

### Other

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.