Skip to content

Conversation

@TwinkleXD
Copy link

Problem

The BlockRelabelProcessor crashes with AttributeError: 'NoneType' object has no attribute 'get' when block.top_k is None.

Root Cause

The original code assumes block.top_k always exists and is not None:

confidence = block.top_k.get(block.block_type)

Solution

Add defensive checks to handle cases where block.top_k is None or missing:

  • Check if top_k attribute exists and is not None
  • Provide default confidence value (0.0) for missing cases
  • Add exception handling for relabeling process

@github-actions
Copy link
Contributor

github-actions bot commented Aug 24, 2025

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@TwinkleXD TwinkleXD force-pushed the fix-top_k-Nonetype-error branch from 7896871 to ba138b5 Compare August 24, 2025 13:47
@TwinkleXD
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Aug 24, 2025
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.

1 participant