[Fix] alpaca_enzh_dataset passes a shuffle_before_pack kwarg neither callee accepts - #2057
Open
Anai-Guo wants to merge 1 commit into
Open
[Fix] alpaca_enzh_dataset passes a shuffle_before_pack kwarg neither callee accepts#2057Anai-Guo wants to merge 1 commit into
Anai-Guo wants to merge 1 commit into
Conversation
…not pass
`alpaca_enzh_dataset` forwards `shuffle_before_pack=True` to both
`alpaca_dataset` and `alpaca_zh_dataset`, but neither accepts that
parameter, so every call raises
TypeError: alpaca_dataset() got an unexpected keyword argument
'shuffle_before_pack'
Both callees already hardcode `shuffle_before_pack=True` on their internal
`process_hf_dataset` call, so dropping the argument keeps the behaviour
identical. `lawyer_dataset` -- the other aggregator built the same way --
already omits it.
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.
Motivation
alpaca_enzh_dataset(xtuner/apis/datasets/alpaca.py) cannot be called at all — it raisesTypeErroron its very first statement.It forwards
shuffle_before_pack=Truetoalpaca_datasetandalpaca_zh_dataset:but neither callee declares that parameter:
so both calls fail with
alpaca_enzh_datasetandalpaca_enzh_data_collatorare both re-exported fromxtuner.apis.datasets, so this is reachable straight from the public API.Modification
Drop the two
shuffle_before_pack=Truelines fromalpaca_enzh_dataset.This does not change behaviour. Both callees already hardcode
shuffle_before_pack=Trueon their internalprocess_hf_datasetcall (lines 69 and 97), so the packing shuffle stays on exactly as before — the argument was only ever redundant, and it was never accepted.lawyer_datasetin the same package is the same aggregator pattern (two sub-datasets combined withConcatDataset, forwardingtokenizer/max_length/prompt_template/remove_unused_columns/pack_to_max_length) and already omitsshuffle_before_pack. This change makesalpaca_enzh_datasetmatch that sibling.Verification
I do not have the training dependencies installed locally, so I verified this at the signature level: the real
defs and the real call sites are extracted from the file withast, aninspect.Signatureis rebuilt from the parameter list, and each call site is replayed throughSignature.bind().Before:
After:
The last two lines are the behaviour-equivalence check: the shuffle is still enabled inside both callees after the patch.
ruff checkandruff format --diffare clean against the repo'spyproject.tomlconfig.BC-breaking
No. The removed argument could never be passed successfully in the first place, and the effective
shuffle_before_pack=Truebehaviour is unchanged.Checklist
ruff checkandruff format --diffclean with the repo config (note:.pre-commit-config.yamlscopes its hooks toxtuner/v1/andautotest/, which does not cover this path).🤖 Generated with Claude Code