Skip to content

Conversation

@f14-bertolotti
Copy link
Contributor

I’m not entirely sure this is the ideal approach, but here’s what I found:

batched_metrics returns a structure like:

{
  "metric_name": [1, 2, 3, 4]
}

Because of this additional dictionary layer, the aggregation step was throwing an IndexError. The issue can be resolved by extracting the metric name and its corresponding batch directly, rather than operating on the dictionary as-is.

@francesco-bertolotti francesco-bertolotti force-pushed the f14-batched-metric-aggregation-fix branch from c8316a3 to c511308 Compare November 18, 2025 16:12
@HuggingFaceDocBuilderDev
Copy link
Collaborator

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@NathanHB NathanHB requested a review from Copilot November 20, 2025 13:36
Copilot finished reviewing on behalf of NathanHB November 20, 2025 13:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR attempts to fix an IndexError in batched metric aggregation by restructuring how metric outputs are indexed. The change modifies the loop to extract metric names and values from the batched outputs dictionary structure.

Key changes:

  • Modified the batched metric aggregation loop to zip metrics with their outputs
  • Changed indexing to extract values using metric name as dictionary key before accessing by index

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants