[dev] SP x sdpa x non-packed layout not guarded at config validation; crashes deep in first forward on NPU (507035)

オープン
#407 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
66/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python, pytorch
領域
backend, testing

調査の方向性

Read _check_sp_hf_feasibility and its configuration validation tests, then trace how sequence_parallel_size, attn_impl, and packing are checked. Reproduce the reported sdpa plus non-packed configuration if the listed hardware and setup are available. Done means this configuration fails during validation with guidance to use flash-attention or enable packing, while the reported supported combinations remain valid.

索引モデルが issue の本文から書いたものです。

説明

bug
Checklist / 检查清单
  • I have searched existing issues, and this is a new bug report. / 我已经搜索过现有的 issues,确认这是一个新的 bug report。
Bug Description / Bug 描述

dev 的 _check_sp_hf_feasibility 已对 padding_free x 非 flash-attn 做了校验
("padding_free requires a flash attention kernel"),但非 packed(padding-mask
layout)x 非 flash-attn 组合没有任何校验。该组合在 NPU 上训练启动后于第一个
forward_backward 深崩(507035,异步爆发点在 twinkle/processor/base.py 的 packed
序列判定/解包路径,堆栈无法定位到真实根因)。

触发矩阵(20 步训练级验证):fa2+packed ✓ / fa2+非packed ✓ /
sdpa+packed(被现有校验禁止)/ sdpa+非packed ✗(本 issue)。

How to Reproduce / 如何复现

ms-swift dev-swift-v5(torchrun 2 卡)+ 以下参数启动 SFT:
sequence_parallel_size=2, attn_impl=sdpa, packing=false, padding_free=false,
backend=hf。启动后第一个 forward_backward 崩溃:
RuntimeError: ... error code is 507035
EE9999: Internal error! vector core exception

期望:配置校验阶段即报错(训练不启动),提示改用 flash-attention 或开启 packing。

Additional Information / 补充信息
  • ms-swift: dev-swift-v5 @ a4687d1ab;twinkle: dev-swift-v5 @ dd3d68f
  • Hardware: Ascend910 x2, torch_npu 2.10.0.post7, CANN 8.x, transformers 5.22.1
  • 我们提交了 NPU 门控的校验补丁(仅 torch_npu 可用时生效,CUDA 行为零变化),
    PR to follow。配套 twinkle 侧 2D mask gather 修复 PR。
主要言語
Python
スター
270
フォーク
68
平均マージ
2日 16時間
マージ済み PR(30日)
38

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

modelscope/twinkle のほかの issue

modelscope/twinkle の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。