Signed-off-by: haosdent <haosdent@gmail.com> Signed-off-by: Justin Wood <justin.m.wood@me.com> Signed-off-by: Matthew Bonanni <mbonanni@redhat.com> Co-authored-by: haosdent <haosdent@gmail.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Justin Wood <jwood@me.com>
This commit is contained in:
co-authored by
haosdent
Claude Opus 4.7
Justin Wood
parent
b7c20d0cfa
commit
58b2012aa2
@@ -67,6 +67,23 @@ def test_memory_profiling():
|
||||
non_torch_ratio = result.non_torch_increase / (256 * 1024 * 1024) # noqa
|
||||
assert abs(non_torch_ratio - 1) <= 0.05
|
||||
assert result.torch_peak_increase == 1024 * 1024 * 1024
|
||||
|
||||
expected_total_consumed = (256 + 512) * 1024 * 1024
|
||||
total_consumed_ratio = result.total_consumed / expected_total_consumed
|
||||
assert abs(total_consumed_ratio - 1) <= 0.05, (
|
||||
f"total_consumed={result.total_consumed}, "
|
||||
f"expected={expected_total_consumed}, "
|
||||
f"ratio={total_consumed_ratio}"
|
||||
)
|
||||
|
||||
expected_non_kv = expected_total_consumed + 1024 * 1024 * 1024
|
||||
non_kv_ratio = result.non_kv_cache_memory / expected_non_kv
|
||||
assert abs(non_kv_ratio - 1) <= 0.05, (
|
||||
f"non_kv_cache_memory={result.non_kv_cache_memory}, "
|
||||
f"expected={expected_non_kv}, "
|
||||
f"ratio={non_kv_ratio}"
|
||||
)
|
||||
|
||||
del weights
|
||||
lib.cudaFree(handle1)
|
||||
lib.cudaFree(handle2)
|
||||
|
||||
Reference in New Issue
Block a user