Skip to content

Commit 8553495

Browse files
Update hivemind_bus_client/encodings/benchmark.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 325d8fc commit 8553495

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

hivemind_bus_client/encodings/benchmark.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,12 @@ def main(sizes: str, weights: str, iterations: int):
185185

186186
sizes = list(map(int, sizes.split(",")))
187187
performance_weight, bandwidth_weight = map(float, weights.split(","))
188-
188+
189+
# Validate weights
190+
if not (0 <= performance_weight <= 1 and 0 <= bandwidth_weight <= 1):
191+
raise ValueError("Weights must be between 0 and 1")
192+
if abs(performance_weight + bandwidth_weight - 1.0) > 1e-10:
193+
raise ValueError("Weights must sum to 1")
189194
encodings_to_test = [
190195
SupportedEncodings.JSON_B64_STD,
191196
SupportedEncodings.JSON_B64,

0 commit comments

Comments
 (0)