fix: add default writer_batch_size to prevent pyarrow offset overflow#1059
Open
dieutx wants to merge 2 commits intoPrimeIntellect-ai:mainfrom
Open
fix: add default writer_batch_size to prevent pyarrow offset overflow#1059dieutx wants to merge 2 commits intoPrimeIntellect-ai:mainfrom
dieutx wants to merge 2 commits intoPrimeIntellect-ai:mainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
…PrimeIntellect-ai#230) Datasets with large strings (e.g. serialized test cases in coding datasets like DeepCoder) cause pyarrow offset overflow during dataset.map() calls. Set writer_batch_size=200 by default so pyarrow writes smaller batches and stays within the 2GB Arrow array limit.
Addresses review feedback: documents the new writer_batch_size=200 default and how users can override it via map_kwargs.
acc51fe to
e08dc65
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Closes #230.
lcbv5subset) cause pyarrow offset overflow duringdataset.map()calls because the default batch size produces Arrow arrays exceeding the 2 GB limit.writer_batch_size=200as a default inEnvironment.__init__(propagated to all internal.map()calls viamap_kwargs) and in the standaloneformat_dataset/load_example_datasetutilities.writer_batch_sizeby passing it explicitly inmap_kwargs.Changes
verifiers/envs/environment.py-- copymap_kwargsto avoid mutating the shared mutable default, thensetdefault("writer_batch_size", 200).verifiers/utils/data_utils.py-- same default informat_dataset(), and explicitwriter_batch_size=200inload_example_dataset()'s.map()call.Test plan
uv run pytest tests/test_env_group.py tests/test_message_utils_multimodal.py)uv run ruff checkanduv run ruff formatcleanNote
Medium Risk
Changes default HuggingFace
Dataset.map()batching across environment dataset formatting and example dataset utilities, which could affect performance/memory and any callers relying on previous implicit defaults.Overview
Prevents pyarrow
ArrowInvalid: offset overflowon datasets with very large string fields by defaulting HuggingFace.map()writer_batch_sizeto200.Environmentnow copiesmap_kwargs(avoiding mutation of the default dict) and applies the default viasetdefault, whileformat_dataset()andload_example_dataset()apply the same default (including an explicitwriter_batch_size=200on the example preprocessing.map()). Documentation adds an FAQ explaining the error and how to overridewriter_batch_sizewhen needed.Written by Cursor Bugbot for commit e08dc65. This will update automatically on new commits. Configure here.