Bug: blank lines in wav.scp / jsonl file lists crash prepare_data_iterator (IndexError / JSONDecodeError)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 85/100
Hướng nghiên cứu
Bắt đầu tại funasr/auto/auto_model.py, trong prepare_data_iterator(), đặc biệt là các nhánh phân tích .jsonl và id/data được mô tả trong issue. Chạy bản tái hiện được cung cấp với các dòng trống và các dòng chỉ chứa khoảng trắng cho cả wav.scp và data.jsonl. Hoàn tất khi các dòng trống bị bỏ qua và cả hai lời gọi đều trả về hai ID cùng các đường dẫn dữ liệu mong đợi mà không xảy ra một trong hai ngoại lệ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
🐛 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.
- Ngôn ngữ chính
- Python
- Star
- 20.5k
- Fork
- 2.1k
- Merge trung bình
- 15 giờ 57 phút
- Pull request đã merge (30 ngày)
- 100
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modelscope/FunASR
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
modelscope/FunASR#3730 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
modelscope/FunASR#3704 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
没有vllm时使用fun-asr-nano每次都重新加载模型Đang mởbug needs feedback
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
modelscope/FunASR#3401 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 1/100
modelscope/FunASR#3756 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs feedback
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
modelscope/FunASR#3739 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của modelscope/FunASR
Issue tương tự
-
deployment release-lag
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
nolte/kamerplanter#2047 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NousResearch/hermes-plugin-claude-subscription-directsdk#94 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Claiming namespace `reactogenic`Đang mởnamespace operations
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
EclipseFdn/open-vsx.org#13702 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày