Skip to content

[compat] Fix compatibility issues with datasets v4#3445

Merged
tomaarsen merged 1 commit into
huggingface:masterfrom
tomaarsen:compat/datasets_v4
Jul 16, 2025
Merged

[compat] Fix compatibility issues with datasets v4#3445
tomaarsen merged 1 commit into
huggingface:masterfrom
tomaarsen:compat/datasets_v4

Conversation

@tomaarsen

Copy link
Copy Markdown
Member

Resolves #3443

Hello!

Pull Request overview

  • Fix compatibility issues with datasets v4
    • Fix "column addition" issue in mine_hard_negatives
    • Remove usage of Sequence, as it's been softly deprecated in favor of List (and LargeList?) in datasets v4.0.

Details

The intention of this PR is to restore full functionality, fixing some issues that popped up when datasets upgraded to v4.0.

  • Tom Aarsen

@tomaarsen
tomaarsen requested a review from Copilot July 16, 2025 08:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Fix compatibility issues with datasets v4.0, addressing column addition in mine_hard_negatives and removing deprecated Sequence usage.

  • Wrap dataset column access in list() to avoid column-addition errors in mine_hard_negatives
  • Remove Sequence import and replace its usage with a generic hasattr(feature, "feature") check in model card

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
sentence_transformers/util.py Convert dataset[column] to a list before processing in mine_hard_negatives
sentence_transformers/cross_encoder/model_card.py Drop Sequence import and change feature filtering to use hasattr
Comments suppressed due to low confidence (1)

sentence_transformers/util.py:947

  • Consider adding tests for mine_hard_negatives with datasets v4.0 to verify that column conversion to lists handles edge cases (e.g., large or streaming datasets) correctly.
    queries = list(dataset[anchor_column_name])

Comment thread sentence_transformers/util.py
Comment thread sentence_transformers/cross_encoder/model_card.py
@tomaarsen
tomaarsen merged commit 65930fa into huggingface:master Jul 16, 2025
7 of 9 checks 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.

util.mine_hard_negatives TypeError: unsupported operand type(s) for +: 'Column' and 'Column'

2 participants