Changes: Remove tqdm, Add Custom Pip-Style Progress Bar
Summary
Removed dependency on tqdm library and implemented a custom pip-style training progress bar using only standard Python libraries (sys, time, threading).
Files Modified
Changes Made
1. Removed Imports (Line 1-30)
Before:
from rich.progress import (...)
from tqdm import tqdm
After:
import threading
import time
2. Custom Progress Bar Implementation (Line 386-462)
Replaced tqdm-based progress rendering with custom _render_progress() function that:
Displays real-time progress with visual bar:
training: 45.0%|βββββββββββββββββββββ| 45/100 [00:30<00:40, 1.37 epoch/s] loss=0.3421 24.50img/sComponents:
- Percentage:
45.0% - Visual progress bar:
βββββββββββββββββββββ(30 char width) - Completed/Total:
45/100 - Time:
[elapsed<remaining, rate] - Training stats:
lossandspeed(img/s)
- Percentage:
Features:
- ETA calculation based on per-epoch timing
- 500ms update interval (smooth without excessive output)
- Time formatting:
MM:SSorHH:MM:SS - Final progress line includes newline for clean finish
Benefits
β
Zero external dependencies - no tqdm, rich, or other progress bar libraries
β
Lightweight - uses only standard library
β
Pip-style format - familiar to Python developers
β
Real-time stats - displays loss and speed alongside progress
β
ETA calculation - estimates remaining time
β
Threading-safe - background thread updates don't block training
Example Output
training: 0.0%|ββββββββββββββββββββββββββββ| 0/100 [00:00<00:40, 0.00 epoch/s] loss=0.5000 24.50img/s
training: 10.0%|ββββββββββββββββββββββββββββ| 10/100 [00:10<00:35, 1.00 epoch/s] loss=0.4700 24.50img/s
training: 20.0%|ββββββββββββββββββββββββββββ| 20/100 [00:20<00:30, 1.00 epoch/s] loss=0.4400 24.50img/s
...
training:100.0%|ββββββββββββββββββββββββββββββ| 100/100 [00:50<00:00, 2.00 epoch/s] loss=0.2000 24.50img/s
Usage
No changes needed - progress bar appears automatically during training via background thread.
Testing
Demo script created: demo_progress_bar.py demonstrates the progress bar output format.