Repository navigation
Keep the weights download progress output short in logs - #6
Merged
Merged
Conversation
urlretrieve calls the progress hook for every 8 KB block, about 8,000 times for the weights, and each call rewrote the progress line. In a terminal it now redraws only when the whole percentage changes; when stderr is not a terminal it writes one line per 10%. Fixes #5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assisted-by: claude-code (claude-opus-5-5)
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.
What changed
The progress hook for the first-time weights download (
src/subcellseg/weights.py) is now a small_Progressclass that writes only when the shown value changes:nohup, SLURM logs, notebooks): one line per 10% (11 lines);Download, SHA-256 check and caching are unchanged.
Fixes #5.
Why
urlretrievecalls the hook for every 8 KB block, about 8,000 times for the 64 MB weights, and each call rewrote the line. Any captured log got ~150 KB of0 / 64 MB (0%)text.How it was tested
pytest: 13 passed on Linux (CPU), including 2 new cases checking the output for both the terminal and non-terminal paths.SUBCELLSEG_CACHE_DIR:script)The downloaded file's SHA-256 is unchanged (
858689a3…). Segmentation code is untouched, so nobench_predict.shrun is needed.Checklist
pytest)CHANGELOG.mdhas an entry under Unreleased (if a user would notice)Assisted-by:trailer (written with Claude Code; for the maintainer to review)Assisted-by: claude-code (claude-opus-5-5)
🤖 Generated with Claude Code