Skip to content

Commit

Permalink
Fix using ended span
Browse files Browse the repository at this point in the history
  • Loading branch information
MsRandom committed Nov 24, 2024
1 parent feb54ef commit d904ed3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
14 changes: 1 addition & 13 deletions neuron/neuron/submission_tester/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def compare_checkpoints(
vram_used = max(output.vram_used for output in outputs) - start_vram
watts_used = max(output.watts_used for output in outputs)

with tracer.start_span("compare_outputs") as compare_span:
with tracer.start_span("compare_outputs"):
with CURRENT_CONTEST.output_comparator() as output_comparator:
def calculate_similarity(comparator: OutputComparator, baseline_output: GenerationOutput, optimized_output: GenerationOutput):
try:
Expand Down Expand Up @@ -191,18 +191,6 @@ def calculate_similarity(comparator: OutputComparator, baseline_output: Generati
min_similarity=min_similarity,
)

compare_span.set_attributes({
"benchmark.samples": len(inputs),
"benchmark.score": benchmark.calculate_score(baseline.metric_data),
"benchmark.average_similarity": average_similarity,
"benchmark.min_similarity": min_similarity,
"benchmark.average_generation_time": average_time,
"benchmark.model_size": size,
"benchmark.model_load_time": sandbox.load_time,
"benchmark.vram_usage": vram_used,
"benchmark.power_usage": watts_used,
})

logger.info(
f"Tested {len(inputs)} Samples\n"
f"Score: {benchmark.calculate_score(baseline.metric_data)}\n"
Expand Down
1 change: 1 addition & 0 deletions validator/weight_setting/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ def get_uid(hotkey: Key) -> Uid | None:

self.sleep_for_blocks(now, epoch_length / 4, "Benchmarking in progress")

@tracer.start_as_current_span("sleep_for_blocks")
def sleep_for_blocks(self, now: datetime, blocks: int, reason: str):
next_noon = datetime.combine(now.date() + timedelta(days=int(now.hour >= 12)), time(12), tzinfo=TIMEZONE)
blocks_to_sleep = min(blocks, ceil((next_noon - now).total_seconds() / 12))
Expand Down

0 comments on commit d904ed3

Please sign in to comment.