ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Support ascend npu

Open ji-huazhong opened this issue 1 year ago • 3 comments

closed https://github.com/comfyanonymous/ComfyUI/issues/5420. This PR was validated on Atlas 800T A2.

We need to install the Ascend Toolkit first.

Then run:

# setvers
source /usr/local/Ascend/ascend-toolkit/set_env.sh
# intsall dependencies
pip install -r requirements.txt
# run
python main.py

We use the default workflow and get the following results: image

image

Collaborators

@YukMingLaw @starmountain1997

ji-huazhong avatar Oct 31 '24 02:10 ji-huazhong

Related PR: https://github.com/comfyanonymous/ComfyUI/pull/5273

ltdrdata avatar Oct 31 '24 04:10 ltdrdata

PTAL : ) @comfyanonymous

ji-huazhong avatar Oct 31 '24 07:10 ji-huazhong

@comfyanonymous PTAL

starmountain1997 avatar Nov 06 '24 06:11 starmountain1997

I believe this PR already covered https://github.com/comfyanonymous/ComfyUI/pull/3449 and https://github.com/comfyanonymous/ComfyUI/pull/5273 .

@statelesshz I think you can also add the co-auth in this PR by append coauther:

Co-authored-by: YukMingLaw <[email protected]>
Co-authored-by: starmountain1997 <[email protected]>

Closes: https://github.com/comfyanonymous/ComfyUI/pull/3449
Closes: https://github.com/comfyanonymous/ComfyUI/pull/5273
Closes: https://github.com/comfyanonymous/ComfyUI/issues/5420

Yikun avatar Dec 17 '24 06:12 Yikun

According to https://github.com/comfyanonymous/ComfyUI/issues/5420#issuecomment-2445688567 from @comfyanonymous

If someone can confirm that this PR works I will merge it.

We validated the PR on Ascend NPU, it works. Would you mind merging this? Thanks!

Yikun avatar Dec 17 '24 06:12 Yikun

@comfyanonymous

I have merged the latest codes to this commit, and have tested it on NPU (Atlas 300T A2), the result showed it worked well.

Would you mind merging this? The test logs and images are shown below:

(comfyui) xxx:~/github/ComfyUI$ python main.py
Total VRAM 62432 MB, total RAM 1547363 MB
pytorch version: 2.4.0
Set vram state to: NORMAL_VRAM
Device: npu
Using pytorch cross attention
[Prompt Server] web root: /home/sss/github/ComfyUI/web
...
Starting server

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
Requested to load SDXLClipModel
loaded completely 9.5367431640625e+25 1560.802734375 True
Requested to load SDXL
loaded completely 9.5367431640625e+25 4897.0483474731445 True
  5%|███████▋                                                                                                                                                  | 1/20 [00:07<02:13,  7.00s/it]100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [01:42<00:00,  5.11s/it]
Requested to load AutoencoderKL
loaded completely 9.5367431640625e+25 159.55708122253418 True
Prompt executed in 128.64 seconds

iShot_2024-12-18_10 37 23

shen-shanshan avatar Dec 18 '24 02:12 shen-shanshan

merge this ! please !

changqingla avatar Dec 25 '24 03:12 changqingla

Rebase my commits to master HEAD to resolve merge conflicts.

Hey @comfyanonymous @ltdrdata Is this PR still under review? Let me know if there is anything else I need to do.

From the feedback from the community, many users expect to use ComfyUI on Ascend NPU. Since https://github.com/comfyanonymous/ComfyUI/pull/3449 and https://github.com/comfyanonymous/ComfyUI/pull/5273 are no longer active, I submitted this PR and hope it can be merged as soon as possible. Thanks

ji-huazhong avatar Dec 26 '24 06:12 ji-huazhong