Repository navigation
fix(#302): save refined SRT cues before a rate-limit pause - #305
Closed
mayuriphad wants to merge 1 commit into
Closed
mayuriphad wants to merge 1 commit into
mayuriphad wants to merge 1 commit into
Conversation
Signed-off-by: mayuriphad <mayuriphad656@gmail.com>
Owner
|
Thanks for working on this, Mayuri, and sorry it sat for a week. The fix landed in #313, which follows the same idea as yours (attach the refined cues to RateLimitError.partial_result and write them before re-raising). It also goes one step further on resume: the SRT refiner now receives the checkpoint and resume index, reads the finished cues back from the partial file and only sends the remaining ones to the model, so a resume no longer starts over from the first cue. Your branch also conflicts with main now, so I'm closing it in favor of #313. Thanks for the contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #302
When a provider returned a 429 during an SRT refine pass,
RateLimitErrorpropagated out ofrefine_srt_fileand nothing was written. Every cue already refined was lost, so a resume started again from the first cue. #252 fixed this for the TXT refiner and Plain Text Mode, but not for SRT.This follows the TXT refiner's approach:
refine_subtitle_translationsnow attaches the refined subtitles toRateLimitError.partial_resultbefore re-raising, as a position-keyed dict. Subtitles not refined yet keep their draft text.refine_srt_filecatches the error and writes that partial result with the sameupdate_translated_subtitles/reconstruct_srtpath as a normal save, then re-raises so auto-pause still triggers. The write is factored into_write_refined_srt.Tests: added
test_refine_srt_rate_limit_saves_refined_cues. A fake client refines the first block and then returns a 429. The test checks that the error still propagates and that the output has the first cue refined and the other two unchanged, under their own timestamps. It fails onmainbecause no output file is written, and passes with this change.test_srt_refine_indexing.pyandtest_rate_limit_partial_refine.pypass: 15 passed.