Skip to content

Commit

Permalink
Log original submission UID in duplication errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MsRandom committed Oct 18, 2024
1 parent dddf9b5 commit c92e05a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions validator/weight_setting/deduplication.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from dataclasses import dataclass
from collections.abc import Iterator

from imagehash import ImageHash

Expand All @@ -12,7 +13,7 @@ class PotentiallyDuplicateSubmissionInfo:
block: int


def find_duplicates(benchmark_info: list[PotentiallyDuplicateSubmissionInfo | None]):
def find_duplicates(benchmark_info: list[PotentiallyDuplicateSubmissionInfo | None]) -> Iterator[tuple[int, int]]:
duplicate_buckets: list[set[int]] = []

for uid_a, benchmark_a in enumerate(benchmark_info):
Expand Down Expand Up @@ -43,4 +44,4 @@ def find_duplicates(benchmark_info: list[PotentiallyDuplicateSubmissionInfo | No

for uid in bucket:
if uid != oldest:
yield uid
yield uid, oldest
4 changes: 2 additions & 2 deletions validator/weight_setting/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,9 +846,9 @@ async def do_step(self, block: int):
for uid, benchmark in enumerate(self.benchmarks)
]

for duplicate_uid in find_duplicates(benchmark_duplicate_info):
for duplicate_uid, original_uid in find_duplicates(benchmark_duplicate_info):
self.benchmarks[duplicate_uid] = None
self.invalid[duplicate_uid] = "Duplicate submission"
self.invalid[duplicate_uid] = f"Duplicate submission of UID '{original_uid}'"

self.benchmarking = False
self.step += 1
Expand Down

0 comments on commit c92e05a

Please sign in to comment.