Fine-tuning Fun-ASR-Nano on a B200: one step in six takes 1 s because cuDNN SDPA builds a plan for every new batch shape
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 86/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python, pytorch
調査の方向性
examples/industrial_data_pretraining/fun_asr_nano/docs/finetune.md と finetune.sh のレシピから始め、報告されている cuDNN SDPA の挙動と回避策を確認します。遅いステップという症状、影響を受ける sm_90/sm_100 GPU、および回避策 TORCH_CUDNN_SDPA_DEPRIORITIZED=1 を文書化します。fine-tuner が profiling なしで問題を特定して回避できれば、この変更は完了です。
索引モデルが issue の本文から書いたものです。
説明
Before asking
- Searched existing issues for "cudnn", "sdpa", "slow step", "finetune Fun-ASR-Nano". No match.
- Searched the docs and
examples/industrial_data_pretraining/fun_asr_nano/docs/finetune.md. - Read the README quick start and
docs/training.md.
Question
I ran the Fun-ASR-Nano fine-tuning recipe (examples/industrial_data_pretraining/fun_asr_nano/finetune.sh, LLM fine-tuning with the encoder and adaptor frozen, one process) on one B200, following the install steps in docs/installation/installation.md and docs/finetune.md, and got 0.245 s per step on average: 323 of 382 steps took 0.098 s and 59 took about 1.05 s. A profile showed that the slow steps are the ones whose (batch, padded token length) the process had not seen before: the Qwen3 attention calls scaled_dot_product_attention with an explicit padding mask (transformers/integrations/sdpa_attention.py:124), torch 2.11 sends that to cuDNN first on sm_100, and cuDNN builds a new execution plan per shape, 0.44 s forward and 0.55 s backward. With cuDNN taken out of the SDPA backend order (torch.backends.cuda.enable_cudnn_sdp(False) at model init, or TORCH_CUDNN_SDPA_DEPRIORITIZED=1 in the environment), the same step took 0.100 s on average, with the loss within bf16 rounding of the unmodified run.
Code or command
cd examples/industrial_data_pretraining/fun_asr_nano
export CUDA_VISIBLE_DEVICES=0
bash finetune.sh # with a local model dir, my AISHELL-1 jsonl (3600 train / 200 dev utterances), max_epoch=1, seed=1234
What have you tried?
The trainer's per-step log prints forward_time and backward_time, and both jump by about 0.5 s on the slow steps, but nothing in the log or in docs/finetune.md connects that to the batch shape or to the attention backend, and the step-time histogram only shows up if one plots the 382 lines. A one-line note in docs/finetune.md (or in the trainer's log when a step is several times the running median) saying that on sm_90 and sm_100 cuDNN SDPA rebuilds its plan for every new batch shape, and that TORCH_CUDNN_SDPA_DEPRIORITIZED=1 avoids it, would have saved me the profile.
I opened #3705 to record my experiment: setup, measurements, traces and some potential fixes. A different fix may also well suit the codebase.
Environment
- OS: Linux 6.8 (CoreWeave node)
- Python version: 3.11.16
- FunASR version: 1.4.15,
mainat486b4b7ce - ModelScope version: 1.40.0
- PyTorch / torchaudio version: 2.11.0+cu128 / 2.11.0+cu128, transformers 5.17.0
- Install method (
pip, source, Docker): source,pip install -e . - Device (
cuda,cpu,mps): cuda - GPU model: NVIDIA B200 (183 GB), one GPU used
- CUDA/cuDNN version: 12.8 / 9.19, driver 580.126.20
- 主要言語
- Python
- スター
- 20.4k
- フォーク
- 2k
- 平均マージ
- 4時間 55分
- マージ済み PR(30日)
- 169
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelscope/FunASR のほかの issue
-
bug needs feedback
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
modelscope/FunASR#3401 · コメント 2 件 ·
-
needs triage question
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
modelscope/FunASR#3718 · コメント 3 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
modelscope/FunASR#3717 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
modelscope/FunASR#3715 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
modelscope/FunASR#3707 · コメント 3 件 ·
modelscope/FunASR の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100