Skip to content

Fix KeyError: 'low_quality' in AlanDataset#3

Open
wang-h wants to merge 1 commit intoHINTLab:mainfrom
wang-h:fix-low-quality-keyerror
Open

Fix KeyError: 'low_quality' in AlanDataset#3
wang-h wants to merge 1 commit intoHINTLab:mainfrom
wang-h:fix-low-quality-keyerror

Conversation

@wang-h
Copy link

@wang-h wang-h commented Mar 9, 2026

Bug Fix

This PR fixes #2 - the KeyError when 'low_quality' column is missing from info.csv.

Problem

When loading the Alan dataset, if the CSV file doesn't have a 'low_quality' column, the code fails with:

Solution

  • Added filter_low_quality parameter (default True for backward compatibility)
  • Check if 'low_quality' column exists before attempting to filter
  • Print warning when column is expected but not found, then use all samples
  • Added validation for required columns with clear error messages

Changes

  • Backward compatible - existing code continues to work
  • Graceful fallback when optional columns are missing
  • Better error messages for missing required columns

Usage

- Add filter_low_quality parameter (default True for backward compat)
- Check if 'low_quality' column exists before filtering
- Add clear error message for missing required columns
- Print warning when low_quality column is expected but not found
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.

KeyError: 'low_quality'

1 participant