-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
|
||
# | ||
# | ||
voir > 0.2.10 | ||
voir >= 0.2.15 | ||
torchcompat >= 1.0.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
|
||
# | ||
# | ||
voir > 0.2.10 | ||
voir >= 0.2.15 | ||
torchcompat >= 1.0.0 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
|
||
# | ||
# | ||
voir > 0.2.10 | ||
voir >= 0.2.15 | ||
torchcompat >= 1.0.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
"""This file is generated, do not modify""" | ||
|
||
__tag__ = "v0.0.6-140-g57343f1" | ||
__commit__ = "57343f10ef2b4ce598011ee308ebd06b4c654495" | ||
__date__ = "2024-06-10 11:52:37 -0400" | ||
__tag__ = "v0.0.10-145-gc151b985" | ||
__commit__ = "c151b98546f32d9c0671507f8526ed13598e3407" | ||
__date__ = "2024-06-11 14:30:04 -0400" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ install_prepare() { | |
|
||
# | ||
# Generate/download datasets, download models etc... | ||
# | ||
milabench prepare | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ install_prepare() { | |
|
||
# | ||
# Generate/download datasets, download models etc... | ||
# | ||
milabench prepare | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import time | ||
|
||
import pytest | ||
|
||
from benchmate.metrics import TimedIterator, StopProgram | ||
|
||
|
||
class CPUEvent: | ||
def __init__(self, **kwargs): | ||
self.start = 0 | ||
|
||
def record(self): | ||
self.start = time.time() | ||
|
||
def elapsed_time(self, end): | ||
# shoudl return ms | ||
return (end.start - self.start) * 1000 | ||
|
||
def synchronize(self): | ||
pass | ||
|
||
|
||
def test_wrapper(): | ||
batch = [1, 2] | ||
process_time = 0.1 | ||
|
||
iterable = [(batch, 3) for i in range(10)] | ||
messages = [] | ||
|
||
def push(**kwargs): | ||
nonlocal messages | ||
messages.append(kwargs) | ||
|
||
loader = TimedIterator( | ||
iterable, event_fn=CPUEvent, earlystop=50, raise_stop_program=True, push=push | ||
) | ||
|
||
with pytest.raises(StopProgram): | ||
for e in range(200): | ||
for i in loader: | ||
time.sleep(process_time) | ||
|
||
assert len(messages) == 117 | ||
|
||
rate_acc = 0 | ||
rate_count = 0 | ||
for msg in messages: | ||
if rate := msg.get("rate"): | ||
rate_acc += rate | ||
rate_count += 1 | ||
|
||
assert rate_count == 50, "Program should stop once we reached the necessary count" | ||
assert ( | ||
abs((rate_acc / rate_count) - len(batch) / process_time) < 0.5 | ||
), "Computed rate should be close to theorical rate" |