Fix numpy 2 OverflowError in ctc_forced_align backtracking

#7
by mr-taha - opened

Under numpy >= 2, ctc_forced_align crashes with OverflowError: Python integer N out of bounds for int8 on any text longer than ~127 CTC states — i.e. anything beyond one short ayah. The backtracking loop adds a Python int state index to an element of the int8 back array, which numpy 2 now treats as an unsafe cast error instead of silently wrapping. I tested on multi-ayah passages (Āl ʿImrān 3:4–6, 161 letters) with numpy 2.2.6 and onnxruntime 1.23 on CPU — forced alignment and the full scorer both work correctly after the change.
Thanks for publishing this model — the tajweed rule engine on top of the CTC alignment is genuinely excellent work. جزاكم الله خيرا

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment