Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问许可证需确认审计通过

wan-ascend-adaptation万提升适应

Agent Skill

wan-ascend-adaptation 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

247

周安装

10

GitHub Stars

60

下载量

78
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:wan-ascend-adaptation(万提升适应)
来源仓库:https://github.com/ascend-ai-coding/awesome-ascend-skills
仓库路径:skills/wan-ascend-adaptation
安装命令:
npx skills add https://github.com/ascend-ai-coding/awesome-ascend-skills --skill wan-ascend-adaptation
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/ascend-ai-coding/awesome-ascend-skills --skill wan-ascend-adaptation

简介

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理。
  • 通过 npx skills add 命令从指定仓库安装并使用。
  • 安装前需确认权限范围、维护状态,注意是否触发联网、命令执行或文件读写。
  • wan-ascend-adaptation 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Wan-Series Model Ascend NPU Adaptation Skill

Purpose

Provide a systematic, step-by-step guide for adapting Wan-series (and similar DiT-based) video generation models from NVIDIA CUDA/GPU to Huawei Ascend NPU. The skill encodes 9 major adaptation domains covering every layer of the inference stack, from device initialization to distributed parallelism.

When to Use

  • Porting a Wan-series (Wan2.1 / Wan2.2) model from CUDA to Ascend NPU
  • Adapting any DiT-based video diffusion model for Ascend hardware
  • Optimizing inference performance on Ascend NPU (attention, quantization, VAE parallel)
  • Setting up multi-card distributed inference on Atlas 800 series hardware
  • Integrating MindIE SD acceleration library into a PyTorch video generation pipeline

Adaptation Domains Overview

The adaptation work is organized into 9 domains. Each domain has a dedicated reference file under references/ with detailed instructions, code patterns, and pitfalls.

#DomainReference FilePriority
1Device Layer Adaptationreferences/01-device-layer.mdP0 — Must
2Operator Replacementreferences/02-operator-replacement.mdP0 — Must
3Precision Strategyreferences/03-precision-strategy.mdP0 — Must
4Attention Mechanismreferences/04-attention-mechanism.mdP1 — Critical
5Distributed Parallelismreferences/05-distributed-parallelism.mdP1 — Critical
6VAE Patch Parallelreferences/06-vae-patch-parallel.mdP2 — Important
7Model Quantizationreferences/07-model-quantization.mdP2 — Important
8Sparse Attention (RainFusion)references/08-sparse-attention.mdP2 — Important
9Inference Pipeline Integrationreferences/09-pipeline-integration.mdP1 — Critical

Workflow

To adapt a Wan-series model to Ascend, follow these steps in order:

Step 1: Device Layer Adaptation (Domain 1)

Read references/01-device-layer.md for complete guidance.

Key actions:

  • Import torch_npu and transfer_to_npu at the entry point
  • Configure NPU compile mode and internal format settings
  • Replace dist.init_process_group(backend="nccl") with backend="hccl"
  • Replace all torch.amp.autocast('cuda',...) with autocast('npu',...)
  • Replace device type checks from 'cuda' to 'npu'

Step 2: Operator Replacement (Domain 2)

Read references/02-operator-replacement.md for complete guidance.

Key actions:

  • Replace RMSNorm with torch_npu.npu_rms_norm()
  • Replace LayerNorm forward to remove .float() type casting
  • Replace RoPE with mindiesd.rotary_position_embedding() fused operator
  • Optionally enable mindiesd.fast_layernorm via FAST_LAYERNORM env var
  • Replace Flash Attention with mindiesd.attention_forward() multi-backend dispatch

Step 3: Precision Strategy (Domain 3)

Read references/03-precision-strategy.md for complete guidance.

Key actions:

  • Lower sinusoidal embedding from float64 to float32
  • Lower RoPE frequency from complex128 to complex64
  • Change autocast dtype from float32 to bfloat16
  • Remove .float() type conversions in normalization layers
  • Use PRECISION env var to control random number device for cross-platform reproducibility

Step 4: Attention Mechanism Adaptation (Domain 4)

Read references/04-attention-mechanism.md for complete guidance.

Key actions:

  • Implement multi-backend attention dispatch via ALGO env var (0/1/3)
  • Create xFuserLongContextAttention combining Ulysses + Ring Attention
  • Integrate Attention Cache via mindiesd.CacheAgent
  • Add sub-head splitting support via USE_SUB_HEAD env var

Step 5: Distributed Parallelism Refactoring (Domain 5)

Read references/05-distributed-parallelism.md for complete guidance.

Key actions:

  • Implement ParallelConfig with 4D parallelism: TP × SP × CFG
  • Create RankGenerator for orthogonal process group assignment
  • Create GroupCoordinator with dual-channel communication (HCCL + Gloo)
  • Implement TensorParallelApplicator for automatic model sharding
  • Implement CFG parallel to halve sampling loop forward passes

Step 6: VAE Patch Parallel (Domain 6)

Read references/06-vae-patch-parallel.md for complete guidance.

Key actions:

  • Implement spatial H×W slicing across NPUs
  • Monkey-patch F.conv3d, F.conv2d, F.interpolate, F.pad for boundary exchange
  • Use P2P communication for neighbor boundary data exchange
  • Adjust VAE CausalConv3d padding strategy for compatibility

Step 7: Model Quantization (Domain 7)

Read references/07-model-quantization.md for complete guidance.

Key actions:

  • Use msmodelslim for W8A8 dynamic quantization
  • Integrate mindiesd.quantize() for runtime quantization loading
  • Handle FSDP + float8 compatibility via patch_cast_buffers_for_float8()

Step 8: Sparse Attention — RainFusion (Domain 8)

Read references/08-sparse-attention.md for complete guidance.

Key actions:

  • Implement RainFusion v1 (window-based Local/Global adaptive)
  • Implement RainFusion v2 (blockwise Top-K sparse)
  • Configure skip_timesteps for quality-speed tradeoff

Step 9: Pipeline Integration (Domain 9)

Read references/09-pipeline-integration.md for complete guidance.

Key actions:

  • Add warm-up generation steps for NPU operator compilation
  • Configure T5_LOAD_CPU for flexible T5 loading strategy
  • Add RoPE frequency cache (freqs_list) lifecycle management
  • Implement multi-resolution VAE decode condition (rank < 8)
  • Add performance timing with stream.synchronize()

Key Environment Variables

VariableDefaultDescription
ALGO0Attention algorithm: 0=fused_attn_score, 1=ascend_laser_attention, 3=npu_fused_infer
FAST_LAYERNORM0Enable mindiesd fast LayerNorm
USE_SUB_HEAD0Sub-head group size for attention splitting
T5_LOAD_CPU0Load T5 model on CPU to save NPU memory
PRECISION0Generate random numbers on CPU for cross-platform reproducibility
OVERLAP0Enable FA-AllToAll communication overlap
PYTORCH_NPU_ALLOC_CONF-NPU memory allocation strategy
TASK_QUEUE_ENABLE-NPU task queue optimization
CPU_AFFINITY_CONF-CPU affinity configuration

Key Dependencies

LibraryPurpose
torch_npuPyTorch Ascend NPU backend
mindiesdMindIE Stable Diffusion acceleration (FA, RoPE, LayerNorm, quantize)
msmodelslimHuawei model compression toolkit (W8A8 quantization)
yunchangSequence parallel framework (Ulysses + Ring Attention)
torch_atbAscend Transformer Boost operators
atb_opsATB fused matmul-allreduce operators

Notes

  • This skill is derived from comparing Wan2.2-Original (CUDA) and Wan2.2-Ascend (NPU) codebases
  • The Ascend version removes S2V (Speech-to-Video) and Animate tasks, focusing on T2V, I2V, and TI2V
  • Hardware target: Atlas 800I A2 / Atlas 800T A2 with 8×64G NPU
  • All adaptation patterns are applicable to similar DiT-based video diffusion architectures

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.23%
按下载量换算28

Claude

32.02%
按下载量换算25

Cursor

16.5%
按下载量换算13

Gemini CLI

9.91%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills