[BUG]: simple/ovl.py bench crashes with TypeError or ZeroDivisionError when stream yields <= 50 updates
Maintainers usually reply within 1 day
@AdityasagarR123 is already working on this.
Since Oct 26, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Read simple/ovl.py and inspect cmd_bench, especially the warm-up loop and throughput calculation. Run the provided command with a data directory that yields fewer than 51 Wikipedia batches to reproduce the failure. Done when empty and short streams exit with a clear message or are handled safely, while a normal benchmark still reports valid throughput.
Written by the indexing model from the issue text.
Description
Bug Description
In simple/ovl.py, the bench command measures throughput (ms_per_update) by iterating over the Wikipedia data stream. It assumes that more than 50 updates will always be executed and hardcodes a 50-step warm-up before initializing t0 = time.time():
def cmd_bench(a):
model, opt = fresh()
ctl, n, t0 = initial_control(), 0, None
for b, _ in prefetch(a.data, "wikipedia", [0, 0]):
loss, ctl["cursor"], _ = step(model, opt, b, ctl)
n += 1
if n == 50:
if DEV == "cuda": torch.cuda.synchronize()
t0 = time.time()
if t0 and time.time() - t0 >= a.seconds:
break
if DEV == "cuda": torch.cuda.synchronize()
ms = 1000 * (time.time() - t0) / (n - 50)
total = RECIPE["schedule"]["wikipedia_updates"]
print(json.dumps({"ms_per_update": round(ms, 2), "updates_timed": n - 50, "loss": loss.item(),
...}))
This leads to three failure modes when running benchmarks on small/smoke datasets, interrupted runs, or streams with fewer than 51 batches:
TypeError(t0 is None): If the stream exhausts before reaching update 50 (i.e.n < 50),n == 50never triggers andt0remainsNone. Line 571 evaluatestime.time() - t0, raising:TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'ZeroDivisionError(n == 50): If the stream yields exactly 50 batches,t0is initialized on the final iteration and the loop terminates. Line 571 computes(n - 50)which is0, raising:ZeroDivisionError: division by zeroUnboundLocalError/AttributeError(n == 0): If the prefetch generator yields 0 batches (e.g. empty or exhausted stream),lossis never assigned in the loop, causing an error atloss.item().
Steps to Reproduce
Run simple/ovl.py bench on any data directory that contains fewer than 51 batches in the Wikipedia stream (e.g. testing with a small sample stream or quick smoke tests):
python simple/ovl.py bench --data tests/fixtures/simple-run --seconds 60
Logs and Screenshots
Traceback (most recent call last):
File "simple/ovl.py", line 622, in <module>
main()
File "simple/ovl.py", line 618, in main
{"train": cmd_train, "fork": cmd_fork, "verify": cmd_verify, "bench": cmd_bench, "chat": cmd_chat}[a.cmd](a)
File "simple/ovl.py", line 571, in cmd_bench
ms = 1000 * (time.time() - t0) / (n - 50)
~~~~~~~~~~~^~~~
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'
Environment Details
- OS: Windows / Linux / macOS
- Python: 3.10+
- Branch:
main
Impact
- Medium: Prevents benchmark runs from functioning on small, smoke test, or custom datasets. Instead of exiting gracefully with a clear message or adapting the warm-up window, the script crashes with unhandled tracebacks.
Suggested Solution
Add validation before computing ms to ensure sufficient updates were timed, or provide an adaptive warm-up. For example:
--- a/simple/ovl.py
+++ b/simple/ovl.py
@@ -559,8 +559,9 @@ def cmd_verify(a):
def cmd_bench(a):
model, opt = fresh()
- ctl, n, t0 = initial_control(), 0, None
+ ctl, n, t0, loss = initial_control(), 0, None, None
+ warmup_steps = 50
for b, _ in prefetch(a.data, "wikipedia", [0, 0]):
loss, ctl["cursor"], _ = step(model, opt, b, ctl)
n += 1
- if n == 50:
+ if n == warmup_steps:
if DEV == "cuda": torch.cuda.synchronize()
t0 = time.time()
if t0 and time.time() - t0 >= a.seconds:
break
+ if loss is None or n == 0:
+ sys.exit("bench error: data stream yielded 0 batches")
+ if t0 is None or n <= warmup_steps:
+ sys.exit(f"bench error: completed {n} updates; at least {warmup_steps + 1} updates are required to measure throughput after warm-up")
if DEV == "cuda": torch.cuda.synchronize()
- ms = 1000 * (time.time() - t0) / (n - 50)
+ timed_updates = n - warmup_steps
+ ms = 1000 * (time.time() - t0) / timed_updates
total = RECIPE["schedule"]["wikipedia_updates"]
- print(json.dumps({"ms_per_update": round(ms, 2), "updates_timed": n - 50, "loss": loss.item(),
+ print(json.dumps({"ms_per_update": round(ms, 2), "updates_timed": timed_updates, "loss": loss.item(),
**environment(), "projected_train_hours": round(total * ms / 3.6e6, 2),
"segments": math.ceil(total / RECIPE["boundary_every"]),
"minutes_per_segment": round(RECIPE["boundary_every"] * ms / 6e4, 1)}))
Additionally, an optional --warmup argument could be added to bench CLI arguments to allow developers to run benchmark smoke tests with smaller values (e.g., --warmup 2).
Code of Conduct
- I have joined the Discord server and will post updates there
- I have searched existing issues to avoid duplicates
- Dominant language
- Python
- Stars
- 27
- Forks
- 72
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 45
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AOSSIE-Org/OpenVerifiableLLM
-
[BUG]: ovl.py verify --weights crashes with AttributeError on checkpoint .pt filesPossibly taken @Anurag1428 claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
AOSSIE-Org/OpenVerifiableLLM#387 · 1 comment ·
Maintainers usually reply within 1 day
-
[BUG]: verify_segment accepts empty, wrong-phase, or non-positive fork exclusions as MATCHPossibly taken @Arnav0107 claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
AOSSIE-Org/OpenVerifiableLLM#385 · 3 comments ·
Maintainers usually reply within 1 day
-
[BUG]: preparation.lock install fails on macOSPossibly taken @darshith2527-sketch claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
AOSSIE-Org/OpenVerifiableLLM#357 · 3 comments ·
Maintainers usually reply within 1 day
-
[BUG]: Forked runs omit timestamps for inherited chain entriesPossibly taken @pavithra-r06 claimed this 9 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
AOSSIE-Org/OpenVerifiableLLM#334 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
[BUG]: review_ckpt.py passes a run that has .pt files no chain entry coversPossibly taken @arshil42 claimed this 9 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
AOSSIE-Org/OpenVerifiableLLM#332 · 4 comments · 1 assignee ·
Maintainers usually reply within 1 day
All issues in AOSSIE-Org/OpenVerifiableLLM
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
bad-antics/lateralus-lang#1140 ·
Maintainers usually reply within 4 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 3 days
-
fixture good first issue help wanted vendor:cisco
Difficulty 1/5 1-3 hours Newbie friendliness 85/100