Weights download progress line floods non-terminal logs

未关闭 适合新手
#5 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
83/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
cli

调研方向

进度输出由 src/subcellseg/weights.py 中的 _report_progress 写入;先阅读该函数以及它如何使用 urlretrieve 和 stderr。使用 issue 中的命令复现,并将 stderr 捕获到文件中。完成的标准是,非终端日志中只有偶尔出现的进度更新,而不是每个下载块都占一行,同时下载和校验和仍能完成。

由索引模型根据 Issue 内容生成。

描述

enhancement good first issue

What happens

On first use, subcellseg predict downloads the pretrained weights (64 MB) and prints a progress line from _report_progress in src/subcellseg/weights.py. The line is rewritten with \r on every urlretrieve block (8 KB), which is about 8,000 writes for one download.

In a terminal this looks fine. When stderr is not a terminal (CI logs, nohup, SLURM output files, notebook cells), every redraw is kept. A single download on 2026-11-11 produced about 150 KB of repeated 0 / 64 MB (0%) text.

Nothing is functionally wrong: the download completes, the SHA-256 check passes, and the segmentation is unaffected.

Suggested fix

  • Write a new line only when the whole-number percentage changes (at most 100 updates), and
  • when sys.stderr.isatty() is false, print only a start line and a done line (or one line every 10%).

How to reproduce

SUBCELLSEG_CACHE_DIR=$(mktemp -d) subcellseg predict --input in --output out 2> log.txt
wc -c log.txt
主要语言
Python
星标
0
派生
0
平均合并
4 小时 27 分钟
30 天内合并 PR
4

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。