feat: add datasets_v2 module and SFT-V2 training pipeline#4435
feat: add datasets_v2 module and SFT-V2 training pipeline#4435weiyixuanxx wants to merge 22 commits into
Conversation
Introduce a new data loading and encoding pipeline (datasets_v2) with: - Schema-based dataset registry with preprocessor auto-detection - Independent template system (chatml, llama3, deepseek3, etc.) - Lazy encoding dataset with packing and flashmask support - SFT-V2 workflow (workflow2.py) integrated via stage routing Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Thanks for your contribution! |
|
only test |
…: SFT_v2. Not all features are supported yet, and the overall pipeline still needs to be reviewed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/re-run all-failed |
Previously blocked by .gitignore global `dataset/` rule. This fixes the CI ModuleNotFoundError for paddleformers.datasets_v2.dataset. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Please upload reports for the commit e76fd39 to get more accurate results. ❌ Your patch status has failed because the patch coverage (22.12%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #4435 +/- ##
==========================================
Coverage ? 45.64%
==========================================
Files ? 501
Lines ? 93720
Branches ? 0
==========================================
Hits ? 42774
Misses ? 50946
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…enhancements Migrate all missing template features from old datasets/ pipeline into datasets_v2/ as independent code (no cross-imports): - ReasoningTemplate (encode_multiturn_reasoning, thought tag management) - Tool calling (tool_utils.py with 9 model-specific formatters) - Function/Observation role support in encode_multiturn - fix_special_tokens and parse_template utilities - Grounding plugin (grounding_plugin.py) - mm_plugin for VL-SFT support - 25 registered templates (qwen3/3.5/vl, glm4/moe/v, ernie/vl, etc.) Also includes: streaming dataset, packing improvements, collate enhancements, workflow2 updates, and comprehensive tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The file was imported in __init__.py but never committed, causing ModuleNotFoundError in CI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/re-run all-failed |
3 similar comments
|
/re-run all-failed |
|
/re-run all-failed |
|
/re-run all-failed |
…g features - Extract 8 shared helpers (_dispatch_encode, _flatten_turns, _apply_dynamic_eos, _apply_efficient_eos, _apply_label_shift, _apply_truncation, _apply_auto_bos, _validate_and_build) to eliminate duplication between encode_sft and encode_vl_sft - Align template.py with old pipeline: reasoning dispatch, GLM5 close-tag-only thought - Switch CI config yamls to stage: SFT-V2 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/re-run all-failed |
…aset_type default - Add ErnieKitPreprocessor to convert src/tgt format to messages - Expand schema _ALLOWED_MESSAGE_KEYS to include tool_calls/tool_call_id/name/tools - Add dataset_format parameter to load_dataset() with priority-based dispatch - Pass train_dataset_type/eval_dataset_type as format hints in workflow2 - Change DataArguments.dataset_type default from "iterable" to "map" (fixes packing conflict) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PaddleFormers Log Analysis
日志分析报告
失败的测试 case: 根本原因分析:
修复建议:
🔄 每次 Re-run 后自动更新 |
…pipeline The previous commit changed DataArguments.dataset_type default from "iterable" to "map", which broke all Fleet CI tests (VL-SFT, FSDP, XPU) because the old pipeline uses dataset_type to select between MapSFTDataset and IteratorSFTDataset — completely different implementations. Fix: keep default as "iterable" (old pipeline untouched), and handle packing compatibility inside workflow2.py (V2 auto-switches to map when packing is enabled). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/re-run all-failed |
1 similar comment
|
/re-run all-failed |
Implement DPO training in the V2 data pipeline without modifying old code: - encode_dpo(): forked sequence encoding with shared prefix detection - collate_dpo(): batch collation with block-causal attention mask - workflow2.py: DPO-V2 workflow reusing existing DPOTrainer - ErnieKit preprocessor: extended to handle DPO format (response+sort) - Route stage "DPO-V2" to run_dpo_v2() in tuner.py Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move SFT-V2, DPO, and DPO-V2 imports inside their respective elif branches so that old pipeline stages (SFT, PT) never trigger the datasets_v2 import chain. This eliminates potential side-effects during distributed initialization (PP+TP). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/re-run all failed |
|
/re-run all-failed |
- tuner.py: import run_dpo at module level (old DPO pipeline, no datasets_v2 dependency) so patch.object in tests works correctly - dpo/__init__.py: use module __getattr__ to lazy-load run_dpo_v2, preventing workflow2.py (which imports datasets_v2) from being loaded until DPO-V2 stage is actually invoked Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…pipeline sft/__init__.py eagerly imported workflow2.py and workflow_vl_v2.py, which pull in paddleformers.datasets_v2. This caused the datasets_v2 module to be loaded even for old pipeline stages (SFT, PT), potentially triggering side-effects in distributed environments (PP+TP on Iluvatar). Use module __getattr__ to defer loading until SFT-V2/VL-SFT-V2 is actually invoked. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Qwen3VLTextProvider does not define separate_mtp_headloss attribute. Use getattr with default False to avoid AttributeError for providers that lack this field. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/re-run all failed |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/re-run all failed |
2 similar comments
|
/re-run all failed |
|
/re-run all failed |
…tains eos_token parse_template auto-detects whether the assistant format slot already includes the eos token. If so, set efficient_eos=False to prevent _apply_efficient_eos from appending a redundant eos_token_id. This fixes a 1-token encoding mismatch vs the old pipeline that caused training loss divergence. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…eFormers into dev_dataset_v2
- StreamingDataset: add lazy parameter for true streaming (lazy=True) vs V1-compat materialization mode (lazy=False), controlled by lazy_data_processing in training_args - workflow2.py: simplify dataset routing logic, wire lazy param - workflow_vl_v2.py / dpo/workflow2.py: align with updated API - template.py / encode.py: improve multi-modal and DPO encoding - Remove deprecated data_args fields (random_shuffle etc.) - docs: remove ms-swift references from design document Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Introduce a new data loading and encoding pipeline (datasets_v2) with:
Before submitting
testsfolder. If there are codecov issues, please add tests cases first.PR types
PR changes
Description