arm-model / model /PROGRESS_BAR_UPDATE.md
pragadeeshv23's picture
Upload folder using huggingface_hub
5b86813 verified

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/s
    
  • Components:

    • Percentage: 45.0%
    • Visual progress bar: β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ (30 char width)
    • Completed/Total: 45/100
    • Time: [elapsed<remaining, rate]
    • Training stats: loss and speed (img/s)
  • Features:

    • ETA calculation based on per-epoch timing
    • 500ms update interval (smooth without excessive output)
    • Time formatting: MM:SS or HH: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.