Bug: blank lines in wav.scp / jsonl file lists crash prepare_data_iterator (IndexError / JSONDecodeError)
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
funasr/auto/auto_model.py の prepare_data_iterator() から始め、特に issue で説明されている .jsonl と id/data の解析分岐を確認します。wav.scp と data.jsonl の両方について、空行および空白だけの行を含む、提供された再現手順を実行します。空行が無視され、両方の呼び出しが、どちらの例外も発生させずに、期待される 2 つの ID とデータパスを返せば完了です。
索引モデルが issue の本文から書いたものです。
説明
🐛 Bug
AutoModel.generate() with a file list (wav.scp, text.txt, file.jsonl, ...) crashes if the list contains a blank or whitespace-only line. prepare_data_iterator() in funasr/auto/auto_model.py iterates over every line without skipping empty ones:
- the
id \t databranch doeslines = line.strip().split(maxsplit=1)and then indexeslines[0], so an empty line raisesIndexError: list index out of range; - the
.jsonlbranch callsjson.loads(line.strip())on the empty line and raisesjson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0).
Blank lines are easy to produce in practice — lists concatenated from several sources, lists edited by hand, or files written with an extra separator line — and one of them aborts the whole batch instead of being ignored.
To Reproduce
- Install from source:
pip install -e . - Run the snippet below (it calls
prepare_data_iteratordirectly, so no model weights or download are needed). - See
IndexErrorfor the.scplist andJSONDecodeErrorfor the.jsonllist.
Code sample
from funasr.auto.auto_model import prepare_data_iterator
open("wav.scp", "w", encoding="utf-8").write("utt1 /a.wav\n\nutt2 /b.wav\n")
open("data.jsonl", "w", encoding="utf-8").write(
'{"key": "k1", "source": "/a.wav"}\n\n{"key": "k2", "source": "/b.wav"}\n'
)
prepare_data_iterator("wav.scp") # IndexError: list index out of range
prepare_data_iterator("data.jsonl") # json.decoder.JSONDecodeError
The same crash reaches users through model.generate(input="wav.scp").
Expected behavior
Blank lines carry no utterance, so they should be skipped; the two real entries should come back as (['utt1', 'utt2'], ['/a.wav', '/b.wav']) and (['k1', 'k2'], ['/a.wav', '/b.wav']), exactly as they do when the blank line is deleted manually.
Error logs
Traceback (most recent call last):
File "repro.py", line 8, in <module>
prepare_data_iterator("wav.scp")
File ".../funasr/auto/auto_model.py", line 479, in prepare_data_iterator
data = lines[1] if len(lines) > 1 else lines[0]
IndexError: list index out of range
Traceback (most recent call last):
File "repro.py", line 9, in <module>
prepare_data_iterator("data.jsonl")
File ".../funasr/auto/auto_model.py", line 474, in prepare_data_iterator
lines = json.loads(line.strip())
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Environment
- OS: Windows 11 26200 (the file-list reader is pure Python, so this reproduces on Linux too)
- Python version: 3.11.14
- FunASR version: source
mainat66d7a4c264a5993a2a63ed00c1f402c296ee521a - ModelScope version: not used by this code path
- PyTorch / torchaudio version: 2.14.1+cpu
- Install method (
pip, source, Docker): source,pip install -e .equivalent - Device (
cuda,cpu,mps): cpu - GPU model: n/a
- CUDA/cuDNN version: n/a
- Docker image tag, if used: n/a
Audio details
No audio is needed — the crash happens while parsing the list file itself.
- 主要言語
- Python
- スター
- 20.5k
- フォーク
- 2.1k
- 平均マージ
- 17時間 27分
- マージ済み PR(30日)
- 91
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelscope/FunASR のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
modelscope/FunASR#3730 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
modelscope/FunASR#3704 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
没有vllm时使用fun-asr-nano每次都重新加载模型対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug needs feedback
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
modelscope/FunASR#3401 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Bug: cmvn readers raise IndexError on blank lines and return empty statistics without error対応中かも @Lesereingrape が 1 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
modelscope/FunASR#3759 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 1/100
modelscope/FunASR#3756 ·
メンテナーはふだん 1 日以内に返信
modelscope/FunASR の issue をすべて見る
似ている issue
-
docs pydanty:is-working
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
pydantic/pydantic-ai#9800 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
[Bug]: With --api-server-count > 1, gauges such as vllm:num_requests_running have no samples until the first request対応中かも @roy6n23 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
vllm-project/vllm#59988 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
pymc-devs/pymc-examples#897 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 91/100