#1729·tqdm

Add Support for Custom Time Units in Rate Display

Author: KobiwizardsCreated Mar 26, 2026Updated Sep 16, 2026

Currently tqdm shows rate in "it/s" (iterations per second) by default. For many real-world use cases, this isn't the most intuitive unit.

Examples:

Processing video frames → "fps" makes more sense than "it/s"

Downloading files → "MB/s" or "KB/s" would be clearer

Processing database records → "rec/s" or "rows/s" would match domain language

Training ML models → "batch/s" or "samples/s" would be more meaningful

Proposed Solution: Add a new parameter rate_unit that allows users to specify a custom unit string for the rate display. The parameter should:

Accept a string (e.g., rate_unit="fps", rate_unit="MB")

When set, replace the default "it" in it/s with the custom unit

Maintain the same rate calculation logic (no change to how rate is computed)

Be optional and default to the existing behavior

Example Usage:

python

Current behavior

for i in tqdm(range(100), unit="frame"): process_frame()

Shows: 50.00it/s (still says it/s even though unit is "frame")

Proposed behavior

for i in tqdm(range(100), unit="frame", rate_unit="frame"): process_frame()

Shows: 50.00frame/s

Or for download speeds

for chunk in tqdm(response.iter_content(), unit="B", unit_scale=True, rate_unit="B"): pass

Shows: 2.5MB/s (instead of 2.5M it/s)

Scope:

Update format_meter to accept a rate_unit parameter

Add rate_unit to tqdm class init

Update bar_format to use custom unit in rate display

Add tests for custom rate units

Update documentation

Why This Matters: Users shouldn't have to mentally translate "it/s" to their domain's terminology. The progress bar should speak their language—frames, records, bytes, batches, whatever makes sense for their specific task.