Add better handling of sft vs pretrain dataset selection#119
Open
RaphaelKreft wants to merge 1 commit into
Open
Add better handling of sft vs pretrain dataset selection#119RaphaelKreft wants to merge 1 commit into
RaphaelKreft wants to merge 1 commit into
Conversation
Author
|
Would be interested about you opinion on this design. I think its quite clean. If you agree I will test it on the cluster and merge |
Collaborator
|
I agree, thanks for taking care of this! |
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.
What changed
Old: a substring check (
"apertus_sft" in dataset_path) decided whether a dataset wasApertusSFTDatasetorGPTDataset. It ignored--ap-sft.New: an explicit per-entry marker
sft:<prefix>/pretrain:<prefix>(case-insensitive). Mixed SFT + pretrain blends are now more explicit.Applies to every blend arg (
--data-path,--{train,valid,test}-data-path,--data-args-path,--per-split-data-args-path).Precedence (first match wins)
sft:/pretrain:on the path--ap-sftsetApertusSFTDataset--ap-sftnot set, path containsapertus_sftApertusSFTDatasetDeprecationWarningGPTDatasetNonepathMockGPTDatasetOnly the leading marker is stripped (
sft:sft:/x→ typesft, pathsft:/x). Empty path after marker (sft:) raisesAssertionError. Cache identity is keyed on the stripped path.Behavior diff vs before
--ap-sft --data-path 1.0 /data/dollyGPTDataset(latent bug — flag was ignored)ApertusSFTDataset(rule 2)sft:+pretrain:entries--data-path 1.0 /data/apertus_sft_fooDeprecationWarningSFT:/data/x(uppercase)ApertusSFTDatasetapertus_sftin path--ap-sftsemanticsStill required for any SFT run. It now does two things:
--calculate-per-token-lossassertion + SFT loss-reduction paths (unchanged).Rule of thumb: all-SFT → set
--ap-sft, no markers needed. Mixed → set--ap-sft+ mark every entry explicitly. All-pretrain → neither.Migration
--ap-sftlaunchers: no change needed.apertus_sftin the name: still work, but emitDeprecationWarning— migrate tosft:when convenient.apertus_sft: prefix withpretrain:to opt out of the legacy fallback.Implementation
megatron/core/datasets/utils.py—split_dataset_type_marker()megatron/core/datasets/blended_megatron_dataset_builder.py—_resolve_dataset_class()megatron/core/datasets/gpt_dataset.py—GPTDatasetConfig.ap_sft_auto_tagpretrain_gpt.py,initialize_sft_dataset.pymegatron/training/arguments.py(--data-path,--ap-sft)scripts/tools/create_weighted_data_config.py --dataset-type {sft,pretrain,none}tests/unit_tests/data/test_dataset_type_marker.py