fit: tqdm progress bar + first-prompt trace + summary; config configures loguru on import

- Jacobian.fit wraps prompts in tqdm (jlens has no bar; safe since fit only
  enumerate/len's them), logs the full first prompt (special tokens on, SHOULD
  line) and a done-summary -- token-efficient-logging style, both tqdm intervals set
- config.py sets up loguru on import (compact single-char icons, routed through
  tqdm.write so bars survive), so every script/notebook importing config gets it
- notebooks drop their manual logger setup and import config in cell 1

Co-Authored-By: Claudypoo <288921227+claudypoo@users.noreply.github.com>
This commit is contained in:
wassname
2026-07-10 16:31:25 +08:00
co-authored by Claudypoo
parent 69d7d2f1d9
commit 8fd82bf731
5 changed files with 35 additions and 6 deletions
+11
View File
@@ -9,6 +9,17 @@ template -- see chat_corpus for why.
from pathlib import Path
import torch
from loguru import logger
from tqdm.auto import tqdm
# Configure loguru once, on import, so every script/notebook that imports config
# gets the same compact format. Routed through tqdm.write so log lines don't
# break a live progress bar (e.g. the fit bar).
logger.remove()
logger.add(lambda m: tqdm.write(m, end=""), colorize=True,
format="<level>{level.icon}</level> {message}", level="INFO")
for _lvl, _icon in (("INFO", "I"), ("WARNING", "W"), ("ERROR", "E"), ("DEBUG", "D")):
logger.level(_lvl, icon=_icon)
ROOT = Path(__file__).resolve().parent
ART = ROOT / "artifacts"