Skip to content

Support class encoding list-valued columns - #8645

Open
lindicaphxag-tech wants to merge 1 commit into
huggingface:mainfrom
lindicaphxag-tech:contrib/class-encode-sequence-6267
Open

lindicaphxag-tech wants to merge 1 commit into
huggingface:mainfrom
lindicaphxag-tech:contrib/class-encode-sequence-6267

Conversation

@lindicaphxag-tech

Copy link
Copy Markdown

Fixes #6267

class_encode_column currently rejects list-valued columns even when the feature is List(Value(...)). That makes multi-label datasets fall back to manually collecting labels and calling cast_column.

This change accepts List(Value(...)) columns, collects class names from the list elements, and maps each element while preserving the outer list structure. Scalar columns keep their existing behavior.

Added a regression test covering repeated labels and empty lists.

Tested locally:

PYTHONPATH=src python -m pytest tests/test_arrow_dataset.py -k class_encode -q
6 passed

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.

Multi label class encoding

1 participant