Command Palette

Search for a command to run...

Назад к скиллам
скилл № 99992

huawei-cloud-cloudrobo-npu-patcher

Applies to adapting PyTorch-framework VLA models to Ascend NPU, fixing CUDA issues, or optimizing NPU performance. Includes scanning, patching, verification…

БесплатноЗапускает вложенные скрипты
huaweicloudskillот huaweicloudskill152 установки в других каталогах

Установить huawei-cloud-cloudrobo-npu-patcher в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Skill: huawei-cloud-cloudrobo-npu-patcher

Overview

Adapts PyTorch VLA models to Ascend NPU. Runtime patches via build_npu_patcher() automatically handle float64→float32, numpy safety, nan_to_num, and other issues; scanners detect semantic issues that require agent judgment.

Runtime Patches (zero-config, always active)

runtime_patches.py (copy it to the migrate_to_cloudrobo/ directory) provides the following patches, activated by the entry point's build_vla_patcher():

Patch Function
Float64To32 module-level torch.float64→float32 replacement + copyreg.pickle fix + from_numpy/as_tensor/Tensor.to hooks
TensorNumpySafe auto-inserts .cpu() before NPU tensors call .numpy()
NanToNumSafe auto-converts half precision to float32 before torch.nan_to_num()
TensorIndexDevice auto-aligns index tensors to the indexed tensor's device
TorchTensorSafe intercepts torch.tensor() to handle 0-dim NPU tensor elements
BuiltinMinMaxNPU Python min/max with NPU tensors → torch.minimum/maximum
PowFloatSafe torch.pow fractional exponent → result auto .float()
SdpaMaskBroadcast fixes NPU SDPA mask broadcast error (aclnnFlashAttentionScore error 561103): explicitly expands the (B,N,1,Skv) broadcast mask to (B,N,Sq,Skv)
Patch Function How to enable
AdamWFused redirects AdamW → NpuFusedAdamW to improve NPU throughput; requires contiguous large memory blocks, may OOM with large models / tight memory build_vla_patcher(fused_adamw=True)

Semantic-Level Issues (Agent-Assisted Fixing)

Scanners classify issues into the following categories; each pattern maps to a fix template under references/fix-templates/:

Category Description Pattern
DEVICE NPU tensor device mismatch P_RND
OPERATOR CUDA extensions → NPU API P_FLA
STRUCTURE loops, initialization, entry points P_ENT, P_VEC
FRAMEWORK pytorch_lightning P_LTM
SEMANTIC optimization P_TGT

Prerequisites

Before starting, the following must be in place:

  1. Python ≥ 3.10 — all scripts under scripts/ require Python 3.10 or later. Run them with the conda environment's interpreter when the system Python is older.
  2. Model project — the PyTorch VLA codebase to adapt (the scan/verify target path).
  3. conda environment with torch_npu — the runtime patches (runtime_patches.py) and the NPU runtime verification require import torch_npu to succeed.
  4. At least one Ascend NPU card — select cards via ASCEND_RT_VISIBLE_DEVICES (used by training and runtime checks).

Workflow

Create the following TODO list before starting:

[ ] 1. Create the migrate_to_cloudrobo/ directory and copy the template files [ ] 2. Run <skill dir>/scripts/scan.py /path/to/model --output . [ ] 3. Fix all issues (must follow the "Issue Fix Workflow") [ ] 4. Run <skill dir>/scripts/progress.py --check-complete (must pass before verifying) [ ] 5. Verify (iterate until fully passing): <skill dir>/scripts/verify.py /path/to/model --runtime --pipeline --config <config> [ ] 6. Verify (iterate until fully passing): <skill dir>/scripts/verify.py /path/to/model --data --config <config> [ ] 7. Start training [ ] 8. Write the NPU adaptation summary (migrate_to_cloudrobo/ADAPTATION_SUMMARY.md)

Issue Fix Workflow

  1. Get the next pending issue:
    python <skill dir>/scripts/progress.py issues.json --next
    
  2. Read the fix template: <skill dir>/references/fix-templates/<pattern_id>.md (use the pattern ID from step 1)
  3. Fix the issue per the template (or mark it as a false positive; performance issues cannot be skipped)
  4. Update progress:
    • Fixed: python <skill dir>/scripts/progress.py issues.json --fixed <issue_id>
    • False positive: python <skill dir>/scripts/progress.py issues.json --skip <issue_id> --reason "..."
  5. Repeat steps 1-4 until no pending issues remain
  6. Check whether everything is complete:
    python <skill dir>/scripts/progress.py issues.json --check-complete
    

Code quality requirements:

  • Each statement does one thing — no chained implicit conversions
  • Variable origins should be single and clear
  • Keep code symmetry and readability
  • Only replace the specific lines that need changing. Never rewrite the whole file.

Do not delegate to a sub-agent (task/background tasks). The fix workflow needs careful context-aware judgment and must be done in the main session. **Do not read issues.json contents directly. Use the progress.py commands to track and manage issues.

Core Commands

Command Purpose
python <skill dir>/scripts/scan.py /path/to/model --output . scan the model codebase → generates issues.json
python <skill dir>/scripts/progress.py issues.json --next get the next pending issue
`python /scripts/progress.py issues.json --f
Полный SKILL.md на ClawHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл huawei-cloud-cloudrobo-npu-patcher?

Applies to adapting PyTorch-framework VLA models to Ascend NPU, fixing CUDA issues, or optimizing NPU performance. Includes scanning, patching, verification, and training script templates.

Как установить скилл huawei-cloud-cloudrobo-npu-patcher?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл huawei-cloud-cloudrobo-npu-patcher запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить huawei-cloud-cloudrobo-npu-patcher с