[fix] Rotate pre-existing internal_medicine.jsonl on fresh start#4755
Merged
From00 merged 2 commits intoJul 9, 2026
Conversation
Before: _maybe_truncate_on_resume only handled resume_from_checkpoint (state.global_step > 0). On a fresh restart (state.global_step == 0) with a leftover jsonl from a previous crashed / Ctrl+C'd run, the new run just appended after step-58 rows with step-1 rows, producing a non-monotonic global_step axis that confuses the viewer. After: On resume_step == 0, if a leftover jsonl exists, rotate it to <log_path>.bak.<YYYYMMDD_HHMMSS> and start fresh. Existing checkpoint resume path (resume_step > 0) is unchanged. Old runs are not deleted, just moved aside; users can inspect the .bak files if they want the historical data.
risemeup1111
reviewed
Jul 8, 2026
risemeup1111
left a comment
Contributor
There was a problem hiding this comment.
已完成首轮 review,未发现需要阻塞合入的问题。一个非阻塞的边界场景已放在行级评论中;当前仍有部分 CI 任务运行中,建议等 CI 全部结束后再合入。
Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.
Co-authored-by: risemeup1111 <13125134909@163.com>
risemeup1111
approved these changes
Jul 8, 2026
risemeup1111
left a comment
Contributor
There was a problem hiding this comment.
已复查新提交,上一轮关于备份文件名冲突的意见已在当前代码中修复,未发现新的需要阻塞合入的问题。当前还有部分 CI 任务未完成,建议等 CI 全部结束后再合入。
Powered by Nyanpasu with gpt-5.5 xhigh, please check the suggestions carefully.
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.
PR types
Bug fixes
PR changes
APIs
Description
问题
InternalMedicineCallback._maybe_truncate_on_resume目前只处理resume_from_checkpoint场景(state.global_step > 0)。当 fresh restart(state.global_step == 0)且已有前一次 crash / Ctrl+C 中断留下的老 jsonl 时,新 run 会直接在老 step-58 行之后 append 新 step-1 行,导致global_step轴出现非单调,viewer 画图时曲线错乱:修复
resume_step == 0时,若已存在老 jsonl,则将其 rotate 为<log_path>.bak.<YYYYMMDD_HHMMSS>,新 run 从空文件开始写;resume_step > 0(真正的 checkpoint resume)路径不变,仍然截尾保留global_step <= resume_step的行。老数据不删除,只是改名备份到
.bak.*文件;用户仍可从这些文件里查看历史数据。行为矩阵
.bak.<ts>,新 run 从空文件开始global_step <= resume_step的行(原有逻辑)