Metric missing from Run Summary and sweep results

I am running wandb 0.16.6 and have run into a weird issue.

I am sweeping hyperparameters, and the metric I am optimizing appears in the run history / charts, but is missing from the run summary? This means the sweep doesn’t work.
This metric is in every report and is a float.

One point is that this is a quick experiment (1 minute), so that could be the issue, however all other metrics are reported.

This a reply from our support bot designed to assist you with your WandB-related queries.
To reach a human please reply to this message.

When you encounter an issue where a specific metric is visible in the run history/charts but not appearing in the run summary, thus affecting the functionality of your sweep, there are several steps you can take to troubleshoot and ensure all metrics appear correctly in the run summary during a sweep. Here are some suggestions:

  1. Ensure Proper Logging: Make sure that the metric you’re optimizing is being logged correctly with wandb.log(). For metrics to appear in the run summary and be used by sweeps, they must be logged in each training loop or evaluation step.

  2. Log at the End of Your Script: For quick experiments, it’s crucial to ensure that metrics are logged before the script ends. Sometimes, if the script ends too quickly after logging the last metric, it might not get synced properly. Consider adding a slight delay or ensuring the metric is logged well before the script concludes.

  3. Explicitly Set Summary Metrics: If a metric is crucial for your sweeps, you can explicitly set it in the run summary to ensure it’s recognized by the sweep. Use["metric_name"] = value to manually set the metric in the summary.

  4. Check for Compatibility Issues: While it’s not directly mentioned that version 0.16.6 has known issues with sweep functionality, it’s always a good idea to check the official changelog or the W&B community forums for any known issues or updates that might affect sweeps.

  5. Review Sweep Configuration: Double-check your sweep configuration to ensure that the metric is correctly specified under the metric section with the appropriate name and goal. This helps W&B understand which metric to optimize for.

  6. Update W&B: If you’re facing compatibility issues or bugs, updating to the latest version of W&B might resolve the issue. Use pip install --upgrade wandb to update to the latest version.

  7. Contact Support: If after trying the above steps, you’re still facing issues, consider reaching out to W&B support at with details of your issue, including your sweep configuration and the specific metric that’s not appearing in the run summary.

Here’s a general example of how to log metrics and ensure they appear in the run summary:

import wandb

# Initialize your W&B run

# Your training loop or experiment
for step in range(training_steps):
    # Simulate training and metric calculation
    metric_value = train_and_evaluate_model()
    # Log the metric for this step
    wandb.log({"metric_name": metric_value})

# Explicitly set the metric in the run summary if necessary["metric_name"] = metric_value

# Finish the run

Remember, for the metric to be used effectively in sweeps, it must be logged consistently across all runs and correctly specified in your sweep configuration.

-WandBot :robot:

Hi Joe, since we have not heard back from you we are going to close this request. If you would like to re-open the conversation, please let us know!