Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for running Wan2.2 on Huawei Ascend NPU 910B (32GB HBM + CPU offload), enabling free inference on platforms like AtomGit which provide NPU 910B 64GB instances at no cost.
What's included
scripts/patch_npu.py— A non-invasive patch script that applies 10 runtime modifications to enable NPU support:torch.cuda.*→torch.npu.*mapping +import torch_npudevice_map='auto'for automatic HBM/CPU offload viaaccelerate.to(device)/.cpu()for accelerate-managed models (_hf_hookcheck)flash_attention→ SDPA fallback (NPU has noflash_attnpackage)encodeinput.float()cast)dtype assert→.float()cast inmodel_s2v.pymax_memory={0: '15GB', 'cpu': '60GB'}tuningempty_cache()before VAE decodedocs/NPU_SUPPORT.md— Complete documentation with setup instructions, patch overview, and test results.Test Results
Design decisions
python scripts/patch_npu.pybefore inference.Environment
Tested by @0xPabloLI. Happy to address any feedback!