Skip to content

(test): add deterministic coverage for collator utilities - #247

Merged
PanAndy merged 1 commit into
alibaba:mainfrom
noemotiovon:ut
Dec 1, 2025
Merged

(test): add deterministic coverage for collator utilities#247
PanAndy merged 1 commit into
alibaba:mainfrom
noemotiovon:ut

Conversation

@noemotiovon

Copy link
Copy Markdown
Contributor

What does this PR do?

  • replace the previous ad-hoc script in tests/datasets/test_collator.py with real unit tests that don’t depend on downloading HF models
  • introduce a DummyTokenizer stub so DataCollatorWithPaddingForPaddedKeys can be exercised offline with predictable padding semantics
  • add coverage for collate_fn_to_dict_list to ensure it merges tensor fields and np.ndarray-backed metadata correctly
  • verify DataCollatorWithPaddingForPaddedKeys pads input_ids, attention_mask, labels, computes position_ids, and preserves unpadded auxiliary data as numpy object arrays

- replace the previous ad-hoc script in tests/datasets/test_collator.py
  with real unit tests that don’t depend on downloading HF models
- introduce a DummyTokenizer stub so DataCollatorWithPaddingForPaddedKeys
  can be exercised offline with predictable padding semantics
- add coverage for collate_fn_to_dict_list to ensure it merges tensor
  fields and np.ndarray-backed metadata correctly
- verify DataCollatorWithPaddingForPaddedKeys pads input_ids,
  attention_mask, labels, computes position_ids, and preserves
  unpadded auxiliary data as numpy object arrays
@PanAndy
PanAndy merged commit 7d09e85 into alibaba:main Dec 1, 2025
2 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.

2 participants