Corrupt parakeet-ctc-110m cache passes validation: missing model.mil makes CoreML segfault on every launch
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 56/100
調査の方向性
Read ModelCache.validateCompiledModelLayout, ModelHub.loadModelsOnce, and CtcModels.modelsExist to trace how cache completeness is decided; start by checking whether the validator rejects the reported bundle with model.mil and other files missing. Compare cache checks in both paths, then confirm a corrupt cache is rejected and triggers a fresh download before CoreML loads it.
索引モデルが issue の本文から書いたものです。
説明
Environment
- FluidAudio 0.17.7 (
503b4bd), used by Voz 0.3.1 throughCtcModels.downloadAndLoad()for vocabulary boosting - macOS 27.0 (26A428), Apple Silicon (arm64)
- Cache:
~/Library/Application Support/FluidAudio/Models/parakeet-ctc-110m-coreml/
What happened
After the first download the CTC cache was incomplete. There was no *.partial file and no revision marker:
parakeet-ctc-110m-coreml/
├── AudioEncoder.mlmodelc/
│ ├── analytics/coremldata.bin
│ ├── coremldata.bin
│ ├── metadata.json
│ ├── model.mil (1060924 bytes, correct)
│ └── weights/weight.bin (109805537 bytes; HF: 100778304, sha256 does not match)
└── MelSpectrogram.mlmodelc/
├── analytics/coremldata.bin
├── coremldata.bin
└── weights/weight.bin (567712 bytes, correct)
# model.mil and metadata.json are missing
# vocab.json, config.json and the tokenizer files are missing
From then on the host app crashed on every launch (7 crash reports in a row):
EXC_BAD_ACCESS (SIGSEGV), KERN_INVALID_ADDRESS at 0x0000000000000000
CoreML (anonymous namespace)::makeProgramWithMemoryLayout(...)
CoreML -[MLE5ProgramLibraryOnDeviceAOTCompilationImpl createProgramLibraryHandleWithRespecialization:error:]
CoreML -[MLE5ProgramLibrary prepareAndReturnError:]
CoreML -[MLE5Engine initWithContainer:configuration:error:]
...
CoreML +[MLModel modelWithContentsOfURL:configuration:error:]
Just before each crash, the system log shows:
[com.apple.coreml] Failed to parse ML Program. It is likely an invalid or broken model.
[com.apple.coreml] Not adding memory layout to program because the source program is null.
CoreML segfaults here instead of throwing. Since the process dies instead of getting an error, the purge-and-redownload fallback in ModelHub.loadModels never runs.
Why the cache is never repaired (0.17.7)
CtcModels.modelsExistreturnsfalsebecausevocab.jsonis missing, soCtcModels.downloadruns.downloadcallsModelHub.loadModels(repo, modelNames: ["MelSpectrogram.mlmodelc"]).- In
loadModelsOnce,matchesRevisionistrue: there is no marker, and the revision ismain.allModelsExistis alsotrue, because it only checks that the two.mlmodelcdirectories exist. So nothing is downloaded. ModelCache.validateCompiledModelLayoutchecks only for the directory andcoremldata.bin, so it passes.MLModel(contentsOf:)crashes the process. The next launch repeats steps 1–5.
From reading current main (a31f151), incompleteFiles now also rejects bundles that contain *.partial files (#819). But a bundle with coremldata.bin present, model.mil missing and no .partial file still counts as complete, so I believe this still reproduces there. I did not run main.
Suggested fixes
- Have
validateCompiledModelLayoutrequiremodel.milandweights/weight.binfor ML Program bundles, or compare every file against the HF tree listing. - Run the size/content-ID check (
hasMatchingContent) when deciding whether the cache is valid, not only during download. This would also catch the oversizedweight.bin. - Write the revision marker, or a separate "download complete" sentinel, only after every file has been verified. Treat a cache without it as incomplete.
- Use one completeness check for both
CtcModels.modelsExistandModelHub, so they cannot disagree the way they did here.
Workaround
Delete parakeet-ctc-110m-coreml/. On the next launch the models download again, complete and correct, and the app starts normally.
Notes
- I don't know how the oversized
AudioEncoderweight.bincame about. The first launch, which ran the download, was probably interrupted, so a resume/append problem inFileDownloaderis possible, but I have not confirmed it. - The SIGSEGV on a broken ML Program is arguably also a CoreML bug that Apple should fix. Either way, FluidAudio cannot catch it, so the cache check needs to catch the broken bundle before it reaches CoreML.
Downstream report: https://github.com/Joelheile/voz/issues/89
- 主要言語
- Swift
- スター
- 3k
- フォーク
- 451
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 93
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
FluidInference/FluidAudio のほかの issue
-
ASR long-form: sentence-final period lost when a window ends inside the pause before the next sentence (both paths)対応中かも @maboa が 5 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
FluidInference/FluidAudio#1110 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
FluidInference/FluidAudio#1007 · コメント 7 件 ·
メンテナーはふだん 1 日以内に返信
-
Model Support Requests対応中かも @BrandonWeng が 467 日前に担当しました。 オープンenhancement question
FluidInference/FluidAudio#49 · コメント 92 件 · リアクション 6 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
FluidInference/FluidAudio の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ls1intum/artemis-ios#571 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ml-explore/mlx-swift-lm#791 ·
メンテナーはふだん 2 日以内に返信
-
a: plugins d: docs/ fyi-macos P2 platform-ios platform-macos team-ios
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
swiftlang/github-workflows#352 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信