mcpField
A
ascend-model-migration

ascend-model-migration

github.com/ascend開発52110 回インストール25 週間前に更新
リポジトリ

ascend-model-migration について

Ascend NPU 環境でのモデル移行とトレーニングを支援するスキル一式です。オープンソースモデルを適応する開発者向けに、SSH 接続、依存関係の準備、コード移行、トレーニングをつなぎ、BEVFormer の対応を示しています。

主な機能

  1. 01リモート接続・環境準備・移行・訓練の連携
  2. 02MMLab 関連依存関係のインストール
  3. 03モデルリポジトリのクローンと NPU パッチ適用
  4. 04BEVFormer のトレーニングフローに対応
  5. 05環境確認と一般的なエラー対処の案内

活用シーン

  1. 01Ascend NPU のモデル訓練環境の準備
  2. 02オープンソースモデルの移行と NPU パッチ適用
  3. 03BEVFormer トレーニングの開始と監視
  4. 04SSH・NPU デバイス・パッチ問題の調査

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/ascend/agent-skills --skill ascend-model-migration

インストール後、Claude Code で/ascend-model-migrationを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

README.md
ascend-mmlab-install-suite/
README.md
ascend-mmlab-install-suite/script/
verify_mmlab_imports.py
ssh-connection/
config.example.yaml
config.yaml
README.md
ssh-connection/_lib/
_python.sh
ssh-config.py
ssh-connection/connect/scripts/
ssh-download.sh
ssh-exec.sh
ssh-job.sh
ssh-test.sh
ssh-upload.sh
ssh-connection/deploy/scripts/
ssh-deploy.sh
ssh-connection/long-task/scripts/
checkpoint.sh
ssh-connection/tunnel/scripts/
ssh-tunnel.sh

詳細

Ascend モデル移行スイート

Ascend NPU 環境向けの、モデル移行とトレーニングを包括的に行うスイートです。SSH 接続からモデルのトレーニングまで、エンドツーエンドのワークフローを提供します。

呼び出すタイミング

  • オープンソースモデルを Ascend NPU に移行したい場合
  • Ascend NPU でトレーニング環境をセットアップしたい場合
  • Ascend NPU でモデル(BEVFormer など)をトレーニングしたい場合
  • Ascend プラットフォームでのモデルデプロイについて質問がある場合

スイートの構成

ascend-model-migration/
├── SKILL.md              # Main skill (this file)
├── ssh-connection/       # SSH connection skill (from ssh-dev-suite)
│   └── SKILL.md
├── model-migration/      # Model migration skill
│   └── SKILL.md
└── model-training/       # Model training skill
    └── SKILL.md

# External Dependencies (in AgentSkills/skills/)
└── ascend-mmlab-install-suite/  # MMLab environment setup
    └── SKILL.md

ワークフローの概要

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│  ssh-connection │ ──► │ mmlab-install   │ ──► │ model-migration │ ──► │ model-training  │
│                 │     │    -suite       │     │                 │     │                 │
│  Connect to     │     │  Install mmcv,  │     │  Clone repo,    │     │  Execute        │
│  Ascend server  │     │  mmdet, mmdet3d │     │  apply patches  │     │  training script│
└─────────────────┘     └─────────────────┘     └─────────────────┘     └─────────────────┘

ワークフロー全体

フェーズ 0:DrivingSDK の準備

DrivingSDK リポジトリのアドレス:https://gitcode.com/Ascend/DrivingSDK

作業を始める前に、DrivingSDK が作業ディレクトリにクローンされていることを確認します。

cd <working_directory>
git clone https://gitcode.com/Ascend/DrivingSDK

重要:DrivingSDK には必要なパッチファイルとトレーニングスクリプトがすべて含まれているため、パッチの場所をユーザーに尋ねる必要はありません。

フェーズ 1:環境情報の収集

以下の情報をユーザーに尋ねます。

1. Server IP address (e.g., 192.168.13.151)
2. SSH username (e.g., root)
3. Docker container name (if applicable, e.g., qianqian_0312)
4. Conda environment name (e.g., qianqian_2)
5. Working directory path (e.g., /home/zqq/0312_trae_new)

このスイートの ssh-connection スキルを使用して接続を確立します。

フェーズ 2:環境のセットアップ

AgentSkills/skills/ascend-mmlab-install-suite/ を使用して依存関係をインストールします。

  1. 基本環境(torch、torch_npu、CANN)を確認する
  2. MMLab の依存関係をインストールする:
    • mmcv-full(NPU オペレーター対応)
    • mmdetection
    • mmsegmentation
    • mmdetection3d
    • detectron2
フェーズ 3:モデルの移行

このスイートの model-migration スキルを使用してモデルコードを準備します。

  1. オープンソースリポジトリをクローンする
  2. NPU 対応パッチを適用する
  3. データセットと重みのリンクを設定する
フェーズ 4:モデルのトレーニング

このスイートの model-training スキルを使用してトレーニングを開始します。

  1. トレーニングモード(性能/精度)を選択する
  2. トレーニングスクリプトを実行する
  3. トレーニングの進行状況を監視する

対応モデル

モデル状態DrivingSDK のパス
BEVFormer✅ 対応済みmodel_examples/BEVFormer
その他のモデル🔄 近日対応予定-

クイックスタートの例

User: "I want to train BEVFormer on Ascend NPU"

Agent workflow:
1. [ssh-connection] Ask for server info → Connect
2. [ascend-mmlab-install-suite] Check environment → Install MMLab deps
3. [model-migration] Clone BEVFormer → Apply patch → Link data
4. [model-training] Launch training → Monitor progress

主要な原則

NPU 互換性の確認

インストール後、NPU との互換性を確認します。

python -c "import site; print([p for p in site.getsitepackages() if 'cuda' in p.lower()])"

NPU 環境では空のリスト [] が返されます。

ネットワーク戦略
状況戦略
サーバーから GitHub にアクセスできるサーバー上で直接 git clone する
サーバーでネットワークがタイムアウトするプロキシを設定するか、ローカルにクローンしてからサーバーに scp する
プロキシを利用できるプロキシを設定する:export http_proxy=http://proxy:port

重要:GitHub リポジトリをクローンする際は、必ず GitHub の公式リンクを使用し、ミラーサイトは使用しないでください。ネットワークがタイムアウトする場合は、まずプロキシの設定を試してください。

エラー処理

各サブスキルはそれぞれのエラーを処理し、復旧方法を提案します。よくある問題は次のとおりです。

  1. SSH 接続に失敗する:IP、ユーザー名、パスワード/キーを確認する
  2. NPU デバイスが見つからない:環境変数を確認する
  3. CUDA パスが競合する:NPU 対応版を再インストールする
  4. パッチの適用に失敗する:コードのバージョンを確認する

環境変数のリファレンス

Ascend NPU の一般的な環境変数:

export ASCEND_SLOG_PRINT_TO_STDOUT=0
export ASCEND_GLOBAL_LOG_LEVEL=3
export TASK_QUEUE_ENABLE=2
export COMBINED_ENABLE=1
export HCCL_WHITELIST_DISABLE=1
export HCCL_CONNECT_TIMEOUT=1200

注:特定の環境では ASCEND_RT_VISIBLE_DEVICES が必要になる場合があります。

参照ファイル

  • SSH 接続:ssh-connection/SKILL.md(このスイート)
  • MMLab インストールスイート:AgentSkills/skills/ascend-mmlab-install-suite/SKILL.md
  • DrivingSDK のパス:DrivingSDK/model_examples/
  • モデル移行:model-migration/SKILL.md(このスイート)
  • モデルのトレーニング:model-training/SKILL.md(このスイート)

コメント