Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +3 -0
- MANIFEST.json +555 -0
- README.md +66 -0
- SHA256SUMS +59 -0
- code/f3_filtering/build_F3_v3.py +184 -0
- code/f3_filtering/build_F3_v4.py +306 -0
- code/f3_filtering/clean_F3_stage1.py +158 -0
- code/f3_filtering/clean_F3_stage2.py +173 -0
- code/f3_filtering/clean_F3_stage3.py +101 -0
- code/f3_filtering/clean_F3_stage4.py +186 -0
- code/f3_filtering/clean_F3_stage4_calibrate.py +156 -0
- code/f3_filtering/reports/F3_stage1_report.json +26 -0
- code/f3_filtering/reports/F3_stage2_report.json +20 -0
- code/f3_filtering/reports/F3_stage3_report.json +13 -0
- code/f3_filtering/reports/F3_stage4_calibration.json +24 -0
- code/f3_filtering/reports/F3_v3_build.log +45 -0
- code/f3_filtering/reports/F3_v3_report.json +31 -0
- code/f3_filtering/reports/F3_v4_build.log +40 -0
- code/pretrain_data_prep/analyze_template_repetition.py +199 -0
- code/pretrain_data_prep/build_filtered_pretrain.py +76 -0
- code/pretrain_data_prep/dryrun_filter_repetition.py +166 -0
- code/pretrain_data_prep/reports/code_messages_pre_train_filtered_report.json +191 -0
- code/pretrain_data_prep/reports/code_messages_pre_train_filtered_stages_report.json +19 -0
- code/pretrain_data_prep/reports/dryrun_filter_report.json +90 -0
- code/pretrain_data_prep/split_filtered_by_token_length.py +86 -0
- data/f3/intermediate/F3_stage1.jsonl +3 -0
- data/f3/intermediate/F3_stage2.jsonl +3 -0
- data/f3/intermediate/F3_stage3.jsonl +3 -0
- data/f3/intermediate/F3_stage4_calibration_scores.jsonl +0 -0
- data/f3/intermediate/F3_stage4_scores.jsonl +0 -0
- environment/KNOWN_LIMITATIONS.md +54 -0
- evidence/eval/f3_refined_9p1_summary.json +27 -0
- evidence/instruction_recipe_results.md +43 -0
- evidence/smoke_test_results.json +38 -0
- models/pretrained/stage1_cpt/args.json +344 -0
- models/pretrained/stage1_cpt/chat_template.jinja +54 -0
- models/pretrained/stage1_cpt/config.json +57 -0
- models/pretrained/stage1_cpt/generation_config.json +10 -0
- models/pretrained/stage1_cpt/tokenizer_config.json +30 -0
- models/pretrained/stage1_cpt/trainer_state.json +0 -0
- models/sft/sft_f3_refined_instruct/args.json +344 -0
- models/sft/sft_f3_refined_instruct/chat_template.jinja +54 -0
- models/sft/sft_f3_refined_instruct/config.json +57 -0
- models/sft/sft_f3_refined_instruct/generation_config.json +14 -0
- models/sft/sft_f3_refined_instruct/tokenizer_config.json +30 -0
- models/sft/sft_f3_refined_instruct/trainer_state.json +0 -0
- tools/build_manifest.py +160 -0
- tools/smoke_test.py +84 -0
- training_scripts/README.md +11 -0
- training_scripts/pretrain/stage1_short.sh +47 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
data/f3/intermediate/F3_stage2.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
data/f3/intermediate/F3_stage1.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
data/f3/intermediate/F3_stage3.jsonl filter=lfs diff=lfs merge=lfs -text
|
MANIFEST.json
ADDED
|
@@ -0,0 +1,555 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": "delivery-0p5b-pretrain-f3refine-v1",
|
| 3 |
+
"generated_utc": "2026-08-20T12:24:01+00:00",
|
| 4 |
+
"delivery_root": "/raid/data/weifeng/MileStone_2",
|
| 5 |
+
"headline": {
|
| 6 |
+
"pretrained_model": "models/pretrained/stage1_cpt",
|
| 7 |
+
"instruction_tuned_model": "models/sft/sft_f3_refined_instruct",
|
| 8 |
+
"reported_pass_at_1_pct": 9.1,
|
| 9 |
+
"reported_pass_at_5_pct": 13.0,
|
| 10 |
+
"evaluation": "Runnable alignment benchmark; 200 tasks; 5 samples/task; 1000 attempts"
|
| 11 |
+
},
|
| 12 |
+
"exclusions": [
|
| 13 |
+
"optimizer.pt, scheduler.pt, rng_state.pth and training_args.bin are not included",
|
| 14 |
+
"upstream Qwen base/instruct checkpoints are not included",
|
| 15 |
+
"the exact May training environment snapshot was not captured"
|
| 16 |
+
],
|
| 17 |
+
"storage": {
|
| 18 |
+
"hardlinked_bytes": 13598238177,
|
| 19 |
+
"copied_or_authored_bytes": 108219,
|
| 20 |
+
"note": "Hard links save local disk; tar/zip/upload reads complete file bytes."
|
| 21 |
+
},
|
| 22 |
+
"file_count": 58,
|
| 23 |
+
"files": [
|
| 24 |
+
{
|
| 25 |
+
"path": "README.md",
|
| 26 |
+
"role": "README.md",
|
| 27 |
+
"bytes": 3354,
|
| 28 |
+
"sha256": "b9a66fd10a508e09e92335bf4b1f69124ec142805a04c70b4d9ba725d14c182f",
|
| 29 |
+
"mode": "authored",
|
| 30 |
+
"source": null,
|
| 31 |
+
"source_sha256_matches": null
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"path": "code/f3_filtering/build_F3_v3.py",
|
| 35 |
+
"role": "code",
|
| 36 |
+
"bytes": 7198,
|
| 37 |
+
"sha256": "570dfb0cd8b5991714d7c52b2d8e65ebd22a874e9d85877ab8ad22162f778ed1",
|
| 38 |
+
"mode": "copy",
|
| 39 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/build_F3_v3.py",
|
| 40 |
+
"source_sha256_matches": true
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"path": "code/f3_filtering/build_F3_v4.py",
|
| 44 |
+
"role": "code",
|
| 45 |
+
"bytes": 11482,
|
| 46 |
+
"sha256": "5107add2818270eb0309219d5b73aedc43153a1da97165750b22dae80e7f047e",
|
| 47 |
+
"mode": "copy",
|
| 48 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/build_F3_v4.py",
|
| 49 |
+
"source_sha256_matches": true
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"path": "code/f3_filtering/clean_F3_stage1.py",
|
| 53 |
+
"role": "code",
|
| 54 |
+
"bytes": 6456,
|
| 55 |
+
"sha256": "c93313faa9e23019bc87f6805d0fe1c83ab8fe4812cae1209f16d08f57e9f1a3",
|
| 56 |
+
"mode": "copy",
|
| 57 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/clean_F3_stage1.py",
|
| 58 |
+
"source_sha256_matches": true
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
"path": "code/f3_filtering/clean_F3_stage2.py",
|
| 62 |
+
"role": "code",
|
| 63 |
+
"bytes": 6045,
|
| 64 |
+
"sha256": "2b3fa3632262f4dfe49b6a20899f0d7551523c040d904d70734f2f3b6312add2",
|
| 65 |
+
"mode": "copy",
|
| 66 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/clean_F3_stage2.py",
|
| 67 |
+
"source_sha256_matches": true
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"path": "code/f3_filtering/clean_F3_stage3.py",
|
| 71 |
+
"role": "code",
|
| 72 |
+
"bytes": 2975,
|
| 73 |
+
"sha256": "13b402f6fbce073507a2b51099e6b27ae266e238597db51566025b584fa35d19",
|
| 74 |
+
"mode": "copy",
|
| 75 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/clean_F3_stage3.py",
|
| 76 |
+
"source_sha256_matches": true
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"path": "code/f3_filtering/clean_F3_stage4.py",
|
| 80 |
+
"role": "code",
|
| 81 |
+
"bytes": 6985,
|
| 82 |
+
"sha256": "f6c72da037f62154fa02ef3a7187ac80debbd82bb2fdaa2f82166311983aded3",
|
| 83 |
+
"mode": "copy",
|
| 84 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/clean_F3_stage4.py",
|
| 85 |
+
"source_sha256_matches": true
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
"path": "code/f3_filtering/clean_F3_stage4_calibrate.py",
|
| 89 |
+
"role": "code",
|
| 90 |
+
"bytes": 5483,
|
| 91 |
+
"sha256": "b41cd23f44de05d1a79385a57482af2f166ddfd73788c1fe5d6e07568922e270",
|
| 92 |
+
"mode": "copy",
|
| 93 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/clean_F3_stage4_calibrate.py",
|
| 94 |
+
"source_sha256_matches": true
|
| 95 |
+
},
|
| 96 |
+
{
|
| 97 |
+
"path": "code/f3_filtering/reports/F3_stage1_report.json",
|
| 98 |
+
"role": "code",
|
| 99 |
+
"bytes": 650,
|
| 100 |
+
"sha256": "340895ba5021dac1d8e10a47f8d6cc9899c5c7a6cefa1815760e42a7660583b2",
|
| 101 |
+
"mode": "copy",
|
| 102 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage1_report.json",
|
| 103 |
+
"source_sha256_matches": true
|
| 104 |
+
},
|
| 105 |
+
{
|
| 106 |
+
"path": "code/f3_filtering/reports/F3_stage2_report.json",
|
| 107 |
+
"role": "code",
|
| 108 |
+
"bytes": 481,
|
| 109 |
+
"sha256": "f934470c04fbf3c4da8b94d7a0d582da454a8ffa0010f2ad49b851f5ad88e094",
|
| 110 |
+
"mode": "copy",
|
| 111 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage2_report.json",
|
| 112 |
+
"source_sha256_matches": true
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"path": "code/f3_filtering/reports/F3_stage3_report.json",
|
| 116 |
+
"role": "code",
|
| 117 |
+
"bytes": 389,
|
| 118 |
+
"sha256": "197f96b66a39cb157d4b879ad7d04f19d381348625aba7fe1a8b5d5704da6012",
|
| 119 |
+
"mode": "copy",
|
| 120 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage3_report.json",
|
| 121 |
+
"source_sha256_matches": true
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"path": "code/f3_filtering/reports/F3_stage4_calibration.json",
|
| 125 |
+
"role": "code",
|
| 126 |
+
"bytes": 349,
|
| 127 |
+
"sha256": "94427b4c24d0924f3c48837d49931273bd08a032bdc1c69167a8a4b6b7eef2ee",
|
| 128 |
+
"mode": "copy",
|
| 129 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage4_calibration.json",
|
| 130 |
+
"source_sha256_matches": true
|
| 131 |
+
},
|
| 132 |
+
{
|
| 133 |
+
"path": "code/f3_filtering/reports/F3_stage4_report.json",
|
| 134 |
+
"role": "code",
|
| 135 |
+
"bytes": 700,
|
| 136 |
+
"sha256": "db2a7b2e19ea296bf1391a7c81f6f8313d5dee189f6410018deedce41a8fdbdc",
|
| 137 |
+
"mode": "copy",
|
| 138 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage4_report.json",
|
| 139 |
+
"source_sha256_matches": true
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
"path": "code/f3_filtering/reports/F3_v3_build.log",
|
| 143 |
+
"role": "code",
|
| 144 |
+
"bytes": 2058,
|
| 145 |
+
"sha256": "8c358341e1934f6356b6268c84d37c7f20cef0733aacd0f362712847327adf8d",
|
| 146 |
+
"mode": "copy",
|
| 147 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_v3_build.log",
|
| 148 |
+
"source_sha256_matches": true
|
| 149 |
+
},
|
| 150 |
+
{
|
| 151 |
+
"path": "code/f3_filtering/reports/F3_v3_report.json",
|
| 152 |
+
"role": "code",
|
| 153 |
+
"bytes": 1059,
|
| 154 |
+
"sha256": "9e2f9939c93c2e5540a90c89ad23f4190e90122cf2c53768f8481cc0dda29a0e",
|
| 155 |
+
"mode": "copy",
|
| 156 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_v3_report.json",
|
| 157 |
+
"source_sha256_matches": true
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"path": "code/f3_filtering/reports/F3_v4_build.log",
|
| 161 |
+
"role": "code",
|
| 162 |
+
"bytes": 1490,
|
| 163 |
+
"sha256": "e07f2a814b5b62b0dd49d62916525d40eb17d34ba5f7d5be6c846024aa5cd374",
|
| 164 |
+
"mode": "copy",
|
| 165 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_v4_build.log",
|
| 166 |
+
"source_sha256_matches": true
|
| 167 |
+
},
|
| 168 |
+
{
|
| 169 |
+
"path": "code/f3_filtering/reports/F3_v4_report.json",
|
| 170 |
+
"role": "code",
|
| 171 |
+
"bytes": 854,
|
| 172 |
+
"sha256": "9759b9f137f8ec4ec8c49256cf322e86f73360c81465b30400d52a83a7fb3baf",
|
| 173 |
+
"mode": "copy",
|
| 174 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_v4_report.json",
|
| 175 |
+
"source_sha256_matches": true
|
| 176 |
+
},
|
| 177 |
+
{
|
| 178 |
+
"path": "code/f3_filtering/reports/PIPELINE_REPORT.json",
|
| 179 |
+
"role": "code",
|
| 180 |
+
"bytes": 2304,
|
| 181 |
+
"sha256": "a395330e3e2aa77be0ae68c0ccdaa6e12348cce2d8622a215e112bf0df8c6bf4",
|
| 182 |
+
"mode": "copy",
|
| 183 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/PIPELINE_REPORT.json",
|
| 184 |
+
"source_sha256_matches": true
|
| 185 |
+
},
|
| 186 |
+
{
|
| 187 |
+
"path": "code/pretrain_data_prep/analyze_template_repetition.py",
|
| 188 |
+
"role": "code",
|
| 189 |
+
"bytes": 8791,
|
| 190 |
+
"sha256": "92e41b02d8d478dbb4b1b49741f4be28b2dc042020c6b510948efee977758769",
|
| 191 |
+
"mode": "copy",
|
| 192 |
+
"source": "/raid/data/weifeng/Datasets/analyze_template_repetition.py",
|
| 193 |
+
"source_sha256_matches": true
|
| 194 |
+
},
|
| 195 |
+
{
|
| 196 |
+
"path": "code/pretrain_data_prep/build_filtered_pretrain.py",
|
| 197 |
+
"role": "code",
|
| 198 |
+
"bytes": 2586,
|
| 199 |
+
"sha256": "b1c4d603a9f85052e899b2b60af4c0248f588f6e3b58b887a8df29ee28bbfe8e",
|
| 200 |
+
"mode": "copy",
|
| 201 |
+
"source": "/raid/data/weifeng/Datasets/build_filtered_pretrain.py",
|
| 202 |
+
"source_sha256_matches": true
|
| 203 |
+
},
|
| 204 |
+
{
|
| 205 |
+
"path": "code/pretrain_data_prep/dryrun_filter_repetition.py",
|
| 206 |
+
"role": "code",
|
| 207 |
+
"bytes": 6128,
|
| 208 |
+
"sha256": "6fe18b7c656f7ae767d67080614e5d5e76691ff3ff1c5a26d6382d61ef04cecf",
|
| 209 |
+
"mode": "copy",
|
| 210 |
+
"source": "/raid/data/weifeng/Datasets/dryrun_filter_repetition.py",
|
| 211 |
+
"source_sha256_matches": true
|
| 212 |
+
},
|
| 213 |
+
{
|
| 214 |
+
"path": "code/pretrain_data_prep/reports/code_messages_pre_train_filtered_report.json",
|
| 215 |
+
"role": "code",
|
| 216 |
+
"bytes": 4670,
|
| 217 |
+
"sha256": "d2cdf70fdf2725fd6c7c2b83c2815d7c8f4e5411bb40f1c707e9e45e917e053b",
|
| 218 |
+
"mode": "copy",
|
| 219 |
+
"source": "/raid/data/weifeng/Datasets/code_messages_pre_train_filtered_report.json",
|
| 220 |
+
"source_sha256_matches": true
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"path": "code/pretrain_data_prep/reports/code_messages_pre_train_filtered_stages_report.json",
|
| 224 |
+
"role": "code",
|
| 225 |
+
"bytes": 679,
|
| 226 |
+
"sha256": "d7dd8ca28113c9eb3147ca72df822c186128f2e3198f8a582937735b16c9cc52",
|
| 227 |
+
"mode": "copy",
|
| 228 |
+
"source": "/raid/data/weifeng/Datasets/code_messages_pre_train_filtered_stages_report.json",
|
| 229 |
+
"source_sha256_matches": true
|
| 230 |
+
},
|
| 231 |
+
{
|
| 232 |
+
"path": "code/pretrain_data_prep/reports/dryrun_filter_report.json",
|
| 233 |
+
"role": "code",
|
| 234 |
+
"bytes": 1261,
|
| 235 |
+
"sha256": "757e260e4da4940d88f001ade7492a5654b52408116a36b1fe1e675f2ed6e25b",
|
| 236 |
+
"mode": "copy",
|
| 237 |
+
"source": "/raid/data/weifeng/Datasets/dryrun_filter_report.json",
|
| 238 |
+
"source_sha256_matches": true
|
| 239 |
+
},
|
| 240 |
+
{
|
| 241 |
+
"path": "code/pretrain_data_prep/split_filtered_by_token_length.py",
|
| 242 |
+
"role": "code",
|
| 243 |
+
"bytes": 3110,
|
| 244 |
+
"sha256": "ec2b2788a759e157ed4591e5252549467cfdff5910b31ce43d131d163860cb42",
|
| 245 |
+
"mode": "copy",
|
| 246 |
+
"source": "/raid/data/weifeng/Datasets/split_filtered_by_token_length.py",
|
| 247 |
+
"source_sha256_matches": true
|
| 248 |
+
},
|
| 249 |
+
{
|
| 250 |
+
"path": "data/f3/input/scicode_sft_swift_F3_clean.jsonl",
|
| 251 |
+
"role": "data",
|
| 252 |
+
"bytes": 2636501943,
|
| 253 |
+
"sha256": "63ad49e1f7a035f420ae02f2bab8ed4e08f93d7a14a81c4d51cb424e46c505a2",
|
| 254 |
+
"mode": "hardlink",
|
| 255 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean.jsonl",
|
| 256 |
+
"source_sha256_matches": true,
|
| 257 |
+
"records": 473465
|
| 258 |
+
},
|
| 259 |
+
{
|
| 260 |
+
"path": "data/f3/intermediate/F3_stage1.jsonl",
|
| 261 |
+
"role": "data",
|
| 262 |
+
"bytes": 2276490009,
|
| 263 |
+
"sha256": "167d17cd03fbbdbca40e3ef289c81898120107ba13f975db2ce23e3d6516c1a3",
|
| 264 |
+
"mode": "hardlink",
|
| 265 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage1.jsonl",
|
| 266 |
+
"source_sha256_matches": true,
|
| 267 |
+
"records": 437671
|
| 268 |
+
},
|
| 269 |
+
{
|
| 270 |
+
"path": "data/f3/intermediate/F3_stage2.jsonl",
|
| 271 |
+
"role": "data",
|
| 272 |
+
"bytes": 1956575594,
|
| 273 |
+
"sha256": "97353d440b3b0d292ff443cf2e705140ff5fa25ebbc2a65163d240b1eff03432",
|
| 274 |
+
"mode": "hardlink",
|
| 275 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage2.jsonl",
|
| 276 |
+
"source_sha256_matches": true,
|
| 277 |
+
"records": 366672
|
| 278 |
+
},
|
| 279 |
+
{
|
| 280 |
+
"path": "data/f3/intermediate/F3_stage3.jsonl",
|
| 281 |
+
"role": "data",
|
| 282 |
+
"bytes": 1935884904,
|
| 283 |
+
"sha256": "c54871e7896bb83e49bed1f0fc07cef2021a8c7ddb5053c1f2c7d5eed8ddcb56",
|
| 284 |
+
"mode": "hardlink",
|
| 285 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage3.jsonl",
|
| 286 |
+
"source_sha256_matches": true,
|
| 287 |
+
"records": 362367
|
| 288 |
+
},
|
| 289 |
+
{
|
| 290 |
+
"path": "data/f3/intermediate/F3_stage4_calibration_scores.jsonl",
|
| 291 |
+
"role": "data",
|
| 292 |
+
"bytes": 132712,
|
| 293 |
+
"sha256": "4c7d29e8c412690776a52972e89e960613389363509898a6d188bf642c049f9e",
|
| 294 |
+
"mode": "hardlink",
|
| 295 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage4_calibration_scores.jsonl",
|
| 296 |
+
"source_sha256_matches": true,
|
| 297 |
+
"records": 500
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"path": "data/f3/intermediate/F3_stage4_scores.jsonl",
|
| 301 |
+
"role": "data",
|
| 302 |
+
"bytes": 10035166,
|
| 303 |
+
"sha256": "da22d8bb0135c30bc3679f75d6195616bee3f32b50b41240780e09fa869f484a",
|
| 304 |
+
"mode": "hardlink",
|
| 305 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage4_scores.jsonl",
|
| 306 |
+
"source_sha256_matches": true,
|
| 307 |
+
"records": 362367
|
| 308 |
+
},
|
| 309 |
+
{
|
| 310 |
+
"path": "data/f3/output/scicode_sft_swift_F3_clean_v2.jsonl",
|
| 311 |
+
"role": "data",
|
| 312 |
+
"bytes": 1125890366,
|
| 313 |
+
"sha256": "fa3521aaac5ed5cb1575a2f92c0386cec598002175aa47dbbaaaf71b6aad5ac7",
|
| 314 |
+
"mode": "hardlink",
|
| 315 |
+
"source": "/raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v2.jsonl",
|
| 316 |
+
"source_sha256_matches": true,
|
| 317 |
+
"records": 207009
|
| 318 |
+
},
|
| 319 |
+
{
|
| 320 |
+
"path": "data/pretrain/code_messages_pre_train_filtered_stage1.jsonl",
|
| 321 |
+
"role": "data",
|
| 322 |
+
"bytes": 1657338573,
|
| 323 |
+
"sha256": "e582cefbfb377aee6f3cc0c23f8159d5a77b14de27cf9fb2c4722078b905459a",
|
| 324 |
+
"mode": "hardlink",
|
| 325 |
+
"source": "/raid/data/weifeng/Datasets/code_messages_pre_train_filtered_stage1.jsonl",
|
| 326 |
+
"source_sha256_matches": true,
|
| 327 |
+
"records": 902115
|
| 328 |
+
},
|
| 329 |
+
{
|
| 330 |
+
"path": "environment/KNOWN_LIMITATIONS.md",
|
| 331 |
+
"role": "environment",
|
| 332 |
+
"bytes": 2108,
|
| 333 |
+
"sha256": "55aed7c95007191cef4b4bce02aabca8377b2fddc17c630f77df3e49ec1a2433",
|
| 334 |
+
"mode": "authored",
|
| 335 |
+
"source": null,
|
| 336 |
+
"source_sha256_matches": null
|
| 337 |
+
},
|
| 338 |
+
{
|
| 339 |
+
"path": "evidence/eval/f3_refined_9p1_summary.json",
|
| 340 |
+
"role": "evidence",
|
| 341 |
+
"bytes": 979,
|
| 342 |
+
"sha256": "36b8a5aa5b20f8bb6b671cedbc0cf9f7a7246535e9e8494e068ba825f1b03003",
|
| 343 |
+
"mode": "copy",
|
| 344 |
+
"source": "/raid/data/weifeng/DELIVERY_0p5B_CPT_SFT/eval/summaries/summary_hf__raid_data_weifeng_Pre_train_output_user_qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu_v0-20260508-164342_checkpoint-6435_20260508_191037.json",
|
| 345 |
+
"source_sha256_matches": true
|
| 346 |
+
},
|
| 347 |
+
{
|
| 348 |
+
"path": "evidence/instruction_recipe_results.md",
|
| 349 |
+
"role": "evidence",
|
| 350 |
+
"bytes": 2895,
|
| 351 |
+
"sha256": "2da8bebeea85e5185a8560f21fc73faef47aedb5c5dde9783887f27e1331658c",
|
| 352 |
+
"mode": "copy",
|
| 353 |
+
"source": "/raid/data/weifeng/DELIVERY_0p5B_CPT_SFT/reports/instruction_recipe_results.md",
|
| 354 |
+
"source_sha256_matches": true
|
| 355 |
+
},
|
| 356 |
+
{
|
| 357 |
+
"path": "evidence/smoke_test_results.json",
|
| 358 |
+
"role": "evidence",
|
| 359 |
+
"bytes": 793,
|
| 360 |
+
"sha256": "aadb01d5d9609833a97bdfda6c0ef816b80093f380cf0944b13ba01ce94f2855",
|
| 361 |
+
"mode": "authored",
|
| 362 |
+
"source": null,
|
| 363 |
+
"source_sha256_matches": null
|
| 364 |
+
},
|
| 365 |
+
{
|
| 366 |
+
"path": "models/pretrained/stage1_cpt/args.json",
|
| 367 |
+
"role": "models",
|
| 368 |
+
"bytes": 39617,
|
| 369 |
+
"sha256": "89055b0d70f0787df200fb350546a72f0780d2afb1db8de8e1dcc8d33428b22c",
|
| 370 |
+
"mode": "hardlink",
|
| 371 |
+
"source": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_curriculum_filtered_stage1/v1-20260514-232114/checkpoint-28175/args.json",
|
| 372 |
+
"source_sha256_matches": true
|
| 373 |
+
},
|
| 374 |
+
{
|
| 375 |
+
"path": "models/pretrained/stage1_cpt/chat_template.jinja",
|
| 376 |
+
"role": "models",
|
| 377 |
+
"bytes": 2427,
|
| 378 |
+
"sha256": "44d5f08f3f72b837eaad09f13a54c1f9f4eb58d75240334548b7fd52a5437fa5",
|
| 379 |
+
"mode": "hardlink",
|
| 380 |
+
"source": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_curriculum_filtered_stage1/v1-20260514-232114/checkpoint-28175/chat_template.jinja",
|
| 381 |
+
"source_sha256_matches": true
|
| 382 |
+
},
|
| 383 |
+
{
|
| 384 |
+
"path": "models/pretrained/stage1_cpt/config.json",
|
| 385 |
+
"role": "models",
|
| 386 |
+
"bytes": 1284,
|
| 387 |
+
"sha256": "0d2cfcbf5e317ffaa0b8d8897b94a4b9c5e716ddd47ecd768f3ad0c2174ab2ce",
|
| 388 |
+
"mode": "hardlink",
|
| 389 |
+
"source": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_curriculum_filtered_stage1/v1-20260514-232114/checkpoint-28175/config.json",
|
| 390 |
+
"source_sha256_matches": true
|
| 391 |
+
},
|
| 392 |
+
{
|
| 393 |
+
"path": "models/pretrained/stage1_cpt/generation_config.json",
|
| 394 |
+
"role": "models",
|
| 395 |
+
"bytes": 191,
|
| 396 |
+
"sha256": "8a210910e3bf58bdbdc6355ef06aa40ea311a7f579cd518cacd929955e9e43fa",
|
| 397 |
+
"mode": "hardlink",
|
| 398 |
+
"source": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_curriculum_filtered_stage1/v1-20260514-232114/checkpoint-28175/generation_config.json",
|
| 399 |
+
"source_sha256_matches": true
|
| 400 |
+
},
|
| 401 |
+
{
|
| 402 |
+
"path": "models/pretrained/stage1_cpt/model.safetensors",
|
| 403 |
+
"role": "models",
|
| 404 |
+
"bytes": 988097824,
|
| 405 |
+
"sha256": "c119b284587312405231891869c326215379ec62890899a0b6af324204f8d290",
|
| 406 |
+
"mode": "hardlink",
|
| 407 |
+
"source": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_curriculum_filtered_stage1/v1-20260514-232114/checkpoint-28175/model.safetensors",
|
| 408 |
+
"source_sha256_matches": true
|
| 409 |
+
},
|
| 410 |
+
{
|
| 411 |
+
"path": "models/pretrained/stage1_cpt/tokenizer.json",
|
| 412 |
+
"role": "models",
|
| 413 |
+
"bytes": 11421892,
|
| 414 |
+
"sha256": "3fd169731d2cbde95e10bf356d66d5997fd885dd8dbb6fb4684da3f23b2585d8",
|
| 415 |
+
"mode": "hardlink",
|
| 416 |
+
"source": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_curriculum_filtered_stage1/v1-20260514-232114/checkpoint-28175/tokenizer.json",
|
| 417 |
+
"source_sha256_matches": true
|
| 418 |
+
},
|
| 419 |
+
{
|
| 420 |
+
"path": "models/pretrained/stage1_cpt/tokenizer_config.json",
|
| 421 |
+
"role": "models",
|
| 422 |
+
"bytes": 695,
|
| 423 |
+
"sha256": "35c37fe281bb6e5ed2a6699349c8dc7191a79c4c829abbffab33133908f11daa",
|
| 424 |
+
"mode": "hardlink",
|
| 425 |
+
"source": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_curriculum_filtered_stage1/v1-20260514-232114/checkpoint-28175/tokenizer_config.json",
|
| 426 |
+
"source_sha256_matches": true
|
| 427 |
+
},
|
| 428 |
+
{
|
| 429 |
+
"path": "models/pretrained/stage1_cpt/trainer_state.json",
|
| 430 |
+
"role": "models",
|
| 431 |
+
"bytes": 121936,
|
| 432 |
+
"sha256": "5fb959d771564eae82f9187cd41e4da522d985d8585158898d3a7525c4b292ca",
|
| 433 |
+
"mode": "hardlink",
|
| 434 |
+
"source": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_curriculum_filtered_stage1/v1-20260514-232114/checkpoint-28175/trainer_state.json",
|
| 435 |
+
"source_sha256_matches": true
|
| 436 |
+
},
|
| 437 |
+
{
|
| 438 |
+
"path": "models/sft/sft_f3_refined_instruct/args.json",
|
| 439 |
+
"role": "models",
|
| 440 |
+
"bytes": 39662,
|
| 441 |
+
"sha256": "4a04289e2de79f87bed89881e01536369dd8c34c1b01a4806fd0aa08ccfc8293",
|
| 442 |
+
"mode": "hardlink",
|
| 443 |
+
"source": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu/v0-20260508-164342/checkpoint-6435/args.json",
|
| 444 |
+
"source_sha256_matches": true
|
| 445 |
+
},
|
| 446 |
+
{
|
| 447 |
+
"path": "models/sft/sft_f3_refined_instruct/chat_template.jinja",
|
| 448 |
+
"role": "models",
|
| 449 |
+
"bytes": 2507,
|
| 450 |
+
"sha256": "cd8e9439f0570856fd70470bf8889ebd8b5d1107207f67a5efb46e342330527f",
|
| 451 |
+
"mode": "hardlink",
|
| 452 |
+
"source": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu/v0-20260508-164342/checkpoint-6435/chat_template.jinja",
|
| 453 |
+
"source_sha256_matches": true
|
| 454 |
+
},
|
| 455 |
+
{
|
| 456 |
+
"path": "models/sft/sft_f3_refined_instruct/config.json",
|
| 457 |
+
"role": "models",
|
| 458 |
+
"bytes": 1284,
|
| 459 |
+
"sha256": "2a0bbab03998171855260860fbab81152ec51e67c7d69b85f32c7f624341fb0e",
|
| 460 |
+
"mode": "hardlink",
|
| 461 |
+
"source": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu/v0-20260508-164342/checkpoint-6435/config.json",
|
| 462 |
+
"source_sha256_matches": true
|
| 463 |
+
},
|
| 464 |
+
{
|
| 465 |
+
"path": "models/sft/sft_f3_refined_instruct/generation_config.json",
|
| 466 |
+
"role": "models",
|
| 467 |
+
"bytes": 242,
|
| 468 |
+
"sha256": "87c51d61bd70a204993da36384296ccfeb56d46ee2cc7247929f917d0d8118f7",
|
| 469 |
+
"mode": "hardlink",
|
| 470 |
+
"source": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu/v0-20260508-164342/checkpoint-6435/generation_config.json",
|
| 471 |
+
"source_sha256_matches": true
|
| 472 |
+
},
|
| 473 |
+
{
|
| 474 |
+
"path": "models/sft/sft_f3_refined_instruct/model.safetensors",
|
| 475 |
+
"role": "models",
|
| 476 |
+
"bytes": 988097824,
|
| 477 |
+
"sha256": "05bca1c3ba20caad5a14ef0f450b6788aff7c9594bf90fe6deb5ecd2c5561847",
|
| 478 |
+
"mode": "hardlink",
|
| 479 |
+
"source": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu/v0-20260508-164342/checkpoint-6435/model.safetensors",
|
| 480 |
+
"source_sha256_matches": true
|
| 481 |
+
},
|
| 482 |
+
{
|
| 483 |
+
"path": "models/sft/sft_f3_refined_instruct/tokenizer.json",
|
| 484 |
+
"role": "models",
|
| 485 |
+
"bytes": 11421892,
|
| 486 |
+
"sha256": "3fd169731d2cbde95e10bf356d66d5997fd885dd8dbb6fb4684da3f23b2585d8",
|
| 487 |
+
"mode": "hardlink",
|
| 488 |
+
"source": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu/v0-20260508-164342/checkpoint-6435/tokenizer.json",
|
| 489 |
+
"source_sha256_matches": true
|
| 490 |
+
},
|
| 491 |
+
{
|
| 492 |
+
"path": "models/sft/sft_f3_refined_instruct/tokenizer_config.json",
|
| 493 |
+
"role": "models",
|
| 494 |
+
"bytes": 692,
|
| 495 |
+
"sha256": "4d8ad3fe9729e37338fae50bac94ff03cb915071eb886b937077114e874dfa06",
|
| 496 |
+
"mode": "hardlink",
|
| 497 |
+
"source": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu/v0-20260508-164342/checkpoint-6435/tokenizer_config.json",
|
| 498 |
+
"source_sha256_matches": true
|
| 499 |
+
},
|
| 500 |
+
{
|
| 501 |
+
"path": "models/sft/sft_f3_refined_instruct/trainer_state.json",
|
| 502 |
+
"role": "models",
|
| 503 |
+
"bytes": 138941,
|
| 504 |
+
"sha256": "7259447195d9af3cad318bed168eb341c6ac2d171ccaddab7e195e173d033642",
|
| 505 |
+
"mode": "hardlink",
|
| 506 |
+
"source": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu/v0-20260508-164342/checkpoint-6435/trainer_state.json",
|
| 507 |
+
"source_sha256_matches": true
|
| 508 |
+
},
|
| 509 |
+
{
|
| 510 |
+
"path": "tools/build_manifest.py",
|
| 511 |
+
"role": "tools",
|
| 512 |
+
"bytes": 7386,
|
| 513 |
+
"sha256": "2be5dce6f73513de2b0ef0e5b41c9f3b5691dba0e8867193dae6d19f18518da6",
|
| 514 |
+
"mode": "authored",
|
| 515 |
+
"source": null,
|
| 516 |
+
"source_sha256_matches": null
|
| 517 |
+
},
|
| 518 |
+
{
|
| 519 |
+
"path": "tools/smoke_test.py",
|
| 520 |
+
"role": "tools",
|
| 521 |
+
"bytes": 3057,
|
| 522 |
+
"sha256": "8219ffc3a307516000a0c9612ecade9d0c274d85347f23757b8b30f240f92740",
|
| 523 |
+
"mode": "authored",
|
| 524 |
+
"source": null,
|
| 525 |
+
"source_sha256_matches": null
|
| 526 |
+
},
|
| 527 |
+
{
|
| 528 |
+
"path": "training_scripts/README.md",
|
| 529 |
+
"role": "training_scripts",
|
| 530 |
+
"bytes": 597,
|
| 531 |
+
"sha256": "259bf953bb9254443f6a164db05f02c1dfdc54c3ec6ee57502fae910b0eb2165",
|
| 532 |
+
"mode": "authored",
|
| 533 |
+
"source": null,
|
| 534 |
+
"source_sha256_matches": null
|
| 535 |
+
},
|
| 536 |
+
{
|
| 537 |
+
"path": "training_scripts/pretrain/stage1_short.sh",
|
| 538 |
+
"role": "training_scripts",
|
| 539 |
+
"bytes": 1401,
|
| 540 |
+
"sha256": "f25a669388095d705cc190e3f0351aaf1d310759bd1c7f3f452b3601364a4005",
|
| 541 |
+
"mode": "copy",
|
| 542 |
+
"source": "/raid/data/weifeng/Pre_train/swift_runs_curriculum_filtered_0p5b/stage1_short.sh",
|
| 543 |
+
"source_sha256_matches": true
|
| 544 |
+
},
|
| 545 |
+
{
|
| 546 |
+
"path": "training_scripts/sft/run_qwen25_coder_0p5b_instruct_F3_v2_1gpu.sh",
|
| 547 |
+
"role": "training_scripts",
|
| 548 |
+
"bytes": 1466,
|
| 549 |
+
"sha256": "8feeae24b837c7ebfa77c41057d4286eec4eae5d66c870c32a274f773ae76d39",
|
| 550 |
+
"mode": "copy",
|
| 551 |
+
"source": "/raid/data/weifeng/Pre_train/swift_runs_F3_v2_0p5b_instruct/run_qwen25_coder_0p5b_instruct_F3_v2_1gpu.sh",
|
| 552 |
+
"source_sha256_matches": true
|
| 553 |
+
}
|
| 554 |
+
]
|
| 555 |
+
}
|
README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 0.5B Pre-trained and F3-refined Model Delivery Package
|
| 2 |
+
|
| 3 |
+
This is a compact, traceable delivery package containing the two previously reported
|
| 4 |
+
0.5B-class model checkpoints, their training datasets, data-preparation code, training
|
| 5 |
+
scripts, and evaluation evidence.
|
| 6 |
+
|
| 7 |
+
## Delivered Models
|
| 8 |
+
|
| 9 |
+
| Model | Path | Initialisation | Training data | Reported result |
|
| 10 |
+
|---|---|---|---|---|
|
| 11 |
+
| Stage-1 CPT | `models/pretrained/stage1_cpt/` | `Qwen/Qwen2.5-Coder-0.5B` | `data/pretrain/code_messages_pre_train_filtered_stage1.jsonl` (902,115 records) | Continued-pre-training deliverable |
|
| 12 |
+
| F3-refined SFT | `models/sft/sft_f3_refined_instruct/` | `Qwen/Qwen2.5-Coder-0.5B-Instruct` | `data/f3/output/scicode_sft_swift_F3_clean_v2.jsonl` (207,009 records) | pass@1 9.1%; pass@5 13.0% |
|
| 13 |
+
|
| 14 |
+
Both directories are standard Hugging Face checkpoints. Model weights, tokenisers,
|
| 15 |
+
`args.json`, and `trainer_state.json` are included. Optimiser, scheduler, and random-number
|
| 16 |
+
generator states (approximately 2 GB per model) are excluded because this package is
|
| 17 |
+
intended for model delivery and inference rather than mid-run training resumption.
|
| 18 |
+
|
| 19 |
+
## Data and F3 Filtering Chain
|
| 20 |
+
|
| 21 |
+
`data/f3/` contains the input, principal intermediate artefacts, score output, and final
|
| 22 |
+
training dataset used for the reported F3-refined model:
|
| 23 |
+
|
| 24 |
+
```text
|
| 25 |
+
473,465 00 input: scicode_sft_swift_F3_clean.jsonl
|
| 26 |
+
437,671 01 rule-based AST, structure, duplicate, and placeholder filtering
|
| 27 |
+
366,672 02 per-project caps and stratified sampling
|
| 28 |
+
362,367 03 assistant-response deduplication within projects
|
| 29 |
+
207,009 04 quality score >= 3: scicode_sft_swift_F3_clean_v2.jsonl
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
The corresponding scripts are in `code/f3_filtering/`. Stages 1–3 are local deterministic
|
| 33 |
+
processing stages. Stage 4 uses an external `Qwen3-Coder-30B-A3B-Instruct` scoring model;
|
| 34 |
+
the historical script retains its original absolute path, which must be replaced when the
|
| 35 |
+
stage is run in another environment. The saved scores and final dataset are included.
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
The continued-pre-training dataset and its preparation code are in `data/pretrain/` and
|
| 39 |
+
`code/pretrain_data_prep/`, respectively.
|
| 40 |
+
|
| 41 |
+
## Training Scripts
|
| 42 |
+
|
| 43 |
+
- `training_scripts/pretrain/stage1_short.sh`
|
| 44 |
+
- `training_scripts/sft/run_qwen25_coder_0p5b_instruct_F3_v2_1gpu.sh`
|
| 45 |
+
|
| 46 |
+
These are the original historical launch scripts. They intentionally retain the GPU
|
| 47 |
+
selection, cache locations, ports, and absolute output paths used at the time. Review and
|
| 48 |
+
replace those paths before rerunning them on another system. The checkpoint `args.json`
|
| 49 |
+
files are the primary record of the effective training parameters.
|
| 50 |
+
|
| 51 |
+
## Evaluation Evidence and Limitations
|
| 52 |
+
|
| 53 |
+
`evidence/eval/f3_refined_9p1_summary.json` records the original evaluation: 200 tasks,
|
| 54 |
+
five samples per task, 1,000 attempts, pass@1 of 9.1%, and pass@5 of 13.0%. This result is
|
| 55 |
+
from the historical Runnable alignment benchmark and must not be conflated with the later
|
| 56 |
+
repository-level Core/Hold benchmark.
|
| 57 |
+
|
| 58 |
+
The two delivered training runs do not have exact, run-specific `pip freeze` snapshots.
|
| 59 |
+
Training data and effective parameters are traceable, but bit-for-bit retraining is not
|
| 60 |
+
claimed. See `environment/KNOWN_LIMITATIONS.md` for details.
|
| 61 |
+
|
| 62 |
+
## Integrity and Storage
|
| 63 |
+
|
| 64 |
+
- `tools/build_manifest.py`: regenerates the manifest and checksums.
|
| 65 |
+
- `tools/smoke_test.py`: loads each checkpoint on CPU and checks finite, non-degenerate logits.
|
| 66 |
+
|
SHA256SUMS
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
c4dfa67956deb6eec305523de03d380a923cd70f9522d1e740846f57bd264fb8 MANIFEST.json
|
| 2 |
+
b9a66fd10a508e09e92335bf4b1f69124ec142805a04c70b4d9ba725d14c182f README.md
|
| 3 |
+
570dfb0cd8b5991714d7c52b2d8e65ebd22a874e9d85877ab8ad22162f778ed1 code/f3_filtering/build_F3_v3.py
|
| 4 |
+
5107add2818270eb0309219d5b73aedc43153a1da97165750b22dae80e7f047e code/f3_filtering/build_F3_v4.py
|
| 5 |
+
c93313faa9e23019bc87f6805d0fe1c83ab8fe4812cae1209f16d08f57e9f1a3 code/f3_filtering/clean_F3_stage1.py
|
| 6 |
+
2b3fa3632262f4dfe49b6a20899f0d7551523c040d904d70734f2f3b6312add2 code/f3_filtering/clean_F3_stage2.py
|
| 7 |
+
13b402f6fbce073507a2b51099e6b27ae266e238597db51566025b584fa35d19 code/f3_filtering/clean_F3_stage3.py
|
| 8 |
+
f6c72da037f62154fa02ef3a7187ac80debbd82bb2fdaa2f82166311983aded3 code/f3_filtering/clean_F3_stage4.py
|
| 9 |
+
b41cd23f44de05d1a79385a57482af2f166ddfd73788c1fe5d6e07568922e270 code/f3_filtering/clean_F3_stage4_calibrate.py
|
| 10 |
+
340895ba5021dac1d8e10a47f8d6cc9899c5c7a6cefa1815760e42a7660583b2 code/f3_filtering/reports/F3_stage1_report.json
|
| 11 |
+
f934470c04fbf3c4da8b94d7a0d582da454a8ffa0010f2ad49b851f5ad88e094 code/f3_filtering/reports/F3_stage2_report.json
|
| 12 |
+
197f96b66a39cb157d4b879ad7d04f19d381348625aba7fe1a8b5d5704da6012 code/f3_filtering/reports/F3_stage3_report.json
|
| 13 |
+
94427b4c24d0924f3c48837d49931273bd08a032bdc1c69167a8a4b6b7eef2ee code/f3_filtering/reports/F3_stage4_calibration.json
|
| 14 |
+
db2a7b2e19ea296bf1391a7c81f6f8313d5dee189f6410018deedce41a8fdbdc code/f3_filtering/reports/F3_stage4_report.json
|
| 15 |
+
8c358341e1934f6356b6268c84d37c7f20cef0733aacd0f362712847327adf8d code/f3_filtering/reports/F3_v3_build.log
|
| 16 |
+
9e2f9939c93c2e5540a90c89ad23f4190e90122cf2c53768f8481cc0dda29a0e code/f3_filtering/reports/F3_v3_report.json
|
| 17 |
+
e07f2a814b5b62b0dd49d62916525d40eb17d34ba5f7d5be6c846024aa5cd374 code/f3_filtering/reports/F3_v4_build.log
|
| 18 |
+
9759b9f137f8ec4ec8c49256cf322e86f73360c81465b30400d52a83a7fb3baf code/f3_filtering/reports/F3_v4_report.json
|
| 19 |
+
a395330e3e2aa77be0ae68c0ccdaa6e12348cce2d8622a215e112bf0df8c6bf4 code/f3_filtering/reports/PIPELINE_REPORT.json
|
| 20 |
+
92e41b02d8d478dbb4b1b49741f4be28b2dc042020c6b510948efee977758769 code/pretrain_data_prep/analyze_template_repetition.py
|
| 21 |
+
b1c4d603a9f85052e899b2b60af4c0248f588f6e3b58b887a8df29ee28bbfe8e code/pretrain_data_prep/build_filtered_pretrain.py
|
| 22 |
+
6fe18b7c656f7ae767d67080614e5d5e76691ff3ff1c5a26d6382d61ef04cecf code/pretrain_data_prep/dryrun_filter_repetition.py
|
| 23 |
+
d2cdf70fdf2725fd6c7c2b83c2815d7c8f4e5411bb40f1c707e9e45e917e053b code/pretrain_data_prep/reports/code_messages_pre_train_filtered_report.json
|
| 24 |
+
d7dd8ca28113c9eb3147ca72df822c186128f2e3198f8a582937735b16c9cc52 code/pretrain_data_prep/reports/code_messages_pre_train_filtered_stages_report.json
|
| 25 |
+
757e260e4da4940d88f001ade7492a5654b52408116a36b1fe1e675f2ed6e25b code/pretrain_data_prep/reports/dryrun_filter_report.json
|
| 26 |
+
ec2b2788a759e157ed4591e5252549467cfdff5910b31ce43d131d163860cb42 code/pretrain_data_prep/split_filtered_by_token_length.py
|
| 27 |
+
63ad49e1f7a035f420ae02f2bab8ed4e08f93d7a14a81c4d51cb424e46c505a2 data/f3/input/scicode_sft_swift_F3_clean.jsonl
|
| 28 |
+
167d17cd03fbbdbca40e3ef289c81898120107ba13f975db2ce23e3d6516c1a3 data/f3/intermediate/F3_stage1.jsonl
|
| 29 |
+
97353d440b3b0d292ff443cf2e705140ff5fa25ebbc2a65163d240b1eff03432 data/f3/intermediate/F3_stage2.jsonl
|
| 30 |
+
c54871e7896bb83e49bed1f0fc07cef2021a8c7ddb5053c1f2c7d5eed8ddcb56 data/f3/intermediate/F3_stage3.jsonl
|
| 31 |
+
4c7d29e8c412690776a52972e89e960613389363509898a6d188bf642c049f9e data/f3/intermediate/F3_stage4_calibration_scores.jsonl
|
| 32 |
+
da22d8bb0135c30bc3679f75d6195616bee3f32b50b41240780e09fa869f484a data/f3/intermediate/F3_stage4_scores.jsonl
|
| 33 |
+
fa3521aaac5ed5cb1575a2f92c0386cec598002175aa47dbbaaaf71b6aad5ac7 data/f3/output/scicode_sft_swift_F3_clean_v2.jsonl
|
| 34 |
+
e582cefbfb377aee6f3cc0c23f8159d5a77b14de27cf9fb2c4722078b905459a data/pretrain/code_messages_pre_train_filtered_stage1.jsonl
|
| 35 |
+
55aed7c95007191cef4b4bce02aabca8377b2fddc17c630f77df3e49ec1a2433 environment/KNOWN_LIMITATIONS.md
|
| 36 |
+
36b8a5aa5b20f8bb6b671cedbc0cf9f7a7246535e9e8494e068ba825f1b03003 evidence/eval/f3_refined_9p1_summary.json
|
| 37 |
+
2da8bebeea85e5185a8560f21fc73faef47aedb5c5dde9783887f27e1331658c evidence/instruction_recipe_results.md
|
| 38 |
+
aadb01d5d9609833a97bdfda6c0ef816b80093f380cf0944b13ba01ce94f2855 evidence/smoke_test_results.json
|
| 39 |
+
89055b0d70f0787df200fb350546a72f0780d2afb1db8de8e1dcc8d33428b22c models/pretrained/stage1_cpt/args.json
|
| 40 |
+
44d5f08f3f72b837eaad09f13a54c1f9f4eb58d75240334548b7fd52a5437fa5 models/pretrained/stage1_cpt/chat_template.jinja
|
| 41 |
+
0d2cfcbf5e317ffaa0b8d8897b94a4b9c5e716ddd47ecd768f3ad0c2174ab2ce models/pretrained/stage1_cpt/config.json
|
| 42 |
+
8a210910e3bf58bdbdc6355ef06aa40ea311a7f579cd518cacd929955e9e43fa models/pretrained/stage1_cpt/generation_config.json
|
| 43 |
+
c119b284587312405231891869c326215379ec62890899a0b6af324204f8d290 models/pretrained/stage1_cpt/model.safetensors
|
| 44 |
+
3fd169731d2cbde95e10bf356d66d5997fd885dd8dbb6fb4684da3f23b2585d8 models/pretrained/stage1_cpt/tokenizer.json
|
| 45 |
+
35c37fe281bb6e5ed2a6699349c8dc7191a79c4c829abbffab33133908f11daa models/pretrained/stage1_cpt/tokenizer_config.json
|
| 46 |
+
5fb959d771564eae82f9187cd41e4da522d985d8585158898d3a7525c4b292ca models/pretrained/stage1_cpt/trainer_state.json
|
| 47 |
+
4a04289e2de79f87bed89881e01536369dd8c34c1b01a4806fd0aa08ccfc8293 models/sft/sft_f3_refined_instruct/args.json
|
| 48 |
+
cd8e9439f0570856fd70470bf8889ebd8b5d1107207f67a5efb46e342330527f models/sft/sft_f3_refined_instruct/chat_template.jinja
|
| 49 |
+
2a0bbab03998171855260860fbab81152ec51e67c7d69b85f32c7f624341fb0e models/sft/sft_f3_refined_instruct/config.json
|
| 50 |
+
87c51d61bd70a204993da36384296ccfeb56d46ee2cc7247929f917d0d8118f7 models/sft/sft_f3_refined_instruct/generation_config.json
|
| 51 |
+
05bca1c3ba20caad5a14ef0f450b6788aff7c9594bf90fe6deb5ecd2c5561847 models/sft/sft_f3_refined_instruct/model.safetensors
|
| 52 |
+
3fd169731d2cbde95e10bf356d66d5997fd885dd8dbb6fb4684da3f23b2585d8 models/sft/sft_f3_refined_instruct/tokenizer.json
|
| 53 |
+
4d8ad3fe9729e37338fae50bac94ff03cb915071eb886b937077114e874dfa06 models/sft/sft_f3_refined_instruct/tokenizer_config.json
|
| 54 |
+
7259447195d9af3cad318bed168eb341c6ac2d171ccaddab7e195e173d033642 models/sft/sft_f3_refined_instruct/trainer_state.json
|
| 55 |
+
2be5dce6f73513de2b0ef0e5b41c9f3b5691dba0e8867193dae6d19f18518da6 tools/build_manifest.py
|
| 56 |
+
8219ffc3a307516000a0c9612ecade9d0c274d85347f23757b8b30f240f92740 tools/smoke_test.py
|
| 57 |
+
259bf953bb9254443f6a164db05f02c1dfdc54c3ec6ee57502fae910b0eb2165 training_scripts/README.md
|
| 58 |
+
f25a669388095d705cc190e3f0351aaf1d310759bd1c7f3f452b3601364a4005 training_scripts/pretrain/stage1_short.sh
|
| 59 |
+
8feeae24b837c7ebfa77c41057d4286eec4eae5d66c870c32a274f773ae76d39 training_scripts/sft/run_qwen25_coder_0p5b_instruct_F3_v2_1gpu.sh
|
code/f3_filtering/build_F3_v3.py
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Build F3_clean_v3 from F3_clean_v2 by removing residual repetition / dup problems.
|
| 2 |
+
|
| 3 |
+
Rules (applied per sample, all must pass to keep):
|
| 4 |
+
R1: assistant length <= 8000 chars
|
| 5 |
+
R2: no line >=1 char (stripped) repeats >=10 times inside assistant
|
| 6 |
+
R3: no 5-gram (token-level) repeats >=20 times inside assistant
|
| 7 |
+
R4: cross-corpus exact-content dedup of assistant (keep first occurrence)
|
| 8 |
+
|
| 9 |
+
Streaming, two-pass for R4 (first pass: build hash counter; second pass: keep
|
| 10 |
+
first occurrence of each hash).
|
| 11 |
+
|
| 12 |
+
Output: scicode_sft_swift_F3_clean_v3.jsonl + report.
|
| 13 |
+
"""
|
| 14 |
+
from __future__ import annotations
|
| 15 |
+
|
| 16 |
+
import collections
|
| 17 |
+
import hashlib
|
| 18 |
+
import json
|
| 19 |
+
import re
|
| 20 |
+
import time
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
|
| 23 |
+
SRC = Path("/raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v2.jsonl")
|
| 24 |
+
DST = Path("/raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v3.jsonl")
|
| 25 |
+
REPORT = Path("/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_v3_report.json")
|
| 26 |
+
|
| 27 |
+
MAX_ASST_CHARS = 8000
|
| 28 |
+
LINE_REPEAT_THRESH = 10 # any stripped line repeating >= 10 times
|
| 29 |
+
NGRAM_N = 5
|
| 30 |
+
NGRAM_THRESH = 20 # 5-gram repeating >= 20 times
|
| 31 |
+
TOKEN_RE = re.compile(r"[A-Za-z_]\w*|[^\s\w]")
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def get_assistant(o: dict) -> str | None:
|
| 35 |
+
for m in o.get("messages", []) or []:
|
| 36 |
+
if m.get("role") == "assistant":
|
| 37 |
+
return m.get("content", "") or ""
|
| 38 |
+
return None
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def check_repetition(a: str) -> tuple[bool, bool, bool]:
|
| 42 |
+
"""Return (line_rep_bad, ngram_rep_bad, too_long).
|
| 43 |
+
"""
|
| 44 |
+
too_long = len(a) > MAX_ASST_CHARS
|
| 45 |
+
lines = [ln.strip() for ln in a.split("\n") if ln.strip()]
|
| 46 |
+
line_rep_bad = False
|
| 47 |
+
if lines:
|
| 48 |
+
c = collections.Counter(lines)
|
| 49 |
+
if c.most_common(1)[0][1] >= LINE_REPEAT_THRESH:
|
| 50 |
+
line_rep_bad = True
|
| 51 |
+
toks = TOKEN_RE.findall(a)
|
| 52 |
+
ngram_rep_bad = False
|
| 53 |
+
if len(toks) >= NGRAM_N:
|
| 54 |
+
c2 = collections.Counter(tuple(toks[i:i + NGRAM_N]) for i in range(len(toks) - NGRAM_N + 1))
|
| 55 |
+
if c2 and c2.most_common(1)[0][1] >= NGRAM_THRESH:
|
| 56 |
+
ngram_rep_bad = True
|
| 57 |
+
return line_rep_bad, ngram_rep_bad, too_long
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def main() -> None:
|
| 61 |
+
print("=== F3_v3 cleaning pipeline ===", flush=True)
|
| 62 |
+
t0 = time.time()
|
| 63 |
+
|
| 64 |
+
# ---------- Pass 1: scan + collect content hashes ----------
|
| 65 |
+
n = 0
|
| 66 |
+
bad_long = bad_line = bad_ngram = 0
|
| 67 |
+
line_only = ngram_only = both = 0
|
| 68 |
+
hash_counts: collections.Counter[str] = collections.Counter()
|
| 69 |
+
# we also remember whether each hash has any "good" representative to keep.
|
| 70 |
+
# cheaper: at pass2 we'll keep the first occurrence whose own per-row checks passed.
|
| 71 |
+
print(f"Pass 1: scanning {SRC}", flush=True)
|
| 72 |
+
with open(SRC, encoding="utf-8") as f:
|
| 73 |
+
for line in f:
|
| 74 |
+
try:
|
| 75 |
+
o = json.loads(line)
|
| 76 |
+
except Exception:
|
| 77 |
+
continue
|
| 78 |
+
n += 1
|
| 79 |
+
a = get_assistant(o)
|
| 80 |
+
if a is None:
|
| 81 |
+
continue
|
| 82 |
+
ll, ng, tl = check_repetition(a)
|
| 83 |
+
if tl:
|
| 84 |
+
bad_long += 1
|
| 85 |
+
if ll:
|
| 86 |
+
bad_line += 1
|
| 87 |
+
if ng:
|
| 88 |
+
bad_ngram += 1
|
| 89 |
+
if ll and ng:
|
| 90 |
+
both += 1
|
| 91 |
+
elif ll:
|
| 92 |
+
line_only += 1
|
| 93 |
+
elif ng:
|
| 94 |
+
ngram_only += 1
|
| 95 |
+
# hash assistant content for dedup pass
|
| 96 |
+
h = hashlib.md5(a.encode("utf-8", errors="ignore")).hexdigest()
|
| 97 |
+
hash_counts[h] += 1
|
| 98 |
+
if n % 50000 == 0:
|
| 99 |
+
print(f" [{n:,}] bad_long={bad_long} bad_line={bad_line} bad_ngram={bad_ngram} uniq_hashes={len(hash_counts):,}", flush=True)
|
| 100 |
+
t_p1 = time.time() - t0
|
| 101 |
+
print(f"Pass 1 done in {t_p1:.0f}s. total samples = {n:,}", flush=True)
|
| 102 |
+
|
| 103 |
+
dup_clusters = sum(1 for c in hash_counts.values() if c > 1)
|
| 104 |
+
dup_rows = sum(c for c in hash_counts.values() if c > 1)
|
| 105 |
+
print(f" exact-content dup clusters: {dup_clusters:,} covering {dup_rows:,} rows", flush=True)
|
| 106 |
+
|
| 107 |
+
# ---------- Pass 2: write filtered output ----------
|
| 108 |
+
seen_hashes: set[str] = set()
|
| 109 |
+
kept = 0
|
| 110 |
+
dropped_long = dropped_line = dropped_ngram = dropped_dup = 0
|
| 111 |
+
print(f"Pass 2: writing {DST}", flush=True)
|
| 112 |
+
DST.parent.mkdir(parents=True, exist_ok=True)
|
| 113 |
+
with open(SRC, encoding="utf-8") as fin, open(DST, "w", encoding="utf-8") as fout:
|
| 114 |
+
for line in fin:
|
| 115 |
+
try:
|
| 116 |
+
o = json.loads(line)
|
| 117 |
+
except Exception:
|
| 118 |
+
continue
|
| 119 |
+
a = get_assistant(o)
|
| 120 |
+
if a is None:
|
| 121 |
+
continue
|
| 122 |
+
# rule 1: length
|
| 123 |
+
if len(a) > MAX_ASST_CHARS:
|
| 124 |
+
dropped_long += 1
|
| 125 |
+
continue
|
| 126 |
+
# rule 2/3: repetition
|
| 127 |
+
ll, ng, _ = check_repetition(a)
|
| 128 |
+
if ll:
|
| 129 |
+
dropped_line += 1
|
| 130 |
+
continue
|
| 131 |
+
if ng:
|
| 132 |
+
dropped_ngram += 1
|
| 133 |
+
continue
|
| 134 |
+
# rule 4: cross-corpus dedup (keep first occurrence)
|
| 135 |
+
h = hashlib.md5(a.encode("utf-8", errors="ignore")).hexdigest()
|
| 136 |
+
if h in seen_hashes:
|
| 137 |
+
dropped_dup += 1
|
| 138 |
+
continue
|
| 139 |
+
seen_hashes.add(h)
|
| 140 |
+
fout.write(json.dumps(o, ensure_ascii=False) + "\n")
|
| 141 |
+
kept += 1
|
| 142 |
+
if (kept + dropped_long + dropped_line + dropped_ngram + dropped_dup) % 50000 == 0:
|
| 143 |
+
so_far = kept + dropped_long + dropped_line + dropped_ngram + dropped_dup
|
| 144 |
+
print(f" [{so_far:,}] kept={kept} dropped: long={dropped_long}, line={dropped_line}, ngram={dropped_ngram}, dup={dropped_dup}", flush=True)
|
| 145 |
+
|
| 146 |
+
elapsed = time.time() - t0
|
| 147 |
+
report = {
|
| 148 |
+
"input": str(SRC),
|
| 149 |
+
"output": str(DST),
|
| 150 |
+
"input_size": n,
|
| 151 |
+
"final_size": kept,
|
| 152 |
+
"kept_rate": round(kept / max(1, n), 4),
|
| 153 |
+
"rules": [
|
| 154 |
+
f"R1: drop if assistant > {MAX_ASST_CHARS} chars",
|
| 155 |
+
f"R2: drop if any stripped line repeats >= {LINE_REPEAT_THRESH} times in assistant",
|
| 156 |
+
f"R3: drop if any {NGRAM_N}-gram repeats >= {NGRAM_THRESH} times in assistant",
|
| 157 |
+
f"R4: drop cross-corpus exact-content duplicates (keep first occurrence)",
|
| 158 |
+
],
|
| 159 |
+
"scan_stats_before_filter": {
|
| 160 |
+
"samples_with_long_assistant": bad_long,
|
| 161 |
+
"samples_with_line_repeat": bad_line,
|
| 162 |
+
"samples_with_ngram_repeat": bad_ngram,
|
| 163 |
+
"samples_with_both_line_and_ngram": both,
|
| 164 |
+
"samples_with_only_line": line_only,
|
| 165 |
+
"samples_with_only_ngram": ngram_only,
|
| 166 |
+
"exact_dup_clusters": dup_clusters,
|
| 167 |
+
"exact_dup_rows_total": dup_rows,
|
| 168 |
+
},
|
| 169 |
+
"applied_drops": {
|
| 170 |
+
"R1_too_long": dropped_long,
|
| 171 |
+
"R2_line_repeat": dropped_line,
|
| 172 |
+
"R3_ngram_repeat": dropped_ngram,
|
| 173 |
+
"R4_dup": dropped_dup,
|
| 174 |
+
"total_dropped": dropped_long + dropped_line + dropped_ngram + dropped_dup,
|
| 175 |
+
},
|
| 176 |
+
"elapsed_sec": round(elapsed, 1),
|
| 177 |
+
}
|
| 178 |
+
REPORT.write_text(json.dumps(report, ensure_ascii=False, indent=2))
|
| 179 |
+
print(json.dumps(report, ensure_ascii=False, indent=2))
|
| 180 |
+
print(f"\nWrote {DST} ({DST.stat().st_size / 1e9:.2f} GB, {kept:,} samples)")
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
if __name__ == "__main__":
|
| 184 |
+
main()
|
code/f3_filtering/build_F3_v4.py
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Build F3_clean_v4 from F3_clean_v3 by applying additional quality rules.
|
| 2 |
+
|
| 3 |
+
Source data only has `messages` (no file/path), so S2 uses CONTENT heuristics:
|
| 4 |
+
- dunder __init__ whose body is ONLY attribute assignments (template ctor)
|
| 5 |
+
- main/setup/parse_args with trivial body
|
| 6 |
+
- one-line property getters/setters
|
| 7 |
+
|
| 8 |
+
Rules applied:
|
| 9 |
+
S1: MinHash near-duplicate (bottom-128 shingles, Jaccard threshold 0.85)
|
| 10 |
+
S2: template-style functions (content-based substitute)
|
| 11 |
+
S3: trivial function body (< 3 non-trivial statements after stripping docstring)
|
| 12 |
+
S4: comment/docstring ratio extreme (> 0.7 or == 0 with >=10 code lines)
|
| 13 |
+
S6: import-only or docstring-only assistant
|
| 14 |
+
S8: placeholder residue (TODO/FIXME/pdb/breakpoint/NotImplementedError/...)
|
| 15 |
+
|
| 16 |
+
Output: scicode_sft_swift_F3_clean_v4.jsonl + report.
|
| 17 |
+
"""
|
| 18 |
+
from __future__ import annotations
|
| 19 |
+
|
| 20 |
+
import collections
|
| 21 |
+
import json
|
| 22 |
+
import re
|
| 23 |
+
import time
|
| 24 |
+
from pathlib import Path
|
| 25 |
+
|
| 26 |
+
import xxhash
|
| 27 |
+
|
| 28 |
+
SRC = Path("/raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v3.jsonl")
|
| 29 |
+
DST = Path("/raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v4.jsonl")
|
| 30 |
+
REPORT = Path("/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_v4_report.json")
|
| 31 |
+
|
| 32 |
+
# ---------- knobs ----------
|
| 33 |
+
SHINGLE_K = 8 # 8-token shingles
|
| 34 |
+
SIG_K = 128 # bottom-128 minhash sketch
|
| 35 |
+
LSH_BANDS = 16 # 16 bands × 8 rows
|
| 36 |
+
JACCARD_THRESH = 0.85
|
| 37 |
+
TRIVIAL_STMT_THRESH = 3 # < 3 non-trivial lines = trivial
|
| 38 |
+
COMMENT_RATIO_HIGH = 0.70
|
| 39 |
+
MIN_CODE_LINES_FOR_NO_COMMENT_CHECK = 10
|
| 40 |
+
PLACEHOLDERS = (
|
| 41 |
+
"TODO", "FIXME", "XXX", "HACK",
|
| 42 |
+
"pdb.set_trace", "breakpoint(", "import pdb",
|
| 43 |
+
"raise NotImplementedError",
|
| 44 |
+
"pass # placeholder", "pass # implement",
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
+
CODE_FENCE_RE = re.compile(r"```(?:python|cpp|c|java|rust|go)?\s*\n([\s\S]*?)\n```", re.IGNORECASE)
|
| 48 |
+
TOKEN_RE = re.compile(r"[A-Za-z_]\w*|[^\s\w]")
|
| 49 |
+
COMMENT_RE = re.compile(r"^\s*(#|//|/\*|\*)")
|
| 50 |
+
DOCSTRING_TRIPLE = re.compile(r'(?s)"""[\s\S]*?"""|\'\'\'[\s\S]*?\'\'\'')
|
| 51 |
+
ATTR_ASSIGN_RE = re.compile(r"^\s*self\.\w+\s*=\s*\w+\s*$")
|
| 52 |
+
IMPORT_RE = re.compile(r"^\s*(?:from\s+\S+\s+import\s+|import\s+\S+)")
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def get_messages(o: dict) -> tuple[str, str]:
|
| 56 |
+
u = a = ""
|
| 57 |
+
for m in o.get("messages", []) or []:
|
| 58 |
+
if m.get("role") == "user":
|
| 59 |
+
u = m.get("content", "") or ""
|
| 60 |
+
elif m.get("role") == "assistant":
|
| 61 |
+
a = m.get("content", "") or ""
|
| 62 |
+
return u, a
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def extract_code(asst: str) -> str:
|
| 66 |
+
m = CODE_FENCE_RE.search(asst)
|
| 67 |
+
return m.group(1) if m else asst
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def is_placeholder(code: str) -> bool:
|
| 71 |
+
for kw in PLACEHOLDERS:
|
| 72 |
+
if kw in code:
|
| 73 |
+
return True
|
| 74 |
+
return False
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def is_import_or_docstring_only(code: str) -> bool:
|
| 78 |
+
stripped = DOCSTRING_TRIPLE.sub("", code)
|
| 79 |
+
lines = [ln.strip() for ln in stripped.split("\n") if ln.strip()]
|
| 80 |
+
if not lines:
|
| 81 |
+
return True
|
| 82 |
+
non_import_non_comment = [ln for ln in lines
|
| 83 |
+
if not IMPORT_RE.match(ln) and not COMMENT_RE.match(ln)]
|
| 84 |
+
return len(non_import_non_comment) < 3
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def is_trivial_body(code: str) -> bool:
|
| 88 |
+
# strip docstrings + comments, count statements
|
| 89 |
+
stripped = DOCSTRING_TRIPLE.sub("", code)
|
| 90 |
+
lines = [ln.strip() for ln in stripped.split("\n") if ln.strip()]
|
| 91 |
+
non_trivial = [ln for ln in lines
|
| 92 |
+
if not COMMENT_RE.match(ln)
|
| 93 |
+
and not IMPORT_RE.match(ln)
|
| 94 |
+
and not ln.startswith("def ")
|
| 95 |
+
and not ln.startswith("class ")
|
| 96 |
+
and not ln.startswith("@")
|
| 97 |
+
and ln not in ("pass", "...", "return", "return None")]
|
| 98 |
+
return len(non_trivial) < TRIVIAL_STMT_THRESH
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def comment_ratio_bad(code: str) -> bool:
|
| 102 |
+
lines = [ln for ln in code.split("\n") if ln.strip()]
|
| 103 |
+
if not lines:
|
| 104 |
+
return True
|
| 105 |
+
# count comment lines + docstring approximate
|
| 106 |
+
in_doc = False
|
| 107 |
+
doc_lines = 0
|
| 108 |
+
comment_lines = 0
|
| 109 |
+
code_lines = 0
|
| 110 |
+
for ln in lines:
|
| 111 |
+
s = ln.strip()
|
| 112 |
+
if in_doc:
|
| 113 |
+
doc_lines += 1
|
| 114 |
+
if s.endswith('"""') or s.endswith("'''"):
|
| 115 |
+
in_doc = False
|
| 116 |
+
continue
|
| 117 |
+
if s.startswith('"""') or s.startswith("'''"):
|
| 118 |
+
doc_lines += 1
|
| 119 |
+
if not (s.endswith('"""') and len(s) > 3) and not (s.endswith("'''") and len(s) > 3):
|
| 120 |
+
in_doc = True
|
| 121 |
+
continue
|
| 122 |
+
if COMMENT_RE.match(ln):
|
| 123 |
+
comment_lines += 1
|
| 124 |
+
else:
|
| 125 |
+
code_lines += 1
|
| 126 |
+
total = doc_lines + comment_lines + code_lines
|
| 127 |
+
if total == 0:
|
| 128 |
+
return True
|
| 129 |
+
doc_ratio = (doc_lines + comment_lines) / total
|
| 130 |
+
if doc_ratio > COMMENT_RATIO_HIGH:
|
| 131 |
+
return True
|
| 132 |
+
# also too few comments + lots of code: only penalize if NO comments AND >=10 code lines
|
| 133 |
+
if doc_lines + comment_lines == 0 and code_lines >= MIN_CODE_LINES_FOR_NO_COMMENT_CHECK:
|
| 134 |
+
return False # not punishing this; we keep it (only the >0.7 side is filtered)
|
| 135 |
+
return False
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
def is_template_func(asst: str, code: str) -> bool:
|
| 139 |
+
# detect ctor with only self.x=y body
|
| 140 |
+
if not re.search(r"def\s+__init__\s*\(", code):
|
| 141 |
+
pass
|
| 142 |
+
else:
|
| 143 |
+
body_lines = [ln.strip() for ln in code.split("\n") if ln.strip()]
|
| 144 |
+
body_lines = [ln for ln in body_lines
|
| 145 |
+
if not ln.startswith("def ") and not ln.startswith("@")
|
| 146 |
+
and not COMMENT_RE.match(ln) and not ln.startswith('"""') and not ln.startswith("'''")
|
| 147 |
+
and ln not in ("pass", "...")]
|
| 148 |
+
if body_lines and all(ATTR_ASSIGN_RE.match(ln) or ln == "" for ln in body_lines):
|
| 149 |
+
return True
|
| 150 |
+
# main/setup with trivial body
|
| 151 |
+
if re.search(r"def\s+(?:main|setup|parse_args|get_args)\s*\(", code) and is_trivial_body(code):
|
| 152 |
+
return True
|
| 153 |
+
return False
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
def code_shingles(code: str, k: int = SHINGLE_K) -> list[int]:
|
| 157 |
+
"""Return shingled token n-gram hashes (deduplicated)."""
|
| 158 |
+
toks = TOKEN_RE.findall(code)
|
| 159 |
+
if len(toks) < k:
|
| 160 |
+
return []
|
| 161 |
+
sh = set()
|
| 162 |
+
for i in range(len(toks) - k + 1):
|
| 163 |
+
h = xxhash.xxh64(" ".join(toks[i:i + k])).intdigest()
|
| 164 |
+
sh.add(h)
|
| 165 |
+
return sorted(sh)[:5000] # cap to bound mem for huge samples
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
def minhash_signature(shingles: list[int], sig_k: int = SIG_K) -> tuple[int, ...]:
|
| 169 |
+
"""Bottom-K minhash."""
|
| 170 |
+
if not shingles:
|
| 171 |
+
return tuple([0] * sig_k)
|
| 172 |
+
if len(shingles) >= sig_k:
|
| 173 |
+
return tuple(shingles[:sig_k])
|
| 174 |
+
return tuple(shingles + [0] * (sig_k - len(shingles)))
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
def lsh_band_keys(sig: tuple[int, ...], bands: int = LSH_BANDS) -> list[bytes]:
|
| 178 |
+
rows_per_band = len(sig) // bands
|
| 179 |
+
keys = []
|
| 180 |
+
for b in range(bands):
|
| 181 |
+
chunk = sig[b * rows_per_band:(b + 1) * rows_per_band]
|
| 182 |
+
keys.append(xxhash.xxh64(bytes(str(chunk), "utf-8")).digest())
|
| 183 |
+
return keys
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
def jaccard(a: tuple, b: tuple) -> float:
|
| 187 |
+
sa, sb = set(a) - {0}, set(b) - {0}
|
| 188 |
+
if not sa or not sb:
|
| 189 |
+
return 0.0
|
| 190 |
+
return len(sa & sb) / len(sa | sb)
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
def main() -> None:
|
| 194 |
+
print("=== F3_v4 cleaning pipeline ===", flush=True)
|
| 195 |
+
t0 = time.time()
|
| 196 |
+
|
| 197 |
+
# ---------- Pass 1: scan, compute per-row features and signatures ----------
|
| 198 |
+
rows: list[dict] = []
|
| 199 |
+
n = 0
|
| 200 |
+
print("Pass 1: scanning + computing features + minhash", flush=True)
|
| 201 |
+
with open(SRC, encoding="utf-8") as f:
|
| 202 |
+
for line in f:
|
| 203 |
+
try:
|
| 204 |
+
o = json.loads(line)
|
| 205 |
+
except Exception:
|
| 206 |
+
continue
|
| 207 |
+
n += 1
|
| 208 |
+
_, a = get_messages(o)
|
| 209 |
+
code = extract_code(a)
|
| 210 |
+
features = {
|
| 211 |
+
"s8_placeholder": is_placeholder(code),
|
| 212 |
+
"s6_import_doc_only": is_import_or_docstring_only(code),
|
| 213 |
+
"s3_trivial": is_trivial_body(code),
|
| 214 |
+
"s4_comment_ratio": comment_ratio_bad(code),
|
| 215 |
+
"s2_template": is_template_func(a, code),
|
| 216 |
+
}
|
| 217 |
+
sig = minhash_signature(code_shingles(code))
|
| 218 |
+
rows.append({"raw": line, "sig": sig, "features": features})
|
| 219 |
+
if n % 20000 == 0:
|
| 220 |
+
print(f" [{n:,}] features computed", flush=True)
|
| 221 |
+
t_p1 = time.time() - t0
|
| 222 |
+
print(f"Pass 1 done in {t_p1:.0f}s. total = {n:,}", flush=True)
|
| 223 |
+
|
| 224 |
+
# ---------- Pass 2: LSH near-dup detection ----------
|
| 225 |
+
print("Pass 2: LSH bucketing for near-dup", flush=True)
|
| 226 |
+
buckets: dict[bytes, list[int]] = collections.defaultdict(list)
|
| 227 |
+
for i, r in enumerate(rows):
|
| 228 |
+
for k in lsh_band_keys(r["sig"]):
|
| 229 |
+
buckets[k].append(i)
|
| 230 |
+
candidate_pairs: set[tuple[int, int]] = set()
|
| 231 |
+
for ids in buckets.values():
|
| 232 |
+
if len(ids) < 2:
|
| 233 |
+
continue
|
| 234 |
+
if len(ids) > 50: # huge buckets are likely noise, cap
|
| 235 |
+
ids = ids[:50]
|
| 236 |
+
for i in range(len(ids)):
|
| 237 |
+
for j in range(i + 1, len(ids)):
|
| 238 |
+
candidate_pairs.add((ids[i], ids[j]))
|
| 239 |
+
print(f" candidate pairs: {len(candidate_pairs):,}", flush=True)
|
| 240 |
+
|
| 241 |
+
near_dup: set[int] = set()
|
| 242 |
+
for a, b in candidate_pairs:
|
| 243 |
+
if a in near_dup or b in near_dup:
|
| 244 |
+
continue
|
| 245 |
+
if jaccard(rows[a]["sig"], rows[b]["sig"]) >= JACCARD_THRESH:
|
| 246 |
+
# keep the longer one (= more informative)
|
| 247 |
+
la = len(rows[a]["raw"]); lb = len(rows[b]["raw"])
|
| 248 |
+
near_dup.add(b if la >= lb else a)
|
| 249 |
+
print(f" near-dup marked: {len(near_dup):,}", flush=True)
|
| 250 |
+
|
| 251 |
+
# ---------- Pass 3: write filtered output ----------
|
| 252 |
+
print(f"Pass 3: writing {DST}", flush=True)
|
| 253 |
+
DST.parent.mkdir(parents=True, exist_ok=True)
|
| 254 |
+
drops = collections.Counter()
|
| 255 |
+
kept = 0
|
| 256 |
+
with open(DST, "w", encoding="utf-8") as fout:
|
| 257 |
+
for i, r in enumerate(rows):
|
| 258 |
+
f = r["features"]
|
| 259 |
+
# priority order — drop on first match for clean accounting
|
| 260 |
+
if i in near_dup:
|
| 261 |
+
drops["S1_near_dup"] += 1
|
| 262 |
+
continue
|
| 263 |
+
if f["s2_template"]:
|
| 264 |
+
drops["S2_template"] += 1
|
| 265 |
+
continue
|
| 266 |
+
if f["s3_trivial"]:
|
| 267 |
+
drops["S3_trivial"] += 1
|
| 268 |
+
continue
|
| 269 |
+
if f["s4_comment_ratio"]:
|
| 270 |
+
drops["S4_comment_ratio"] += 1
|
| 271 |
+
continue
|
| 272 |
+
if f["s6_import_doc_only"]:
|
| 273 |
+
drops["S6_import_doc_only"] += 1
|
| 274 |
+
continue
|
| 275 |
+
if f["s8_placeholder"]:
|
| 276 |
+
drops["S8_placeholder"] += 1
|
| 277 |
+
continue
|
| 278 |
+
fout.write(r["raw"])
|
| 279 |
+
kept += 1
|
| 280 |
+
|
| 281 |
+
elapsed = time.time() - t0
|
| 282 |
+
report = {
|
| 283 |
+
"input": str(SRC),
|
| 284 |
+
"output": str(DST),
|
| 285 |
+
"input_size": n,
|
| 286 |
+
"final_size": kept,
|
| 287 |
+
"kept_rate": round(kept / max(1, n), 4),
|
| 288 |
+
"rules": [
|
| 289 |
+
f"S1: MinHash near-dup, Jaccard >= {JACCARD_THRESH}, bottom-{SIG_K} shingle-{SHINGLE_K}",
|
| 290 |
+
"S2: template ctor / setup / main with trivial body (content-based)",
|
| 291 |
+
f"S3: trivial body (< {TRIVIAL_STMT_THRESH} non-trivial statements)",
|
| 292 |
+
f"S4: comment+docstring ratio > {COMMENT_RATIO_HIGH}",
|
| 293 |
+
"S6: import-only / docstring-only assistant",
|
| 294 |
+
f"S8: placeholder residue ({', '.join(PLACEHOLDERS[:5])}, ...)",
|
| 295 |
+
],
|
| 296 |
+
"applied_drops": dict(drops),
|
| 297 |
+
"total_dropped": sum(drops.values()),
|
| 298 |
+
"elapsed_sec": round(elapsed, 1),
|
| 299 |
+
}
|
| 300 |
+
REPORT.write_text(json.dumps(report, ensure_ascii=False, indent=2))
|
| 301 |
+
print(json.dumps(report, ensure_ascii=False, indent=2))
|
| 302 |
+
print(f"\nWrote {DST} ({DST.stat().st_size / 1e9:.2f} GB, {kept:,} samples)")
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
if __name__ == "__main__":
|
| 306 |
+
main()
|
code/f3_filtering/clean_F3_stage1.py
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""F3 → F3_v2 cleaning pipeline — Stage 1: structural filters.
|
| 2 |
+
|
| 3 |
+
Drops samples whose assistant code block matches any of:
|
| 4 |
+
1a AST cannot parse
|
| 5 |
+
1b any line >=5 stripped chars repeats >=5 times
|
| 6 |
+
1c function body is < 3 lines or > 500 lines
|
| 7 |
+
1d contains hardcoded local paths (/home/, /Users/, C:\\, /tmp/<name>, /mnt/<name>)
|
| 8 |
+
1e pure placeholder body (only pass / ... / raise NotImplementedError / return None)
|
| 9 |
+
1f debug residue: breakpoint(), pdb.set_trace(), or >=3 TODO/FIXME markers
|
| 10 |
+
"""
|
| 11 |
+
from __future__ import annotations
|
| 12 |
+
|
| 13 |
+
import ast
|
| 14 |
+
import json
|
| 15 |
+
import re
|
| 16 |
+
from collections import Counter
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
|
| 19 |
+
SRC = Path("/raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean.jsonl")
|
| 20 |
+
DST = Path("/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage1.jsonl")
|
| 21 |
+
REPORT = Path("/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage1_report.json")
|
| 22 |
+
|
| 23 |
+
CODE_FENCE_RE = re.compile(r"```(?:python|py)?\s*\n([\s\S]*?)```", re.IGNORECASE)
|
| 24 |
+
# Generic fence (any language) for language-aware filtering
|
| 25 |
+
GENERIC_FENCE_RE = re.compile(r"```(\S*)\s*\n([\s\S]*?)```", re.IGNORECASE)
|
| 26 |
+
HARDCODED_PATH_RE = re.compile(
|
| 27 |
+
r"(?:[\"'])(?:/home/[^/\s\"']+/|/Users/[^/\s\"']+/|/tmp/[A-Za-z0-9_-]+|/mnt/[^/\s\"']+/|/data/[A-Za-z0-9_-]+|[A-Z]:\\\\?[A-Za-z0-9_-]+\\\\)"
|
| 28 |
+
)
|
| 29 |
+
DEBUG_RE = re.compile(r"\b(?:breakpoint\(\)|pdb\.set_trace\(\)|ipdb\.set_trace\(\))")
|
| 30 |
+
TODO_RE = re.compile(r"#\s*(?:TODO|FIXME|XXX|HACK)\b", re.IGNORECASE)
|
| 31 |
+
PLACEHOLDER_RE = re.compile(
|
| 32 |
+
r"^\s*(?:pass|\.\.\.|raise\s+NotImplementedError(?:\(.*?\))?|return\s+None)\s*$",
|
| 33 |
+
re.MULTILINE,
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def get_assistant_code_with_lang(obj: dict) -> tuple[str, str]:
|
| 38 |
+
"""Return (code, fence_language). Language defaults to 'python' when fence omitted/empty."""
|
| 39 |
+
for m in obj.get("messages", []):
|
| 40 |
+
if m.get("role") == "assistant":
|
| 41 |
+
text = m.get("content", "")
|
| 42 |
+
mfence = GENERIC_FENCE_RE.search(text)
|
| 43 |
+
if mfence:
|
| 44 |
+
lang = (mfence.group(1) or "").strip().lower()
|
| 45 |
+
code = mfence.group(2)
|
| 46 |
+
if not lang or lang == "py":
|
| 47 |
+
lang = "python"
|
| 48 |
+
return code, lang
|
| 49 |
+
return text, "python"
|
| 50 |
+
return "", "python"
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def is_pure_placeholder(code: str) -> bool:
|
| 54 |
+
"""True if the function body has only placeholder/no-op statements."""
|
| 55 |
+
try:
|
| 56 |
+
tree = ast.parse(code)
|
| 57 |
+
except SyntaxError:
|
| 58 |
+
return False
|
| 59 |
+
has_real = False
|
| 60 |
+
for node in ast.walk(tree):
|
| 61 |
+
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
|
| 62 |
+
body = node.body
|
| 63 |
+
# ignore docstring
|
| 64 |
+
if body and isinstance(body[0], ast.Expr) and isinstance(body[0].value, ast.Constant) and isinstance(body[0].value.value, str):
|
| 65 |
+
body = body[1:]
|
| 66 |
+
if not body:
|
| 67 |
+
continue
|
| 68 |
+
for stmt in body:
|
| 69 |
+
if isinstance(stmt, ast.Pass):
|
| 70 |
+
continue
|
| 71 |
+
if isinstance(stmt, ast.Expr) and isinstance(stmt.value, ast.Constant) and stmt.value.value is Ellipsis:
|
| 72 |
+
continue
|
| 73 |
+
if isinstance(stmt, ast.Raise) and stmt.exc and (
|
| 74 |
+
(isinstance(stmt.exc, ast.Name) and stmt.exc.id == "NotImplementedError")
|
| 75 |
+
or (isinstance(stmt.exc, ast.Call) and isinstance(stmt.exc.func, ast.Name) and stmt.exc.func.id == "NotImplementedError")
|
| 76 |
+
):
|
| 77 |
+
continue
|
| 78 |
+
if isinstance(stmt, ast.Return) and (stmt.value is None or (isinstance(stmt.value, ast.Constant) and stmt.value.value is None)):
|
| 79 |
+
continue
|
| 80 |
+
# any other stmt counts as real code
|
| 81 |
+
has_real = True
|
| 82 |
+
break
|
| 83 |
+
if has_real:
|
| 84 |
+
break
|
| 85 |
+
return not has_real # all defs are pure placeholder
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def filter_sample(code: str, lang: str) -> tuple[bool, str]:
|
| 89 |
+
"""Return (keep, reason_if_drop). `lang` decides whether to AST-parse Python."""
|
| 90 |
+
if not code or not code.strip():
|
| 91 |
+
return False, "1c_empty"
|
| 92 |
+
# 1c: length sanity
|
| 93 |
+
n_lines = len(code.splitlines())
|
| 94 |
+
if n_lines < 3:
|
| 95 |
+
return False, "1c_too_short"
|
| 96 |
+
if n_lines > 500:
|
| 97 |
+
return False, "1c_too_long"
|
| 98 |
+
# 1a: AST parse — only enforced for python-fenced samples
|
| 99 |
+
if lang == "python":
|
| 100 |
+
try:
|
| 101 |
+
ast.parse(code)
|
| 102 |
+
except SyntaxError:
|
| 103 |
+
return False, "1a_ast_fail_python"
|
| 104 |
+
# 1b: line repeat >=5 (applies to all languages — repetition is universally bad signal)
|
| 105 |
+
qual_lines = [ln for ln in code.splitlines() if len(ln.strip()) >= 5]
|
| 106 |
+
if qual_lines:
|
| 107 |
+
max_rep = Counter(qual_lines).most_common(1)[0][1]
|
| 108 |
+
if max_rep >= 5:
|
| 109 |
+
return False, "1b_line_repeat"
|
| 110 |
+
# 1d: hardcoded local path
|
| 111 |
+
if HARDCODED_PATH_RE.search(code):
|
| 112 |
+
return False, "1d_hardcoded_path"
|
| 113 |
+
# 1f: debug residue (Python-specific markers; harmless to apply broadly)
|
| 114 |
+
if DEBUG_RE.search(code):
|
| 115 |
+
return False, "1f_debug_pdb"
|
| 116 |
+
if len(TODO_RE.findall(code)) >= 3:
|
| 117 |
+
return False, "1f_many_todo"
|
| 118 |
+
# 1e: pure placeholder (Python-only check; non-Python skipped)
|
| 119 |
+
if lang == "python" and is_pure_placeholder(code):
|
| 120 |
+
return False, "1e_placeholder"
|
| 121 |
+
return True, ""
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
def main() -> None:
|
| 125 |
+
DST.parent.mkdir(parents=True, exist_ok=True)
|
| 126 |
+
drop_reasons: Counter[str] = Counter()
|
| 127 |
+
lang_counts_kept: Counter[str] = Counter()
|
| 128 |
+
n_total = n_kept = 0
|
| 129 |
+
with open(SRC) as fin, open(DST, "w", encoding="utf-8") as fout:
|
| 130 |
+
for line in fin:
|
| 131 |
+
n_total += 1
|
| 132 |
+
obj = json.loads(line)
|
| 133 |
+
code, lang = get_assistant_code_with_lang(obj)
|
| 134 |
+
keep, reason = filter_sample(code, lang)
|
| 135 |
+
if not keep:
|
| 136 |
+
drop_reasons[reason] += 1
|
| 137 |
+
continue
|
| 138 |
+
n_kept += 1
|
| 139 |
+
lang_counts_kept[lang] += 1
|
| 140 |
+
fout.write(line)
|
| 141 |
+
|
| 142 |
+
n_dropped = n_total - n_kept
|
| 143 |
+
report = {
|
| 144 |
+
"src": str(SRC),
|
| 145 |
+
"dst": str(DST),
|
| 146 |
+
"n_total": n_total,
|
| 147 |
+
"n_kept": n_kept,
|
| 148 |
+
"n_dropped": n_dropped,
|
| 149 |
+
"drop_rate": round(n_dropped / max(n_total, 1), 4),
|
| 150 |
+
"drop_reasons": dict(drop_reasons.most_common()),
|
| 151 |
+
"kept_languages": dict(lang_counts_kept.most_common(20)),
|
| 152 |
+
}
|
| 153 |
+
REPORT.write_text(json.dumps(report, indent=2, ensure_ascii=False))
|
| 154 |
+
print(json.dumps(report, indent=2, ensure_ascii=False))
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
if __name__ == "__main__":
|
| 158 |
+
main()
|
code/f3_filtering/clean_F3_stage2.py
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""F3 → F3_v2 — Stage 2: per-project cap=300 with D1xD2 stratified sampling.
|
| 2 |
+
|
| 3 |
+
D1 (code length): S<15, M1=15-39, M2=40-99, L>=100
|
| 4 |
+
D2 (line repeat): norep<5, rep>=5
|
| 5 |
+
|
| 6 |
+
Per project (>300 samples): allocate 75 per D1 bucket; rep cap=5 per D1; reallocate shortfall to other D1 norep buckets. Random sample within bucket (seed=0).
|
| 7 |
+
"""
|
| 8 |
+
from __future__ import annotations
|
| 9 |
+
|
| 10 |
+
import hashlib
|
| 11 |
+
import json
|
| 12 |
+
import random
|
| 13 |
+
import re
|
| 14 |
+
from collections import Counter, defaultdict
|
| 15 |
+
from pathlib import Path
|
| 16 |
+
|
| 17 |
+
SRC = Path("/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage1.jsonl")
|
| 18 |
+
DST = Path("/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage2.jsonl")
|
| 19 |
+
REPORT = Path("/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage2_report.json")
|
| 20 |
+
|
| 21 |
+
CAP = 300
|
| 22 |
+
D1_TARGET = {"S": 75, "M1": 75, "M2": 75, "L": 75}
|
| 23 |
+
REP_LIMIT_PER_D1 = 5
|
| 24 |
+
SEED = 0
|
| 25 |
+
|
| 26 |
+
CODE_FENCE_RE = re.compile(r"```(?:python|py)?\s*\n([\s\S]*?)```", re.IGNORECASE)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def get_assistant_code(obj: dict) -> str:
|
| 30 |
+
for m in obj.get("messages", []):
|
| 31 |
+
if m.get("role") == "assistant":
|
| 32 |
+
text = m.get("content", "")
|
| 33 |
+
mfence = CODE_FENCE_RE.search(text)
|
| 34 |
+
return mfence.group(1) if mfence else text
|
| 35 |
+
return ""
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def get_user(obj: dict) -> str:
|
| 39 |
+
for m in obj.get("messages", []):
|
| 40 |
+
if m.get("role") == "user":
|
| 41 |
+
return m.get("content", "")
|
| 42 |
+
return ""
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def d1_bucket(n_lines: int) -> str:
|
| 46 |
+
if n_lines < 15: return "S"
|
| 47 |
+
if n_lines < 40: return "M1"
|
| 48 |
+
if n_lines < 100: return "M2"
|
| 49 |
+
return "L"
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def main() -> None:
|
| 53 |
+
DST.parent.mkdir(parents=True, exist_ok=True)
|
| 54 |
+
rng = random.Random(SEED)
|
| 55 |
+
|
| 56 |
+
# PASS 1: bucket all samples by project, store sample with index for stable refs
|
| 57 |
+
proj_buckets: dict[str, dict[tuple[str, str], list[int]]] = defaultdict(lambda: defaultdict(list))
|
| 58 |
+
rows: list[str] = []
|
| 59 |
+
with open(SRC) as fin:
|
| 60 |
+
for idx, line in enumerate(fin):
|
| 61 |
+
obj = json.loads(line)
|
| 62 |
+
u = get_user(obj)
|
| 63 |
+
code = get_assistant_code(obj)
|
| 64 |
+
n_lines = len(code.splitlines())
|
| 65 |
+
qual = [ln for ln in code.splitlines() if len(ln.strip()) >= 5]
|
| 66 |
+
max_rep = max(Counter(qual).values()) if qual else 0
|
| 67 |
+
d1 = d1_bucket(n_lines)
|
| 68 |
+
d2 = "rep" if max_rep >= 5 else "norep" # should be 0 after stage1
|
| 69 |
+
proj_h = hashlib.md5(u[:500].encode()).hexdigest()
|
| 70 |
+
proj_buckets[proj_h][(d1, d2)].append(idx)
|
| 71 |
+
rows.append(line)
|
| 72 |
+
print(f"loaded {len(rows)} samples from {len(proj_buckets)} projects")
|
| 73 |
+
|
| 74 |
+
# PASS 2: per project sampling
|
| 75 |
+
keep_indices: set[int] = set()
|
| 76 |
+
n_proj_capped = 0
|
| 77 |
+
n_proj_untouched = 0
|
| 78 |
+
bucket_kept_counter: Counter[tuple[str, str]] = Counter()
|
| 79 |
+
|
| 80 |
+
for proj_h, buckets in proj_buckets.items():
|
| 81 |
+
n_in_proj = sum(len(v) for v in buckets.values())
|
| 82 |
+
if n_in_proj <= CAP:
|
| 83 |
+
# untouched
|
| 84 |
+
for v in buckets.values():
|
| 85 |
+
for idx in v:
|
| 86 |
+
keep_indices.add(idx)
|
| 87 |
+
# for stats only
|
| 88 |
+
n_proj_untouched += 1
|
| 89 |
+
continue
|
| 90 |
+
|
| 91 |
+
n_proj_capped += 1
|
| 92 |
+
# allocate per D1 (target 75 each, 4 buckets = 300)
|
| 93 |
+
chosen: list[int] = []
|
| 94 |
+
d1_remaining: dict[str, int] = dict(D1_TARGET)
|
| 95 |
+
unfilled: list[str] = [] # D1 that couldn't fill from norep
|
| 96 |
+
|
| 97 |
+
for d1 in ["S", "M1", "M2", "L"]:
|
| 98 |
+
target = d1_remaining[d1]
|
| 99 |
+
norep_pool = list(buckets.get((d1, "norep"), []))
|
| 100 |
+
rep_pool = list(buckets.get((d1, "rep"), []))
|
| 101 |
+
rng.shuffle(norep_pool)
|
| 102 |
+
rng.shuffle(rep_pool)
|
| 103 |
+
|
| 104 |
+
# take from norep first
|
| 105 |
+
take_norep = min(len(norep_pool), target)
|
| 106 |
+
chosen.extend(norep_pool[:take_norep])
|
| 107 |
+
target -= take_norep
|
| 108 |
+
|
| 109 |
+
# fill remaining from rep, capped by REP_LIMIT_PER_D1
|
| 110 |
+
rep_take = min(target, REP_LIMIT_PER_D1, len(rep_pool))
|
| 111 |
+
chosen.extend(rep_pool[:rep_take])
|
| 112 |
+
target -= rep_take
|
| 113 |
+
|
| 114 |
+
# update remaining: norep_pool[take_norep:] is leftover norep
|
| 115 |
+
norep_left = norep_pool[take_norep:]
|
| 116 |
+
buckets[(d1, "norep_leftover")] = norep_left
|
| 117 |
+
buckets[(d1, "rep_leftover")] = rep_pool[rep_take:]
|
| 118 |
+
|
| 119 |
+
if target > 0:
|
| 120 |
+
unfilled.append(d1)
|
| 121 |
+
d1_remaining[d1] = target # how much D1 still needs
|
| 122 |
+
else:
|
| 123 |
+
d1_remaining[d1] = 0
|
| 124 |
+
|
| 125 |
+
# reallocate shortfall: pull norep_leftover from other D1 buckets
|
| 126 |
+
total_short = sum(d1_remaining.values())
|
| 127 |
+
if total_short > 0:
|
| 128 |
+
extra_pool = []
|
| 129 |
+
for d1 in ["S", "M1", "M2", "L"]:
|
| 130 |
+
extra_pool.extend(buckets.get((d1, "norep_leftover"), []))
|
| 131 |
+
rng.shuffle(extra_pool)
|
| 132 |
+
take = min(total_short, len(extra_pool))
|
| 133 |
+
chosen.extend(extra_pool[:take])
|
| 134 |
+
|
| 135 |
+
# final cap (in case of overshoot due to algorithm bug)
|
| 136 |
+
if len(chosen) > CAP:
|
| 137 |
+
chosen = chosen[:CAP]
|
| 138 |
+
|
| 139 |
+
for idx in chosen:
|
| 140 |
+
keep_indices.add(idx)
|
| 141 |
+
|
| 142 |
+
# stats: for each chosen, look up its bucket
|
| 143 |
+
# (skip detailed bucket stats per project; aggregate later)
|
| 144 |
+
|
| 145 |
+
# write output
|
| 146 |
+
with open(DST, "w", encoding="utf-8") as fout:
|
| 147 |
+
for idx in sorted(keep_indices):
|
| 148 |
+
fout.write(rows[idx])
|
| 149 |
+
|
| 150 |
+
n_kept = len(keep_indices)
|
| 151 |
+
n_total = len(rows)
|
| 152 |
+
|
| 153 |
+
report = {
|
| 154 |
+
"src": str(SRC),
|
| 155 |
+
"dst": str(DST),
|
| 156 |
+
"n_total": n_total,
|
| 157 |
+
"n_kept": n_kept,
|
| 158 |
+
"n_dropped": n_total - n_kept,
|
| 159 |
+
"drop_rate": round(1 - n_kept / max(n_total, 1), 4),
|
| 160 |
+
"n_projects": len(proj_buckets),
|
| 161 |
+
"n_projects_capped": n_proj_capped,
|
| 162 |
+
"n_projects_untouched": n_proj_untouched,
|
| 163 |
+
"cap": CAP,
|
| 164 |
+
"d1_target": D1_TARGET,
|
| 165 |
+
"rep_limit_per_d1": REP_LIMIT_PER_D1,
|
| 166 |
+
"seed": SEED,
|
| 167 |
+
}
|
| 168 |
+
REPORT.write_text(json.dumps(report, indent=2, ensure_ascii=False))
|
| 169 |
+
print(json.dumps(report, indent=2, ensure_ascii=False))
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
if __name__ == "__main__":
|
| 173 |
+
main()
|
code/f3_filtering/clean_F3_stage3.py
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""F3 → F3_v2 — Stage 3: per-project assistant deduplication, K=3.
|
| 2 |
+
|
| 3 |
+
For each project (identified by user-prompt-prefix hash), keep at most K samples
|
| 4 |
+
per unique assistant code. Sampling is random within over-represented groups
|
| 5 |
+
(seed=0).
|
| 6 |
+
"""
|
| 7 |
+
from __future__ import annotations
|
| 8 |
+
|
| 9 |
+
import hashlib
|
| 10 |
+
import json
|
| 11 |
+
import random
|
| 12 |
+
import re
|
| 13 |
+
from collections import defaultdict
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
|
| 16 |
+
SRC = Path("/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage2.jsonl")
|
| 17 |
+
DST = Path("/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage3.jsonl")
|
| 18 |
+
REPORT = Path("/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage3_report.json")
|
| 19 |
+
|
| 20 |
+
K = 3
|
| 21 |
+
SEED = 0
|
| 22 |
+
|
| 23 |
+
CODE_FENCE_RE = re.compile(r"```(?:python|py)?\s*\n([\s\S]*?)```", re.IGNORECASE)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def get_assistant_code(obj: dict) -> str:
|
| 27 |
+
for m in obj.get("messages", []):
|
| 28 |
+
if m.get("role") == "assistant":
|
| 29 |
+
text = m.get("content", "")
|
| 30 |
+
mfence = CODE_FENCE_RE.search(text)
|
| 31 |
+
return mfence.group(1) if mfence else text
|
| 32 |
+
return ""
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def get_user(obj: dict) -> str:
|
| 36 |
+
for m in obj.get("messages", []):
|
| 37 |
+
if m.get("role") == "user":
|
| 38 |
+
return m.get("content", "")
|
| 39 |
+
return ""
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def md5(s: str) -> str:
|
| 43 |
+
return hashlib.md5(s.encode()).hexdigest()
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def main() -> None:
|
| 47 |
+
DST.parent.mkdir(parents=True, exist_ok=True)
|
| 48 |
+
rng = random.Random(SEED)
|
| 49 |
+
|
| 50 |
+
# group sample indices by (proj_hash, asst_hash)
|
| 51 |
+
groups: dict[tuple[str, str], list[int]] = defaultdict(list)
|
| 52 |
+
rows: list[str] = []
|
| 53 |
+
with open(SRC) as fin:
|
| 54 |
+
for idx, line in enumerate(fin):
|
| 55 |
+
obj = json.loads(line)
|
| 56 |
+
u = get_user(obj)
|
| 57 |
+
a = get_assistant_code(obj)
|
| 58 |
+
proj_h = md5(u[:500])
|
| 59 |
+
asst_h = md5(a)
|
| 60 |
+
groups[(proj_h, asst_h)].append(idx)
|
| 61 |
+
rows.append(line)
|
| 62 |
+
|
| 63 |
+
n_total = len(rows)
|
| 64 |
+
keep: set[int] = set()
|
| 65 |
+
n_groups = len(groups)
|
| 66 |
+
n_groups_truncated = 0
|
| 67 |
+
over_count = 0
|
| 68 |
+
|
| 69 |
+
for (proj_h, asst_h), idxs in groups.items():
|
| 70 |
+
if len(idxs) <= K:
|
| 71 |
+
for i in idxs: keep.add(i)
|
| 72 |
+
else:
|
| 73 |
+
n_groups_truncated += 1
|
| 74 |
+
over_count += len(idxs) - K
|
| 75 |
+
rng.shuffle(idxs)
|
| 76 |
+
for i in idxs[:K]: keep.add(i)
|
| 77 |
+
|
| 78 |
+
with open(DST, "w", encoding="utf-8") as fout:
|
| 79 |
+
for idx in sorted(keep):
|
| 80 |
+
fout.write(rows[idx])
|
| 81 |
+
|
| 82 |
+
n_kept = len(keep)
|
| 83 |
+
report = {
|
| 84 |
+
"src": str(SRC),
|
| 85 |
+
"dst": str(DST),
|
| 86 |
+
"n_total": n_total,
|
| 87 |
+
"n_kept": n_kept,
|
| 88 |
+
"n_dropped": n_total - n_kept,
|
| 89 |
+
"drop_rate": round(1 - n_kept / max(n_total, 1), 4),
|
| 90 |
+
"n_unique_(proj,asst)_groups": n_groups,
|
| 91 |
+
"n_groups_truncated": n_groups_truncated,
|
| 92 |
+
"n_dups_dropped": over_count,
|
| 93 |
+
"K": K,
|
| 94 |
+
"seed": SEED,
|
| 95 |
+
}
|
| 96 |
+
REPORT.write_text(json.dumps(report, indent=2, ensure_ascii=False))
|
| 97 |
+
print(json.dumps(report, indent=2, ensure_ascii=False))
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
if __name__ == "__main__":
|
| 101 |
+
main()
|
code/f3_filtering/clean_F3_stage4.py
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""F3 → F3_v2 — Stage 4 (full): Qwen3-Coder-30B-A3B-Instruct quality scoring.
|
| 2 |
+
|
| 3 |
+
For every sample in F3_stage3.jsonl, ask the model to rate 1-5. Keep score >= 3.
|
| 4 |
+
Run with the skill conda env (vLLM)."""
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
import argparse
|
| 8 |
+
import json
|
| 9 |
+
import re
|
| 10 |
+
import time
|
| 11 |
+
from collections import Counter
|
| 12 |
+
from pathlib import Path
|
| 13 |
+
|
| 14 |
+
CODE_FENCE_RE = re.compile(r"```(?:python|py)?\s*\n([\s\S]*?)```", re.IGNORECASE)
|
| 15 |
+
GENERIC_FENCE_RE = re.compile(r"```(\S*)\s*\n([\s\S]*?)```", re.IGNORECASE)
|
| 16 |
+
|
| 17 |
+
DEFAULT_MODEL = "/mnt/moon-data/jfjiang/swf/skillsecure/data/models/Qwen3-Coder-30B-A3B-Instruct"
|
| 18 |
+
DEFAULT_SRC = "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage3.jsonl"
|
| 19 |
+
DEFAULT_DST = "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage4.jsonl"
|
| 20 |
+
DEFAULT_REPORT = "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage4_report.json"
|
| 21 |
+
DEFAULT_SCORES = "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage4_scores.jsonl"
|
| 22 |
+
|
| 23 |
+
KEEP_THRESHOLD = 3
|
| 24 |
+
|
| 25 |
+
SCORE_PROMPT = """You are a senior Python code reviewer. Rate the quality of the following function on a scale of 1-5:
|
| 26 |
+
|
| 27 |
+
1 = unusable (broken, placeholder, or nonsense)
|
| 28 |
+
2 = poor (works but low quality, bad style, or hardcoded values)
|
| 29 |
+
3 = ok (works, average style)
|
| 30 |
+
4 = good (clean, readable, reasonable structure)
|
| 31 |
+
5 = excellent (production-ready, well-documented, robust)
|
| 32 |
+
|
| 33 |
+
Function description (from project context):
|
| 34 |
+
{user_brief}
|
| 35 |
+
|
| 36 |
+
Code:
|
| 37 |
+
```python
|
| 38 |
+
{code}
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
Output ONLY a single digit from 1 to 5. No explanation."""
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def get_user_brief(u: str, max_chars: int = 1500) -> str:
|
| 45 |
+
return u[:max_chars]
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def get_assistant_code(obj: dict) -> str:
|
| 49 |
+
for m in obj.get("messages", []):
|
| 50 |
+
if m.get("role") == "assistant":
|
| 51 |
+
text = m.get("content", "")
|
| 52 |
+
mfence = GENERIC_FENCE_RE.search(text)
|
| 53 |
+
return mfence.group(2) if mfence else text
|
| 54 |
+
return ""
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def get_user(obj: dict) -> str:
|
| 58 |
+
for m in obj.get("messages", []):
|
| 59 |
+
if m.get("role") == "user":
|
| 60 |
+
return m.get("content", "")
|
| 61 |
+
return ""
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def parse_score(text: str) -> int:
|
| 65 |
+
if not text:
|
| 66 |
+
return 0
|
| 67 |
+
m = re.search(r"\b([1-5])\b", text)
|
| 68 |
+
return int(m.group(1)) if m else 0
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
def main() -> None:
|
| 72 |
+
ap = argparse.ArgumentParser()
|
| 73 |
+
ap.add_argument("--src", default=DEFAULT_SRC)
|
| 74 |
+
ap.add_argument("--dst", default=DEFAULT_DST)
|
| 75 |
+
ap.add_argument("--report", default=DEFAULT_REPORT)
|
| 76 |
+
ap.add_argument("--scores", default=DEFAULT_SCORES)
|
| 77 |
+
ap.add_argument("--model", default=DEFAULT_MODEL)
|
| 78 |
+
ap.add_argument("--threshold", type=int, default=KEEP_THRESHOLD)
|
| 79 |
+
ap.add_argument("--gpu-mem-util", type=float, default=0.85)
|
| 80 |
+
ap.add_argument("--max-model-len", type=int, default=8192)
|
| 81 |
+
ap.add_argument("--batch-chunk", type=int, default=20000,
|
| 82 |
+
help="how many samples to feed vLLM in one .generate() call")
|
| 83 |
+
args = ap.parse_args()
|
| 84 |
+
|
| 85 |
+
src = Path(args.src)
|
| 86 |
+
rows: list[str] = []
|
| 87 |
+
with open(src) as f:
|
| 88 |
+
for line in f:
|
| 89 |
+
rows.append(line)
|
| 90 |
+
print(f"loaded {len(rows)} samples")
|
| 91 |
+
|
| 92 |
+
from vllm import LLM, SamplingParams
|
| 93 |
+
from transformers import AutoTokenizer
|
| 94 |
+
|
| 95 |
+
tok = AutoTokenizer.from_pretrained(args.model, trust_remote_code=True)
|
| 96 |
+
llm = LLM(
|
| 97 |
+
model=args.model, tokenizer=args.model, trust_remote_code=True,
|
| 98 |
+
max_model_len=args.max_model_len, gpu_memory_utilization=args.gpu_mem_util,
|
| 99 |
+
dtype="bfloat16",
|
| 100 |
+
)
|
| 101 |
+
sp = SamplingParams(temperature=0.0, top_p=1.0, max_tokens=8)
|
| 102 |
+
|
| 103 |
+
# Pre-build all chat prompts; if a prompt would exceed max_model_len after tokenize, skip (rare).
|
| 104 |
+
print("building chat prompts...")
|
| 105 |
+
chat_prompts: list[str] = []
|
| 106 |
+
skip_indices: set[int] = set()
|
| 107 |
+
for idx, line in enumerate(rows):
|
| 108 |
+
obj = json.loads(line)
|
| 109 |
+
user_brief = get_user_brief(get_user(obj))
|
| 110 |
+
code = get_assistant_code(obj)
|
| 111 |
+
prompt = SCORE_PROMPT.format(user_brief=user_brief, code=code)
|
| 112 |
+
msgs = [{"role": "user", "content": prompt}]
|
| 113 |
+
try:
|
| 114 |
+
chat_prompt = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
|
| 115 |
+
except Exception:
|
| 116 |
+
chat_prompt = prompt
|
| 117 |
+
# quick token-length check to avoid validation error
|
| 118 |
+
tok_ids = tok(chat_prompt, add_special_tokens=False)["input_ids"]
|
| 119 |
+
if len(tok_ids) >= args.max_model_len - 10:
|
| 120 |
+
skip_indices.add(idx)
|
| 121 |
+
chat_prompts.append("") # placeholder
|
| 122 |
+
else:
|
| 123 |
+
chat_prompts.append(chat_prompt)
|
| 124 |
+
print(f"too-long (skipped, default-keep): {len(skip_indices)}")
|
| 125 |
+
|
| 126 |
+
scores: list[int] = [0] * len(rows)
|
| 127 |
+
n_chunk = (len(rows) + args.batch_chunk - 1) // args.batch_chunk
|
| 128 |
+
cumulative = 0
|
| 129 |
+
t0 = time.time()
|
| 130 |
+
for c in range(n_chunk):
|
| 131 |
+
lo = c * args.batch_chunk
|
| 132 |
+
hi = min((c + 1) * args.batch_chunk, len(rows))
|
| 133 |
+
batch_idx = [i for i in range(lo, hi) if i not in skip_indices]
|
| 134 |
+
batch_prompts = [chat_prompts[i] for i in batch_idx]
|
| 135 |
+
if not batch_prompts:
|
| 136 |
+
continue
|
| 137 |
+
print(f"chunk {c+1}/{n_chunk}: scoring {len(batch_prompts)} prompts (lo={lo})")
|
| 138 |
+
outs = llm.generate(batch_prompts, sp)
|
| 139 |
+
for i, o in zip(batch_idx, outs):
|
| 140 |
+
scores[i] = parse_score(o.outputs[0].text)
|
| 141 |
+
cumulative += len(batch_prompts)
|
| 142 |
+
elapsed = time.time() - t0
|
| 143 |
+
rate = cumulative / max(elapsed, 1e-9)
|
| 144 |
+
eta = (len(rows) - len(skip_indices) - cumulative) / max(rate, 1e-9)
|
| 145 |
+
print(f" done {cumulative}; rate={rate:.1f}/s; eta={eta/60:.1f}min")
|
| 146 |
+
|
| 147 |
+
# write scores
|
| 148 |
+
with open(args.scores, "w") as f:
|
| 149 |
+
for i, s in enumerate(scores):
|
| 150 |
+
f.write(json.dumps({"idx": i, "score": s}, ensure_ascii=False) + "\n")
|
| 151 |
+
|
| 152 |
+
# filter and write
|
| 153 |
+
n_keep = 0
|
| 154 |
+
score_dist: Counter[int] = Counter()
|
| 155 |
+
with open(args.dst, "w", encoding="utf-8") as fout:
|
| 156 |
+
for i, line in enumerate(rows):
|
| 157 |
+
s = scores[i]
|
| 158 |
+
score_dist[s] += 1
|
| 159 |
+
if i in skip_indices or s >= args.threshold:
|
| 160 |
+
fout.write(line)
|
| 161 |
+
n_keep += 1
|
| 162 |
+
|
| 163 |
+
elapsed_total = time.time() - t0
|
| 164 |
+
report = {
|
| 165 |
+
"src": str(src),
|
| 166 |
+
"dst": args.dst,
|
| 167 |
+
"model": args.model,
|
| 168 |
+
"threshold": args.threshold,
|
| 169 |
+
"n_total": len(rows),
|
| 170 |
+
"n_kept": n_keep,
|
| 171 |
+
"n_dropped": len(rows) - n_keep,
|
| 172 |
+
"drop_rate": round(1 - n_keep / max(len(rows), 1), 4),
|
| 173 |
+
"n_skipped_too_long_kept_default": len(skip_indices),
|
| 174 |
+
"score_distribution": dict(sorted(score_dist.items())),
|
| 175 |
+
"score_distribution_pct": {str(k): round(v / len(rows) * 100, 2) for k, v in sorted(score_dist.items())},
|
| 176 |
+
"elapsed_sec": round(elapsed_total, 1),
|
| 177 |
+
}
|
| 178 |
+
Path(args.report).parent.mkdir(parents=True, exist_ok=True)
|
| 179 |
+
with open(args.report, "w") as f:
|
| 180 |
+
json.dump(report, f, indent=2, ensure_ascii=False)
|
| 181 |
+
print("\n=== summary ===")
|
| 182 |
+
print(json.dumps(report, indent=2, ensure_ascii=False))
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
if __name__ == "__main__":
|
| 186 |
+
main()
|
code/f3_filtering/clean_F3_stage4_calibrate.py
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""F3 → F3_v2 — Stage 4 calibration: Qwen3-Coder-30B-A3B-Instruct 1-5 quality score on 500 sampled rows.
|
| 2 |
+
|
| 3 |
+
Prints score distribution + a few low/high-score samples for sanity check.
|
| 4 |
+
Run with the skill conda env (has vLLM)."""
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
import argparse
|
| 8 |
+
import json
|
| 9 |
+
import random
|
| 10 |
+
import re
|
| 11 |
+
import time
|
| 12 |
+
from collections import Counter
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
|
| 15 |
+
CODE_FENCE_RE = re.compile(r"```(?:python|py)?\s*\n([\s\S]*?)```", re.IGNORECASE)
|
| 16 |
+
|
| 17 |
+
DEFAULT_MODEL = "/mnt/moon-data/jfjiang/swf/skillsecure/data/models/Qwen3-Coder-30B-A3B-Instruct"
|
| 18 |
+
DEFAULT_SRC = "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage3.jsonl"
|
| 19 |
+
DEFAULT_OUT = "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage4_calibration.json"
|
| 20 |
+
DEFAULT_SCORES = "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage4_calibration_scores.jsonl"
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
SCORE_PROMPT = """You are a senior Python code reviewer. Rate the quality of the following function on a scale of 1-5:
|
| 24 |
+
|
| 25 |
+
1 = unusable (broken, placeholder, or nonsense)
|
| 26 |
+
2 = poor (works but low quality, bad style, or hardcoded values)
|
| 27 |
+
3 = ok (works, average style)
|
| 28 |
+
4 = good (clean, readable, reasonable structure)
|
| 29 |
+
5 = excellent (production-ready, well-documented, robust)
|
| 30 |
+
|
| 31 |
+
Function description (from project context):
|
| 32 |
+
{user_brief}
|
| 33 |
+
|
| 34 |
+
Code:
|
| 35 |
+
```python
|
| 36 |
+
{code}
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
Output ONLY a single digit from 1 to 5. No explanation."""
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def get_user_brief(u: str, max_chars: int = 1500) -> str:
|
| 43 |
+
"""Trim user prompt to function-relevant section (skip Project Overview if too long)."""
|
| 44 |
+
return u[:max_chars]
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def get_assistant_code(obj: dict) -> str:
|
| 48 |
+
for m in obj.get("messages", []):
|
| 49 |
+
if m.get("role") == "assistant":
|
| 50 |
+
text = m.get("content", "")
|
| 51 |
+
mfence = CODE_FENCE_RE.search(text)
|
| 52 |
+
return mfence.group(1) if mfence else text
|
| 53 |
+
return ""
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def get_user(obj: dict) -> str:
|
| 57 |
+
for m in obj.get("messages", []):
|
| 58 |
+
if m.get("role") == "user":
|
| 59 |
+
return m.get("content", "")
|
| 60 |
+
return ""
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def parse_score(text: str) -> int:
|
| 64 |
+
if not text: return 0
|
| 65 |
+
m = re.search(r"\b([1-5])\b", text)
|
| 66 |
+
if m: return int(m.group(1))
|
| 67 |
+
return 0 # unparseable
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def main() -> None:
|
| 71 |
+
ap = argparse.ArgumentParser()
|
| 72 |
+
ap.add_argument("--src", default=DEFAULT_SRC)
|
| 73 |
+
ap.add_argument("--model", default=DEFAULT_MODEL)
|
| 74 |
+
ap.add_argument("--n-sample", type=int, default=500)
|
| 75 |
+
ap.add_argument("--seed", type=int, default=0)
|
| 76 |
+
ap.add_argument("--out-summary", default=DEFAULT_OUT)
|
| 77 |
+
ap.add_argument("--out-scores", default=DEFAULT_SCORES)
|
| 78 |
+
ap.add_argument("--gpu-mem-util", type=float, default=0.85)
|
| 79 |
+
ap.add_argument("--max-model-len", type=int, default=8192)
|
| 80 |
+
args = ap.parse_args()
|
| 81 |
+
|
| 82 |
+
rng = random.Random(args.seed)
|
| 83 |
+
src = Path(args.src)
|
| 84 |
+
|
| 85 |
+
rows = []
|
| 86 |
+
with open(src) as f:
|
| 87 |
+
for line in f:
|
| 88 |
+
rows.append(line)
|
| 89 |
+
print(f"loaded {len(rows)} samples from {src.name}")
|
| 90 |
+
|
| 91 |
+
sample_idx = rng.sample(range(len(rows)), args.n_sample)
|
| 92 |
+
sampled = [(i, json.loads(rows[i])) for i in sample_idx]
|
| 93 |
+
|
| 94 |
+
prompts = []
|
| 95 |
+
for _, obj in sampled:
|
| 96 |
+
user_brief = get_user_brief(get_user(obj))
|
| 97 |
+
code = get_assistant_code(obj)
|
| 98 |
+
prompts.append(SCORE_PROMPT.format(user_brief=user_brief, code=code))
|
| 99 |
+
|
| 100 |
+
from vllm import LLM, SamplingParams
|
| 101 |
+
from transformers import AutoTokenizer
|
| 102 |
+
|
| 103 |
+
tok = AutoTokenizer.from_pretrained(args.model, trust_remote_code=True)
|
| 104 |
+
llm = LLM(
|
| 105 |
+
model=args.model, tokenizer=args.model, trust_remote_code=True,
|
| 106 |
+
max_model_len=args.max_model_len, gpu_memory_utilization=args.gpu_mem_util,
|
| 107 |
+
dtype="bfloat16",
|
| 108 |
+
)
|
| 109 |
+
sp = SamplingParams(temperature=0.0, top_p=1.0, max_tokens=8)
|
| 110 |
+
|
| 111 |
+
chat_prompts = []
|
| 112 |
+
for p in prompts:
|
| 113 |
+
msgs = [{"role": "user", "content": p}]
|
| 114 |
+
chat_prompts.append(tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True))
|
| 115 |
+
|
| 116 |
+
print(f"scoring {len(chat_prompts)}...")
|
| 117 |
+
t0 = time.time()
|
| 118 |
+
outputs = llm.generate(chat_prompts, sp)
|
| 119 |
+
secs = time.time() - t0
|
| 120 |
+
|
| 121 |
+
scores = []
|
| 122 |
+
raw_outs = []
|
| 123 |
+
for o in outputs:
|
| 124 |
+
text = o.outputs[0].text
|
| 125 |
+
raw_outs.append(text)
|
| 126 |
+
scores.append(parse_score(text))
|
| 127 |
+
|
| 128 |
+
dist = Counter(scores)
|
| 129 |
+
summary = {
|
| 130 |
+
"n_sample": len(sampled),
|
| 131 |
+
"elapsed_sec": round(secs, 1),
|
| 132 |
+
"score_distribution": {str(k): dist.get(k, 0) for k in [0, 1, 2, 3, 4, 5]},
|
| 133 |
+
"score_distribution_pct": {str(k): round(dist.get(k, 0) / len(sampled) * 100, 1) for k in [0, 1, 2, 3, 4, 5]},
|
| 134 |
+
"ge3_count": sum(dist.get(k, 0) for k in [3, 4, 5]),
|
| 135 |
+
"ge3_pct": round(sum(dist.get(k, 0) for k in [3, 4, 5]) / len(sampled) * 100, 1),
|
| 136 |
+
"ge4_count": sum(dist.get(k, 0) for k in [4, 5]),
|
| 137 |
+
"ge4_pct": round(sum(dist.get(k, 0) for k in [4, 5]) / len(sampled) * 100, 1),
|
| 138 |
+
}
|
| 139 |
+
Path(args.out_summary).parent.mkdir(parents=True, exist_ok=True)
|
| 140 |
+
with open(args.out_summary, "w") as f:
|
| 141 |
+
json.dump(summary, f, indent=2, ensure_ascii=False)
|
| 142 |
+
with open(args.out_scores, "w") as f:
|
| 143 |
+
for (i, obj), s, raw in zip(sampled, scores, raw_outs):
|
| 144 |
+
code = get_assistant_code(obj)
|
| 145 |
+
f.write(json.dumps({
|
| 146 |
+
"idx": i,
|
| 147 |
+
"score": s,
|
| 148 |
+
"raw_out": raw,
|
| 149 |
+
"code_head": code[:200],
|
| 150 |
+
}, ensure_ascii=False) + "\n")
|
| 151 |
+
print("\n=== summary ===")
|
| 152 |
+
print(json.dumps(summary, indent=2, ensure_ascii=False))
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
if __name__ == "__main__":
|
| 156 |
+
main()
|
code/f3_filtering/reports/F3_stage1_report.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"src": "/raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean.jsonl",
|
| 3 |
+
"dst": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage1.jsonl",
|
| 4 |
+
"n_total": 473465,
|
| 5 |
+
"n_kept": 437671,
|
| 6 |
+
"n_dropped": 35794,
|
| 7 |
+
"drop_rate": 0.0756,
|
| 8 |
+
"drop_reasons": {
|
| 9 |
+
"1b_line_repeat": 13506,
|
| 10 |
+
"1c_too_short": 9295,
|
| 11 |
+
"1a_ast_fail_python": 5119,
|
| 12 |
+
"1e_placeholder": 2497,
|
| 13 |
+
"1d_hardcoded_path": 2396,
|
| 14 |
+
"1c_too_long": 1621,
|
| 15 |
+
"1f_debug_pdb": 962,
|
| 16 |
+
"1f_many_todo": 398
|
| 17 |
+
},
|
| 18 |
+
"kept_languages": {
|
| 19 |
+
"python": 400263,
|
| 20 |
+
"cpp": 16733,
|
| 21 |
+
"c": 10995,
|
| 22 |
+
"java": 6879,
|
| 23 |
+
"rust": 2577,
|
| 24 |
+
"go": 224
|
| 25 |
+
}
|
| 26 |
+
}
|
code/f3_filtering/reports/F3_stage2_report.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"src": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage1.jsonl",
|
| 3 |
+
"dst": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage2.jsonl",
|
| 4 |
+
"n_total": 437671,
|
| 5 |
+
"n_kept": 366672,
|
| 6 |
+
"n_dropped": 70999,
|
| 7 |
+
"drop_rate": 0.1622,
|
| 8 |
+
"n_projects": 14408,
|
| 9 |
+
"n_projects_capped": 217,
|
| 10 |
+
"n_projects_untouched": 14191,
|
| 11 |
+
"cap": 300,
|
| 12 |
+
"d1_target": {
|
| 13 |
+
"S": 75,
|
| 14 |
+
"M1": 75,
|
| 15 |
+
"M2": 75,
|
| 16 |
+
"L": 75
|
| 17 |
+
},
|
| 18 |
+
"rep_limit_per_d1": 5,
|
| 19 |
+
"seed": 0
|
| 20 |
+
}
|
code/f3_filtering/reports/F3_stage3_report.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"src": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage2.jsonl",
|
| 3 |
+
"dst": "/raid/data/weifeng/Datasets/Instruction-turning/F3_v2_pipeline/F3_stage3.jsonl",
|
| 4 |
+
"n_total": 366672,
|
| 5 |
+
"n_kept": 362367,
|
| 6 |
+
"n_dropped": 4305,
|
| 7 |
+
"drop_rate": 0.0117,
|
| 8 |
+
"n_unique_(proj,asst)_groups": 344696,
|
| 9 |
+
"n_groups_truncated": 1509,
|
| 10 |
+
"n_dups_dropped": 4305,
|
| 11 |
+
"K": 3,
|
| 12 |
+
"seed": 0
|
| 13 |
+
}
|
code/f3_filtering/reports/F3_stage4_calibration.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"n_sample": 500,
|
| 3 |
+
"elapsed_sec": 9.3,
|
| 4 |
+
"score_distribution": {
|
| 5 |
+
"0": 0,
|
| 6 |
+
"1": 19,
|
| 7 |
+
"2": 180,
|
| 8 |
+
"3": 233,
|
| 9 |
+
"4": 66,
|
| 10 |
+
"5": 2
|
| 11 |
+
},
|
| 12 |
+
"score_distribution_pct": {
|
| 13 |
+
"0": 0.0,
|
| 14 |
+
"1": 3.8,
|
| 15 |
+
"2": 36.0,
|
| 16 |
+
"3": 46.6,
|
| 17 |
+
"4": 13.2,
|
| 18 |
+
"5": 0.4
|
| 19 |
+
},
|
| 20 |
+
"ge3_count": 301,
|
| 21 |
+
"ge3_pct": 60.2,
|
| 22 |
+
"ge4_count": 68,
|
| 23 |
+
"ge4_pct": 13.6
|
| 24 |
+
}
|
code/f3_filtering/reports/F3_v3_build.log
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
=== F3_v3 cleaning pipeline ===
|
| 2 |
+
Pass 1: scanning /raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v2.jsonl
|
| 3 |
+
[50,000] bad_long=827 bad_line=934 bad_ngram=1382 uniq_hashes=42,720
|
| 4 |
+
[100,000] bad_long=1732 bad_line=1875 bad_ngram=2931 uniq_hashes=81,939
|
| 5 |
+
[150,000] bad_long=2709 bad_line=3110 bad_ngram=4630 uniq_hashes=119,702
|
| 6 |
+
[200,000] bad_long=3624 bad_line=4026 bad_ngram=6034 uniq_hashes=159,121
|
| 7 |
+
Pass 1 done in 39s. total samples = 207,009
|
| 8 |
+
exact-content dup clusters: 17,531 covering 61,156 rows
|
| 9 |
+
Pass 2: writing /raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v3.jsonl
|
| 10 |
+
[50,000] kept=40523 dropped: long=827, line=708, ngram=1046, dup=6896
|
| 11 |
+
[100,000] kept=77467 dropped: long=1732, line=1400, ngram=2224, dup=17177
|
| 12 |
+
[150,000] kept=112838 dropped: long=2709, line=2307, ngram=3474, dup=28672
|
| 13 |
+
{
|
| 14 |
+
"input": "/raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v2.jsonl",
|
| 15 |
+
"output": "/raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v3.jsonl",
|
| 16 |
+
"input_size": 207009,
|
| 17 |
+
"final_size": 154103,
|
| 18 |
+
"kept_rate": 0.7444,
|
| 19 |
+
"rules": [
|
| 20 |
+
"R1: drop if assistant > 8000 chars",
|
| 21 |
+
"R2: drop if any stripped line repeats >= 10 times in assistant",
|
| 22 |
+
"R3: drop if any 5-gram repeats >= 20 times in assistant",
|
| 23 |
+
"R4: drop cross-corpus exact-content duplicates (keep first occurrence)"
|
| 24 |
+
],
|
| 25 |
+
"scan_stats_before_filter": {
|
| 26 |
+
"samples_with_long_assistant": 3764,
|
| 27 |
+
"samples_with_line_repeat": 4140,
|
| 28 |
+
"samples_with_ngram_repeat": 6251,
|
| 29 |
+
"samples_with_both_line_and_ngram": 652,
|
| 30 |
+
"samples_with_only_line": 3488,
|
| 31 |
+
"samples_with_only_ngram": 5599,
|
| 32 |
+
"exact_dup_clusters": 17531,
|
| 33 |
+
"exact_dup_rows_total": 61156
|
| 34 |
+
},
|
| 35 |
+
"applied_drops": {
|
| 36 |
+
"R1_too_long": 3764,
|
| 37 |
+
"R2_line_repeat": 3046,
|
| 38 |
+
"R3_ngram_repeat": 4677,
|
| 39 |
+
"R4_dup": 41419,
|
| 40 |
+
"total_dropped": 52906
|
| 41 |
+
},
|
| 42 |
+
"elapsed_sec": 81.8
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
Wrote /raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v3.jsonl (0.79 GB, 154,103 samples)
|
code/f3_filtering/reports/F3_v3_report.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"input": "/raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v2.jsonl",
|
| 3 |
+
"output": "/raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v3.jsonl",
|
| 4 |
+
"input_size": 207009,
|
| 5 |
+
"final_size": 154103,
|
| 6 |
+
"kept_rate": 0.7444,
|
| 7 |
+
"rules": [
|
| 8 |
+
"R1: drop if assistant > 8000 chars",
|
| 9 |
+
"R2: drop if any stripped line repeats >= 10 times in assistant",
|
| 10 |
+
"R3: drop if any 5-gram repeats >= 20 times in assistant",
|
| 11 |
+
"R4: drop cross-corpus exact-content duplicates (keep first occurrence)"
|
| 12 |
+
],
|
| 13 |
+
"scan_stats_before_filter": {
|
| 14 |
+
"samples_with_long_assistant": 3764,
|
| 15 |
+
"samples_with_line_repeat": 4140,
|
| 16 |
+
"samples_with_ngram_repeat": 6251,
|
| 17 |
+
"samples_with_both_line_and_ngram": 652,
|
| 18 |
+
"samples_with_only_line": 3488,
|
| 19 |
+
"samples_with_only_ngram": 5599,
|
| 20 |
+
"exact_dup_clusters": 17531,
|
| 21 |
+
"exact_dup_rows_total": 61156
|
| 22 |
+
},
|
| 23 |
+
"applied_drops": {
|
| 24 |
+
"R1_too_long": 3764,
|
| 25 |
+
"R2_line_repeat": 3046,
|
| 26 |
+
"R3_ngram_repeat": 4677,
|
| 27 |
+
"R4_dup": 41419,
|
| 28 |
+
"total_dropped": 52906
|
| 29 |
+
},
|
| 30 |
+
"elapsed_sec": 81.8
|
| 31 |
+
}
|
code/f3_filtering/reports/F3_v4_build.log
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
=== F3_v4 cleaning pipeline ===
|
| 2 |
+
Pass 1: scanning + computing features + minhash
|
| 3 |
+
[20,000] features computed
|
| 4 |
+
[40,000] features computed
|
| 5 |
+
[60,000] features computed
|
| 6 |
+
[80,000] features computed
|
| 7 |
+
[100,000] features computed
|
| 8 |
+
[120,000] features computed
|
| 9 |
+
[140,000] features computed
|
| 10 |
+
Pass 1 done in 95s. total = 154,103
|
| 11 |
+
Pass 2: LSH bucketing for near-dup
|
| 12 |
+
candidate pairs: 28,732
|
| 13 |
+
near-dup marked: 6,390
|
| 14 |
+
Pass 3: writing /raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v4.jsonl
|
| 15 |
+
{
|
| 16 |
+
"input": "/raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v3.jsonl",
|
| 17 |
+
"output": "/raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v4.jsonl",
|
| 18 |
+
"input_size": 154103,
|
| 19 |
+
"final_size": 134775,
|
| 20 |
+
"kept_rate": 0.8746,
|
| 21 |
+
"rules": [
|
| 22 |
+
"S1: MinHash near-dup, Jaccard >= 0.85, bottom-128 shingle-8",
|
| 23 |
+
"S2: template ctor / setup / main with trivial body (content-based)",
|
| 24 |
+
"S3: trivial body (< 3 non-trivial statements)",
|
| 25 |
+
"S4: comment+docstring ratio > 0.7",
|
| 26 |
+
"S6: import-only / docstring-only assistant",
|
| 27 |
+
"S8: placeholder residue (TODO, FIXME, XXX, HACK, pdb.set_trace, ...)"
|
| 28 |
+
],
|
| 29 |
+
"applied_drops": {
|
| 30 |
+
"S1_near_dup": 6390,
|
| 31 |
+
"S3_trivial": 6376,
|
| 32 |
+
"S8_placeholder": 3958,
|
| 33 |
+
"S4_comment_ratio": 2286,
|
| 34 |
+
"S2_template": 318
|
| 35 |
+
},
|
| 36 |
+
"total_dropped": 19328,
|
| 37 |
+
"elapsed_sec": 101.0
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
Wrote /raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v4.jsonl (0.70 GB, 134,775 samples)
|
code/pretrain_data_prep/analyze_template_repetition.py
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Scan filtered/filtered_*.jsonl, report:
|
| 2 |
+
1. Top template-style basenames (counts + total bytes + duplicate ratio per file).
|
| 3 |
+
2. Top high-frequency lines (stripped) across the whole corpus, with sample coverage.
|
| 4 |
+
3. Top short-phrase n-grams (3-gram and 5-gram over tokens of stripped lines), sampled.
|
| 5 |
+
|
| 6 |
+
Output: filtered_repetition_report.json + .md
|
| 7 |
+
Pure-stdlib, single-pass over disk, ~10GB.
|
| 8 |
+
"""
|
| 9 |
+
from __future__ import annotations
|
| 10 |
+
|
| 11 |
+
import json
|
| 12 |
+
import os
|
| 13 |
+
import re
|
| 14 |
+
import sys
|
| 15 |
+
from collections import Counter, defaultdict
|
| 16 |
+
from glob import glob
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
|
| 19 |
+
SRC_DIR = Path("/raid/data/weifeng/Datasets/filtered")
|
| 20 |
+
OUT_JSON = Path("/raid/data/weifeng/Datasets/filtered_repetition_report.json")
|
| 21 |
+
OUT_MD = Path("/raid/data/weifeng/Datasets/filtered_repetition_report.md")
|
| 22 |
+
|
| 23 |
+
TEMPLATE_BASENAMES = {
|
| 24 |
+
"__init__.py", "setup.py", "config.py", "conf.py", "settings.py",
|
| 25 |
+
"constants.py", "version.py", "_version.py", "manage.py",
|
| 26 |
+
"decorators.py", "exceptions.py", "errors.py", "utils.py",
|
| 27 |
+
"types.py", "schemas.py", "logging.py", "logger.py",
|
| 28 |
+
"__main__.py", "wsgi.py", "asgi.py", "urls.py", "apps.py",
|
| 29 |
+
"models.py", "admin.py", # not always template, but check
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
# heuristic: line frequency we care about
|
| 33 |
+
TOP_LINES_KEEP = 2000 # keep top N lines for report
|
| 34 |
+
TOP_BASENAMES_KEEP = 500
|
| 35 |
+
NGRAM_TOP_KEEP = 500
|
| 36 |
+
NGRAM_SAMPLE_EVERY = 20 # only do n-gram counting on every Nth file to save memory
|
| 37 |
+
|
| 38 |
+
# strip whitespace, ignore very short / very long lines for stats
|
| 39 |
+
MIN_LINE_LEN = 8
|
| 40 |
+
MAX_LINE_LEN = 200
|
| 41 |
+
|
| 42 |
+
# token regex for n-grams over line text
|
| 43 |
+
TOKEN_RE = re.compile(r"[A-Za-z_][A-Za-z0-9_]*|[^\s\w]")
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def main() -> None:
|
| 47 |
+
files = sorted(glob(str(SRC_DIR / "filtered_*.jsonl")))
|
| 48 |
+
print(f"found {len(files)} jsonl files", flush=True)
|
| 49 |
+
|
| 50 |
+
basename_counter: Counter[str] = Counter()
|
| 51 |
+
basename_bytes: Counter[str] = Counter()
|
| 52 |
+
basename_dup_lines: Counter[str] = Counter() # how many duplicate lines (within file) total per basename
|
| 53 |
+
line_counter: Counter[str] = Counter()
|
| 54 |
+
line_sample_coverage: Counter[str] = Counter() # how many distinct samples contain the line
|
| 55 |
+
ngram3_counter: Counter[tuple] = Counter()
|
| 56 |
+
ngram5_counter: Counter[tuple] = Counter()
|
| 57 |
+
|
| 58 |
+
total_samples = 0
|
| 59 |
+
total_bytes = 0
|
| 60 |
+
py_samples = 0
|
| 61 |
+
|
| 62 |
+
for fi, fp in enumerate(files):
|
| 63 |
+
do_ngram = (fi % NGRAM_SAMPLE_EVERY == 0)
|
| 64 |
+
try:
|
| 65 |
+
with open(fp, encoding="utf-8") as f:
|
| 66 |
+
for line in f:
|
| 67 |
+
try:
|
| 68 |
+
o = json.loads(line)
|
| 69 |
+
except Exception:
|
| 70 |
+
continue
|
| 71 |
+
path = o.get("path", "") or ""
|
| 72 |
+
text = o.get("text", "") or ""
|
| 73 |
+
if not text:
|
| 74 |
+
continue
|
| 75 |
+
total_samples += 1
|
| 76 |
+
total_bytes += len(text)
|
| 77 |
+
basename = os.path.basename(path) if path else "<unknown>"
|
| 78 |
+
basename_counter[basename] += 1
|
| 79 |
+
basename_bytes[basename] += len(text)
|
| 80 |
+
if path.endswith(".py"):
|
| 81 |
+
py_samples += 1
|
| 82 |
+
|
| 83 |
+
# within-file line duplication: how repetitive is THIS file?
|
| 84 |
+
file_lines = [ln.strip() for ln in text.split("\n")]
|
| 85 |
+
file_line_cnt = Counter(ln for ln in file_lines if MIN_LINE_LEN <= len(ln) <= MAX_LINE_LEN)
|
| 86 |
+
dup_here = sum(c - 1 for c in file_line_cnt.values() if c > 1)
|
| 87 |
+
basename_dup_lines[basename] += dup_here
|
| 88 |
+
|
| 89 |
+
# cross-corpus line stats
|
| 90 |
+
seen_in_this_sample: set[str] = set()
|
| 91 |
+
for ln, c in file_line_cnt.items():
|
| 92 |
+
line_counter[ln] += c
|
| 93 |
+
if ln not in seen_in_this_sample:
|
| 94 |
+
line_sample_coverage[ln] += 1
|
| 95 |
+
seen_in_this_sample.add(ln)
|
| 96 |
+
|
| 97 |
+
if do_ngram and len(file_lines) > 5:
|
| 98 |
+
# take a slice to bound memory
|
| 99 |
+
for ln in file_lines[:400]:
|
| 100 |
+
toks = TOKEN_RE.findall(ln)
|
| 101 |
+
if len(toks) < 3:
|
| 102 |
+
continue
|
| 103 |
+
for i in range(len(toks) - 2):
|
| 104 |
+
ngram3_counter[tuple(toks[i:i + 3])] += 1
|
| 105 |
+
if len(toks) >= 5:
|
| 106 |
+
for i in range(len(toks) - 4):
|
| 107 |
+
ngram5_counter[tuple(toks[i:i + 5])] += 1
|
| 108 |
+
|
| 109 |
+
# prune to avoid OOM
|
| 110 |
+
if total_samples % 100000 == 0:
|
| 111 |
+
print(f" [{total_samples}] processed; "
|
| 112 |
+
f"line_counter={len(line_counter):,} ngram3={len(ngram3_counter):,}",
|
| 113 |
+
flush=True)
|
| 114 |
+
if len(line_counter) > 5_000_000:
|
| 115 |
+
# keep top half
|
| 116 |
+
cutoff = line_counter.most_common(2_000_000)
|
| 117 |
+
line_counter = Counter(dict(cutoff))
|
| 118 |
+
line_sample_coverage = Counter({k: line_sample_coverage[k] for k, _ in cutoff})
|
| 119 |
+
if len(ngram3_counter) > 3_000_000:
|
| 120 |
+
ngram3_counter = Counter(dict(ngram3_counter.most_common(1_000_000)))
|
| 121 |
+
if len(ngram5_counter) > 3_000_000:
|
| 122 |
+
ngram5_counter = Counter(dict(ngram5_counter.most_common(1_000_000)))
|
| 123 |
+
except Exception as e:
|
| 124 |
+
print(f" ERR {fp}: {e}", file=sys.stderr, flush=True)
|
| 125 |
+
|
| 126 |
+
print(f"DONE: {total_samples:,} samples, {total_bytes/1e9:.2f} GB", flush=True)
|
| 127 |
+
|
| 128 |
+
# ----- build report -----
|
| 129 |
+
top_basenames = basename_counter.most_common(TOP_BASENAMES_KEEP)
|
| 130 |
+
top_lines = line_counter.most_common(TOP_LINES_KEEP)
|
| 131 |
+
top_ngram3 = ngram3_counter.most_common(NGRAM_TOP_KEEP)
|
| 132 |
+
top_ngram5 = ngram5_counter.most_common(NGRAM_TOP_KEEP)
|
| 133 |
+
|
| 134 |
+
report = {
|
| 135 |
+
"total_samples": total_samples,
|
| 136 |
+
"total_bytes": total_bytes,
|
| 137 |
+
"py_samples": py_samples,
|
| 138 |
+
"n_files_scanned": len(files),
|
| 139 |
+
"top_basenames": [
|
| 140 |
+
{
|
| 141 |
+
"basename": b,
|
| 142 |
+
"count": c,
|
| 143 |
+
"pct_of_corpus": round(c / total_samples * 100, 3),
|
| 144 |
+
"total_bytes": basename_bytes[b],
|
| 145 |
+
"dup_lines_within_files": basename_dup_lines[b],
|
| 146 |
+
}
|
| 147 |
+
for b, c in top_basenames
|
| 148 |
+
],
|
| 149 |
+
"top_lines_corpus_wide": [
|
| 150 |
+
{
|
| 151 |
+
"line": ln,
|
| 152 |
+
"occurrences": c,
|
| 153 |
+
"n_samples_containing": line_sample_coverage[ln],
|
| 154 |
+
"pct_samples": round(line_sample_coverage[ln] / total_samples * 100, 3),
|
| 155 |
+
}
|
| 156 |
+
for ln, c in top_lines[:500]
|
| 157 |
+
],
|
| 158 |
+
"top_3grams": [{"tokens": list(t), "count": c} for t, c in top_ngram3],
|
| 159 |
+
"top_5grams": [{"tokens": list(t), "count": c} for t, c in top_ngram5],
|
| 160 |
+
"ngram_sampling_note": f"n-gram counted on every {NGRAM_SAMPLE_EVERY}th file, first 400 lines per sample",
|
| 161 |
+
}
|
| 162 |
+
OUT_JSON.write_text(json.dumps(report, ensure_ascii=False, indent=2))
|
| 163 |
+
print(f"wrote {OUT_JSON} ({OUT_JSON.stat().st_size/1e6:.1f} MB)", flush=True)
|
| 164 |
+
|
| 165 |
+
# ----- markdown summary -----
|
| 166 |
+
md = []
|
| 167 |
+
md.append(f"# Filtered pretrain repetition report\n")
|
| 168 |
+
md.append(f"- samples: **{total_samples:,}**, bytes: **{total_bytes/1e9:.2f} GB**, .py: {py_samples:,}\n")
|
| 169 |
+
md.append(f"- files scanned: {len(files)}\n\n")
|
| 170 |
+
|
| 171 |
+
md.append("## Top template basenames (by sample count)\n\n")
|
| 172 |
+
md.append("| basename | count | % corpus | total bytes | dup lines (within-file) |\n|---|---:|---:|---:|---:|\n")
|
| 173 |
+
for b, c in top_basenames[:60]:
|
| 174 |
+
md.append(f"| `{b}` | {c} | {c/total_samples*100:.2f}% | {basename_bytes[b]/1e6:.1f} MB | {basename_dup_lines[b]} |\n")
|
| 175 |
+
|
| 176 |
+
md.append("\n## Top corpus-wide lines (frequency)\n\n")
|
| 177 |
+
md.append("| line | occurrences | samples containing | % samples |\n|---|---:|---:|---:|\n")
|
| 178 |
+
for ln, c in top_lines[:80]:
|
| 179 |
+
disp = ln.replace("|", "\\|")[:120]
|
| 180 |
+
md.append(f"| `{disp}` | {c} | {line_sample_coverage[ln]} | {line_sample_coverage[ln]/total_samples*100:.2f}% |\n")
|
| 181 |
+
|
| 182 |
+
md.append("\n## Top 5-grams (token-level)\n\n")
|
| 183 |
+
md.append("| 5-gram | count |\n|---|---:|\n")
|
| 184 |
+
for t, c in top_ngram5[:60]:
|
| 185 |
+
disp = " ".join(t).replace("|", "\\|")[:120]
|
| 186 |
+
md.append(f"| `{disp}` | {c} |\n")
|
| 187 |
+
|
| 188 |
+
md.append("\n## Top 3-grams (token-level)\n\n")
|
| 189 |
+
md.append("| 3-gram | count |\n|---|---:|\n")
|
| 190 |
+
for t, c in top_ngram3[:60]:
|
| 191 |
+
disp = " ".join(t).replace("|", "\\|")[:120]
|
| 192 |
+
md.append(f"| `{disp}` | {c} |\n")
|
| 193 |
+
|
| 194 |
+
OUT_MD.write_text("".join(md))
|
| 195 |
+
print(f"wrote {OUT_MD}", flush=True)
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
if __name__ == "__main__":
|
| 199 |
+
main()
|
code/pretrain_data_prep/build_filtered_pretrain.py
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Merge filtered/*.jsonl into swift pre-train format and shuffle.
|
| 2 |
+
|
| 3 |
+
Output: code_messages_pre_train_filtered.jsonl
|
| 4 |
+
Format per line: {"messages": [{"role": "assistant", "content": <text>}]}
|
| 5 |
+
"""
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
|
| 8 |
+
import json
|
| 9 |
+
import random
|
| 10 |
+
from collections import Counter
|
| 11 |
+
from pathlib import Path
|
| 12 |
+
|
| 13 |
+
SRC_DIR = Path("/raid/data/weifeng/Datasets/filtered")
|
| 14 |
+
DST = Path("/raid/data/weifeng/Datasets/code_messages_pre_train_filtered.jsonl")
|
| 15 |
+
REPORT = Path("/raid/data/weifeng/Datasets/code_messages_pre_train_filtered_report.json")
|
| 16 |
+
SEED = 0
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def main() -> None:
|
| 20 |
+
rng = random.Random(SEED)
|
| 21 |
+
files = sorted(SRC_DIR.glob("filtered_*.jsonl"))
|
| 22 |
+
print(f"found {len(files)} domain files")
|
| 23 |
+
|
| 24 |
+
out_lines: list[str] = []
|
| 25 |
+
by_domain: Counter[str] = Counter()
|
| 26 |
+
n_total = n_kept = n_empty = n_bad = 0
|
| 27 |
+
bad_by_file: Counter[str] = Counter()
|
| 28 |
+
|
| 29 |
+
for fp in files:
|
| 30 |
+
domain_kept = 0
|
| 31 |
+
with open(fp, encoding="utf-8", errors="replace") as f:
|
| 32 |
+
for line_no, line in enumerate(f, 1):
|
| 33 |
+
n_total += 1
|
| 34 |
+
try:
|
| 35 |
+
obj = json.loads(line)
|
| 36 |
+
except Exception:
|
| 37 |
+
n_bad += 1
|
| 38 |
+
bad_by_file[fp.name] += 1
|
| 39 |
+
continue
|
| 40 |
+
text = obj.get("text", "")
|
| 41 |
+
if not isinstance(text, str) or not text.strip():
|
| 42 |
+
n_empty += 1
|
| 43 |
+
continue
|
| 44 |
+
record = {"messages": [{"role": "assistant", "content": text}]}
|
| 45 |
+
out_lines.append(json.dumps(record, ensure_ascii=False))
|
| 46 |
+
domain_kept += 1
|
| 47 |
+
n_kept += 1
|
| 48 |
+
by_domain[fp.stem.replace("filtered_", "")] = domain_kept
|
| 49 |
+
print(f" {fp.name}: kept {domain_kept} (bad rows: {bad_by_file[fp.name]})")
|
| 50 |
+
|
| 51 |
+
print(f"\nshuffling {len(out_lines)} records (seed={SEED})...")
|
| 52 |
+
rng.shuffle(out_lines)
|
| 53 |
+
|
| 54 |
+
print(f"writing → {DST}")
|
| 55 |
+
with open(DST, "w", encoding="utf-8") as fout:
|
| 56 |
+
for line in out_lines:
|
| 57 |
+
fout.write(line + "\n")
|
| 58 |
+
|
| 59 |
+
report = {
|
| 60 |
+
"src_dir": str(SRC_DIR),
|
| 61 |
+
"dst": str(DST),
|
| 62 |
+
"seed": SEED,
|
| 63 |
+
"n_total_input": n_total,
|
| 64 |
+
"n_empty_dropped": n_empty,
|
| 65 |
+
"n_bad_rows_dropped": n_bad,
|
| 66 |
+
"bad_rows_by_file": dict(bad_by_file),
|
| 67 |
+
"n_kept": n_kept,
|
| 68 |
+
"per_domain_kept": dict(by_domain.most_common()),
|
| 69 |
+
"total_bytes": DST.stat().st_size,
|
| 70 |
+
}
|
| 71 |
+
REPORT.write_text(json.dumps(report, indent=2, ensure_ascii=False))
|
| 72 |
+
print(json.dumps(report, indent=2, ensure_ascii=False))
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
if __name__ == "__main__":
|
| 76 |
+
main()
|
code/pretrain_data_prep/dryrun_filter_repetition.py
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Dry-run apply the 5 filter rules over filtered/filtered_*.jsonl. Count only,
|
| 2 |
+
don't write output.
|
| 3 |
+
|
| 4 |
+
Rules:
|
| 5 |
+
1) drop by basename (CHANGELOG/NEWS/CONTRIBUTING/version.py/etc)
|
| 6 |
+
2) cap per basename N=200 (random sample via reservoir)
|
| 7 |
+
3) collapse long runs of same char inside a line (modifies text, doesn't drop)
|
| 8 |
+
4) drop sample if any 5-token n-gram repeats >=30 times
|
| 9 |
+
5) drop sample if any short line repeats >=20 times
|
| 10 |
+
|
| 11 |
+
Reports: how many samples remain, how much each rule dropped.
|
| 12 |
+
"""
|
| 13 |
+
from __future__ import annotations
|
| 14 |
+
|
| 15 |
+
import json
|
| 16 |
+
import os
|
| 17 |
+
import random
|
| 18 |
+
import re
|
| 19 |
+
from collections import Counter, defaultdict
|
| 20 |
+
from glob import glob
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
|
| 23 |
+
SRC_DIR = Path("/raid/data/weifeng/Datasets/filtered")
|
| 24 |
+
REPORT = Path("/raid/data/weifeng/Datasets/dryrun_filter_report.json")
|
| 25 |
+
|
| 26 |
+
DROP_BASENAMES = {
|
| 27 |
+
"CHANGELOG.md", "NEWS.md", "CONTRIBUTING.md", "SKILL.md",
|
| 28 |
+
"package-info.java", "index.md", "version.py", "_version.py",
|
| 29 |
+
}
|
| 30 |
+
CAPPED_BASENAMES = {
|
| 31 |
+
"__init__.py", "utils.py", "setup.py", "conftest.py", "conf.py",
|
| 32 |
+
"config.py", "settings.py", "constants.py", "__main__.py",
|
| 33 |
+
}
|
| 34 |
+
CAP = 200
|
| 35 |
+
|
| 36 |
+
RUN_SAME_CHAR = re.compile(r"^(.)\1{40,}$")
|
| 37 |
+
RUN_PUNCT = re.compile(r"^([^\w\s])\1{10,}$")
|
| 38 |
+
TOKEN_RE = re.compile(r"[A-Za-z_][A-Za-z0-9_]*|[^\s\w]")
|
| 39 |
+
|
| 40 |
+
NGRAM_N = 5
|
| 41 |
+
NGRAM_THRESH = 30
|
| 42 |
+
LINE_REP_THRESH = 20
|
| 43 |
+
LINE_MAX_LEN = 80
|
| 44 |
+
SEED = 0
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def main() -> None:
|
| 48 |
+
rng = random.Random(SEED)
|
| 49 |
+
files = sorted(glob(str(SRC_DIR / "filtered_*.jsonl")))
|
| 50 |
+
|
| 51 |
+
total = 0
|
| 52 |
+
dropped_rule1 = 0
|
| 53 |
+
dropped_rule2 = 0
|
| 54 |
+
dropped_rule4 = 0
|
| 55 |
+
dropped_rule5 = 0
|
| 56 |
+
modified_rule3 = 0
|
| 57 |
+
kept = 0
|
| 58 |
+
bytes_kept = 0
|
| 59 |
+
bytes_total = 0
|
| 60 |
+
|
| 61 |
+
# rule2 reservoir: for capped basenames, decide kept indices by reservoir sampling
|
| 62 |
+
# easier: stream twice OR random.random() < CAP/seen_count threshold. We do
|
| 63 |
+
# the simpler "see first then decide". Pass 1 counts. Pass 2 applies. To save
|
| 64 |
+
# time on dry-run we accept slight bias: simple random.random()<keep_prob with
|
| 65 |
+
# estimated counts from prior repetition report.
|
| 66 |
+
from json import load as jload
|
| 67 |
+
prior = jload(open("/raid/data/weifeng/Datasets/filtered_repetition_report.json"))
|
| 68 |
+
basename_total = {x["basename"]: x["count"] for x in prior["top_basenames"]}
|
| 69 |
+
keep_prob = {b: min(1.0, CAP / basename_total[b]) for b in CAPPED_BASENAMES if b in basename_total}
|
| 70 |
+
print("keep_prob (cap 200):", keep_prob, flush=True)
|
| 71 |
+
|
| 72 |
+
drop_by_basename: Counter[str] = Counter()
|
| 73 |
+
|
| 74 |
+
for fi, fp in enumerate(files):
|
| 75 |
+
with open(fp, encoding="utf-8") as f:
|
| 76 |
+
for line in f:
|
| 77 |
+
try:
|
| 78 |
+
o = json.loads(line)
|
| 79 |
+
except Exception:
|
| 80 |
+
continue
|
| 81 |
+
total += 1
|
| 82 |
+
path = o.get("path", "") or ""
|
| 83 |
+
text = o.get("text", "") or ""
|
| 84 |
+
if not text:
|
| 85 |
+
continue
|
| 86 |
+
bytes_total += len(text)
|
| 87 |
+
bname = os.path.basename(path)
|
| 88 |
+
|
| 89 |
+
# rule 1
|
| 90 |
+
if bname in DROP_BASENAMES:
|
| 91 |
+
dropped_rule1 += 1
|
| 92 |
+
drop_by_basename[bname] += 1
|
| 93 |
+
continue
|
| 94 |
+
# rule 2
|
| 95 |
+
if bname in keep_prob and rng.random() > keep_prob[bname]:
|
| 96 |
+
dropped_rule2 += 1
|
| 97 |
+
drop_by_basename[bname] += 1
|
| 98 |
+
continue
|
| 99 |
+
|
| 100 |
+
# rule 3: in-place collapse
|
| 101 |
+
lines_in = text.split("\n")
|
| 102 |
+
modified = False
|
| 103 |
+
new_lines = []
|
| 104 |
+
for ln in lines_in:
|
| 105 |
+
if RUN_SAME_CHAR.match(ln) or RUN_PUNCT.match(ln):
|
| 106 |
+
new_lines.append(ln[:5])
|
| 107 |
+
modified = True
|
| 108 |
+
else:
|
| 109 |
+
new_lines.append(ln)
|
| 110 |
+
if modified:
|
| 111 |
+
modified_rule3 += 1
|
| 112 |
+
text = "\n".join(new_lines)
|
| 113 |
+
|
| 114 |
+
# rule 5: short line repeat
|
| 115 |
+
stripped = [ln.strip() for ln in new_lines]
|
| 116 |
+
cnt = Counter(ln for ln in stripped if 0 < len(ln) <= LINE_MAX_LEN)
|
| 117 |
+
if cnt and cnt.most_common(1)[0][1] >= LINE_REP_THRESH:
|
| 118 |
+
dropped_rule5 += 1
|
| 119 |
+
continue
|
| 120 |
+
|
| 121 |
+
# rule 4: 5-gram repeat (skip for very small samples)
|
| 122 |
+
tokens = TOKEN_RE.findall(text)
|
| 123 |
+
if len(tokens) >= 100:
|
| 124 |
+
# only check head + tail slices to bound cost
|
| 125 |
+
sample_toks = tokens[:5000] if len(tokens) > 5000 else tokens
|
| 126 |
+
ngrams = Counter()
|
| 127 |
+
for i in range(len(sample_toks) - NGRAM_N + 1):
|
| 128 |
+
ngrams[tuple(sample_toks[i:i + NGRAM_N])] += 1
|
| 129 |
+
if ngrams and ngrams.most_common(1)[0][1] >= NGRAM_THRESH:
|
| 130 |
+
dropped_rule4 += 1
|
| 131 |
+
continue
|
| 132 |
+
|
| 133 |
+
kept += 1
|
| 134 |
+
bytes_kept += len(text)
|
| 135 |
+
|
| 136 |
+
if total % 100000 == 0:
|
| 137 |
+
print(f" [{total}] kept={kept} r1={dropped_rule1} r2={dropped_rule2} "
|
| 138 |
+
f"r4={dropped_rule4} r5={dropped_rule5} r3mod={modified_rule3}", flush=True)
|
| 139 |
+
|
| 140 |
+
report = {
|
| 141 |
+
"total": total,
|
| 142 |
+
"kept": kept,
|
| 143 |
+
"kept_pct": round(kept / total * 100, 2),
|
| 144 |
+
"dropped_rule1_basename_drop": dropped_rule1,
|
| 145 |
+
"dropped_rule2_basename_cap": dropped_rule2,
|
| 146 |
+
"dropped_rule4_ngram_repeat": dropped_rule4,
|
| 147 |
+
"dropped_rule5_line_repeat": dropped_rule5,
|
| 148 |
+
"rule3_in_place_collapsed_samples": modified_rule3,
|
| 149 |
+
"bytes_total": bytes_total,
|
| 150 |
+
"bytes_kept": bytes_kept,
|
| 151 |
+
"bytes_kept_pct": round(bytes_kept / bytes_total * 100, 2),
|
| 152 |
+
"top_dropped_basenames": drop_by_basename.most_common(40),
|
| 153 |
+
"thresholds": {
|
| 154 |
+
"CAP": CAP,
|
| 155 |
+
"NGRAM_N": NGRAM_N,
|
| 156 |
+
"NGRAM_THRESH": NGRAM_THRESH,
|
| 157 |
+
"LINE_REP_THRESH": LINE_REP_THRESH,
|
| 158 |
+
"LINE_MAX_LEN": LINE_MAX_LEN,
|
| 159 |
+
},
|
| 160 |
+
}
|
| 161 |
+
REPORT.write_text(json.dumps(report, ensure_ascii=False, indent=2))
|
| 162 |
+
print(json.dumps(report, ensure_ascii=False, indent=2))
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
if __name__ == "__main__":
|
| 166 |
+
main()
|
code/pretrain_data_prep/reports/code_messages_pre_train_filtered_report.json
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"src_dir": "/raid/data/weifeng/Datasets/filtered",
|
| 3 |
+
"dst": "/raid/data/weifeng/Datasets/code_messages_pre_train_filtered.jsonl",
|
| 4 |
+
"seed": 0,
|
| 5 |
+
"n_total_input": 1656628,
|
| 6 |
+
"n_empty_dropped": 0,
|
| 7 |
+
"n_bad_rows_dropped": 0,
|
| 8 |
+
"bad_rows_by_file": {},
|
| 9 |
+
"n_kept": 1656628,
|
| 10 |
+
"per_domain_kept": {
|
| 11 |
+
"Human": 241767,
|
| 12 |
+
"System_biology": 113218,
|
| 13 |
+
"Potential": 112912,
|
| 14 |
+
"Folding": 80374,
|
| 15 |
+
"3D": 69104,
|
| 16 |
+
"Activation": 68866,
|
| 17 |
+
"Networks": 67309,
|
| 18 |
+
"Single_cell": 54945,
|
| 19 |
+
"Generate": 47990,
|
| 20 |
+
"Imaging": 46115,
|
| 21 |
+
"Ligand": 41856,
|
| 22 |
+
"Protein": 39974,
|
| 23 |
+
"Bioinformatics": 36252,
|
| 24 |
+
"Gene_editing": 29170,
|
| 25 |
+
"Biomedical": 24735,
|
| 26 |
+
"Next_generation_sequencing": 24553,
|
| 27 |
+
"Quantum_mechanics": 24443,
|
| 28 |
+
"Score": 23368,
|
| 29 |
+
"Sequencing": 21806,
|
| 30 |
+
"Biologics": 20203,
|
| 31 |
+
"Modeling": 18449,
|
| 32 |
+
"Computational_Materials": 17899,
|
| 33 |
+
"Computational_Chemistry": 15152,
|
| 34 |
+
"Heterogeneity": 15150,
|
| 35 |
+
"Cycle": 14545,
|
| 36 |
+
"Integration": 14539,
|
| 37 |
+
"Mechanism": 14384,
|
| 38 |
+
"GAN": 13513,
|
| 39 |
+
"Molecular_biology": 13031,
|
| 40 |
+
"Kinetics": 12501,
|
| 41 |
+
"Ion": 12365,
|
| 42 |
+
"Diagnostics": 12150,
|
| 43 |
+
"Stochastic_modeling": 11911,
|
| 44 |
+
"Pharmacometrics": 11079,
|
| 45 |
+
"Design": 10790,
|
| 46 |
+
"Genotype": 10392,
|
| 47 |
+
"Screening": 10379,
|
| 48 |
+
"Genomics": 9262,
|
| 49 |
+
"DFT": 8520,
|
| 50 |
+
"Antibody": 7986,
|
| 51 |
+
"RNA": 7886,
|
| 52 |
+
"Proteomics": 7827,
|
| 53 |
+
"Coupled_cluster": 7771,
|
| 54 |
+
"Gene": 6981,
|
| 55 |
+
"High_throughput": 6934,
|
| 56 |
+
"Transformer": 6788,
|
| 57 |
+
"Dynamics": 6577,
|
| 58 |
+
"Protein_Protein_Interactions": 5893,
|
| 59 |
+
"Profiling": 5645,
|
| 60 |
+
"Cheminformatics": 5497,
|
| 61 |
+
"Chemistry": 5483,
|
| 62 |
+
"Diffusion": 5159,
|
| 63 |
+
"Crystal": 5120,
|
| 64 |
+
"Biology": 4777,
|
| 65 |
+
"Material": 4718,
|
| 66 |
+
"Evolution": 4649,
|
| 67 |
+
"Physiology": 4624,
|
| 68 |
+
"Hartree_Fock": 4540,
|
| 69 |
+
"Autoregressive": 4413,
|
| 70 |
+
"Electronic_structure": 3949,
|
| 71 |
+
"Flow_matching": 3815,
|
| 72 |
+
"Ab_initio": 3757,
|
| 73 |
+
"Lipid": 3718,
|
| 74 |
+
"Finite_element_method": 3697,
|
| 75 |
+
"Biotechnology": 3410,
|
| 76 |
+
"Phenotype": 3278,
|
| 77 |
+
"Monte_Carlo": 3244,
|
| 78 |
+
"Compartmental_model": 2834,
|
| 79 |
+
"Agent_based_model": 2744,
|
| 80 |
+
"Chemical_space": 2297,
|
| 81 |
+
"Microbial": 2198,
|
| 82 |
+
"Bio": 2191,
|
| 83 |
+
"Translation": 2157,
|
| 84 |
+
"Pathology": 2135,
|
| 85 |
+
"Metabolomics": 2090,
|
| 86 |
+
"Spectrometry": 2053,
|
| 87 |
+
"Spatial_Transcriptomics": 1951,
|
| 88 |
+
"Drug_repurpose": 1931,
|
| 89 |
+
"Pathway": 1798,
|
| 90 |
+
"De_novo": 1768,
|
| 91 |
+
"Reinforcement_learning": 1731,
|
| 92 |
+
"Drug": 1702,
|
| 93 |
+
"Immunology": 1676,
|
| 94 |
+
"Absorption": 1659,
|
| 95 |
+
"2D": 1573,
|
| 96 |
+
"Redox": 1537,
|
| 97 |
+
"Anomaly_detection": 1452,
|
| 98 |
+
"Pharmacology": 1374,
|
| 99 |
+
"Spatial_biology": 1357,
|
| 100 |
+
"Reproduction_number": 1336,
|
| 101 |
+
"First_principles_based_DFT": 1300,
|
| 102 |
+
"Antigen": 1293,
|
| 103 |
+
"DNA": 1277,
|
| 104 |
+
"AMR": 1124,
|
| 105 |
+
"Signaling": 1078,
|
| 106 |
+
"QM_MM": 974,
|
| 107 |
+
"Hydrophobic": 937,
|
| 108 |
+
"Prediction": 903,
|
| 109 |
+
"Free_energy_perturbation": 819,
|
| 110 |
+
"Pharmacokinetics": 777,
|
| 111 |
+
"Reaction": 751,
|
| 112 |
+
"Pharmaceutics": 742,
|
| 113 |
+
"Quantum_biology": 728,
|
| 114 |
+
"Multi_omics": 721,
|
| 115 |
+
"Lead_optimization": 719,
|
| 116 |
+
"Enzyme": 693,
|
| 117 |
+
"Metagenomics": 660,
|
| 118 |
+
"Generative": 653,
|
| 119 |
+
"Medicine": 617,
|
| 120 |
+
"Porous": 611,
|
| 121 |
+
"Rosettafold": 573,
|
| 122 |
+
"Phase_field_technique": 517,
|
| 123 |
+
"Transcriptomics": 459,
|
| 124 |
+
"Docking": 449,
|
| 125 |
+
"Biomarker": 439,
|
| 126 |
+
"Allele": 431,
|
| 127 |
+
"Discovery": 429,
|
| 128 |
+
"Microbiology": 411,
|
| 129 |
+
"Marker": 402,
|
| 130 |
+
"Lead_discovery": 390,
|
| 131 |
+
"Pharmacogenetics": 387,
|
| 132 |
+
"Pandemic": 386,
|
| 133 |
+
"Variational_autoencoders": 377,
|
| 134 |
+
"Transcription": 346,
|
| 135 |
+
"Nucleic_acids": 345,
|
| 136 |
+
"Pathogens": 314,
|
| 137 |
+
"Neurology": 313,
|
| 138 |
+
"Multi_scale_modeling": 310,
|
| 139 |
+
"Sensors": 301,
|
| 140 |
+
"CRISPR": 280,
|
| 141 |
+
"Glycomics": 270,
|
| 142 |
+
"Disease": 220,
|
| 143 |
+
"Quantum_Chemistry": 219,
|
| 144 |
+
"Substrate": 217,
|
| 145 |
+
"Assay": 201,
|
| 146 |
+
"Viral": 201,
|
| 147 |
+
"Biophysics": 200,
|
| 148 |
+
"VAE": 199,
|
| 149 |
+
"Omics": 198,
|
| 150 |
+
"Conformation": 194,
|
| 151 |
+
"Bio_foundation_model": 176,
|
| 152 |
+
"Ensemble": 170,
|
| 153 |
+
"Cell_biology": 169,
|
| 154 |
+
"Metabolic": 157,
|
| 155 |
+
"In_Silico": 150,
|
| 156 |
+
"Metamaterial": 144,
|
| 157 |
+
"Computational_Biochemistry": 137,
|
| 158 |
+
"Personalized": 137,
|
| 159 |
+
"Bioengineering": 132,
|
| 160 |
+
"AlphaFold": 99,
|
| 161 |
+
"Explainable_AI": 99,
|
| 162 |
+
"Genesis": 99,
|
| 163 |
+
"Nowcasting": 97,
|
| 164 |
+
"QSAR": 96,
|
| 165 |
+
"Pharmacogenomics": 93,
|
| 166 |
+
"Antagonist": 88,
|
| 167 |
+
"Codon": 76,
|
| 168 |
+
"ADMET": 75,
|
| 169 |
+
"Epigenetics": 71,
|
| 170 |
+
"Conjugate": 66,
|
| 171 |
+
"Toxicology": 43,
|
| 172 |
+
"RNN": 34,
|
| 173 |
+
"Vaccine": 33,
|
| 174 |
+
"PBPK_model": 31,
|
| 175 |
+
"Hydrophilic": 26,
|
| 176 |
+
"Protein_protein": 23,
|
| 177 |
+
"Hit_to_lead": 21,
|
| 178 |
+
"Homo_Lumo": 19,
|
| 179 |
+
"Homeostasis": 17,
|
| 180 |
+
"Receptor": 13,
|
| 181 |
+
"Biosensors": 9,
|
| 182 |
+
"Inhibition": 8,
|
| 183 |
+
"Organoid": 7,
|
| 184 |
+
"Lipidomics": 4,
|
| 185 |
+
"Biochemistry": 2,
|
| 186 |
+
"Digital_twin": 1,
|
| 187 |
+
"Cell_atlas": 0,
|
| 188 |
+
"Pseudotime_analysis": 0
|
| 189 |
+
},
|
| 190 |
+
"total_bytes": 9992235548
|
| 191 |
+
}
|
code/pretrain_data_prep/reports/code_messages_pre_train_filtered_stages_report.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"src": "/raid/data/weifeng/Datasets/code_messages_pre_train_filtered.jsonl",
|
| 3 |
+
"n_total": 1656628,
|
| 4 |
+
"stage1_path": "/raid/data/weifeng/Datasets/code_messages_pre_train_filtered_stage1.jsonl",
|
| 5 |
+
"stage1_count": 902115,
|
| 6 |
+
"stage1_pct": 0.5445489270976949,
|
| 7 |
+
"stage2_path": "/raid/data/weifeng/Datasets/code_messages_pre_train_filtered_stage2.jsonl",
|
| 8 |
+
"stage2_count": 605249,
|
| 9 |
+
"stage2_pct": 0.3653499759752944,
|
| 10 |
+
"stage3_path": "/raid/data/weifeng/Datasets/code_messages_pre_train_filtered_stage3.jsonl",
|
| 11 |
+
"stage3_count": 149264,
|
| 12 |
+
"stage3_pct": 0.09010109692701077,
|
| 13 |
+
"thresholds": [
|
| 14 |
+
1024,
|
| 15 |
+
4096
|
| 16 |
+
],
|
| 17 |
+
"tokenizer": "Qwen/Qwen2.5-Coder-0.5B",
|
| 18 |
+
"elapsed_min": 10.5
|
| 19 |
+
}
|
code/pretrain_data_prep/reports/dryrun_filter_report.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"total": 1656628,
|
| 3 |
+
"kept": 1046224,
|
| 4 |
+
"kept_pct": 63.15,
|
| 5 |
+
"dropped_rule1_basename_drop": 8994,
|
| 6 |
+
"dropped_rule2_basename_cap": 66713,
|
| 7 |
+
"dropped_rule4_ngram_repeat": 275296,
|
| 8 |
+
"dropped_rule5_line_repeat": 259401,
|
| 9 |
+
"rule3_in_place_collapsed_samples": 78338,
|
| 10 |
+
"bytes_total": 9490697379,
|
| 11 |
+
"bytes_kept": 3693108225,
|
| 12 |
+
"bytes_kept_pct": 38.91,
|
| 13 |
+
"top_dropped_basenames": [
|
| 14 |
+
[
|
| 15 |
+
"__init__.py",
|
| 16 |
+
41168
|
| 17 |
+
],
|
| 18 |
+
[
|
| 19 |
+
"utils.py",
|
| 20 |
+
10610
|
| 21 |
+
],
|
| 22 |
+
[
|
| 23 |
+
"setup.py",
|
| 24 |
+
6890
|
| 25 |
+
],
|
| 26 |
+
[
|
| 27 |
+
"index.md",
|
| 28 |
+
2856
|
| 29 |
+
],
|
| 30 |
+
[
|
| 31 |
+
"config.py",
|
| 32 |
+
2122
|
| 33 |
+
],
|
| 34 |
+
[
|
| 35 |
+
"conftest.py",
|
| 36 |
+
1905
|
| 37 |
+
],
|
| 38 |
+
[
|
| 39 |
+
"CHANGELOG.md",
|
| 40 |
+
1790
|
| 41 |
+
],
|
| 42 |
+
[
|
| 43 |
+
"conf.py",
|
| 44 |
+
1781
|
| 45 |
+
],
|
| 46 |
+
[
|
| 47 |
+
"CONTRIBUTING.md",
|
| 48 |
+
1552
|
| 49 |
+
],
|
| 50 |
+
[
|
| 51 |
+
"__main__.py",
|
| 52 |
+
1076
|
| 53 |
+
],
|
| 54 |
+
[
|
| 55 |
+
"constants.py",
|
| 56 |
+
884
|
| 57 |
+
],
|
| 58 |
+
[
|
| 59 |
+
"NEWS.md",
|
| 60 |
+
878
|
| 61 |
+
],
|
| 62 |
+
[
|
| 63 |
+
"package-info.java",
|
| 64 |
+
609
|
| 65 |
+
],
|
| 66 |
+
[
|
| 67 |
+
"version.py",
|
| 68 |
+
561
|
| 69 |
+
],
|
| 70 |
+
[
|
| 71 |
+
"SKILL.md",
|
| 72 |
+
497
|
| 73 |
+
],
|
| 74 |
+
[
|
| 75 |
+
"settings.py",
|
| 76 |
+
277
|
| 77 |
+
],
|
| 78 |
+
[
|
| 79 |
+
"_version.py",
|
| 80 |
+
251
|
| 81 |
+
]
|
| 82 |
+
],
|
| 83 |
+
"thresholds": {
|
| 84 |
+
"CAP": 200,
|
| 85 |
+
"NGRAM_N": 5,
|
| 86 |
+
"NGRAM_THRESH": 30,
|
| 87 |
+
"LINE_REP_THRESH": 20,
|
| 88 |
+
"LINE_MAX_LEN": 80
|
| 89 |
+
}
|
| 90 |
+
}
|
code/pretrain_data_prep/split_filtered_by_token_length.py
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Split code_messages_pre_train_filtered.jsonl into 3 token-length stages.
|
| 2 |
+
|
| 3 |
+
Stage 1: <=1024 tokens
|
| 4 |
+
Stage 2: 1025-4096
|
| 5 |
+
Stage 3: >4096
|
| 6 |
+
|
| 7 |
+
Tokenizer: Qwen2.5-Coder-0.5B.
|
| 8 |
+
Uses multiprocessing for speed.
|
| 9 |
+
"""
|
| 10 |
+
from __future__ import annotations
|
| 11 |
+
|
| 12 |
+
import json
|
| 13 |
+
import multiprocessing as mp
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
|
| 16 |
+
SRC = Path("/raid/data/weifeng/Datasets/code_messages_pre_train_filtered.jsonl")
|
| 17 |
+
DST_DIR = Path("/raid/data/weifeng/Datasets")
|
| 18 |
+
DST_S1 = DST_DIR / "code_messages_pre_train_filtered_stage1.jsonl" # <=1024
|
| 19 |
+
DST_S2 = DST_DIR / "code_messages_pre_train_filtered_stage2.jsonl" # 1025-4096
|
| 20 |
+
DST_S3 = DST_DIR / "code_messages_pre_train_filtered_stage3.jsonl" # >4096
|
| 21 |
+
REPORT = DST_DIR / "code_messages_pre_train_filtered_stages_report.json"
|
| 22 |
+
|
| 23 |
+
T1 = 1024
|
| 24 |
+
T2 = 4096
|
| 25 |
+
N_WORKERS = 8
|
| 26 |
+
CHUNK = 1000
|
| 27 |
+
|
| 28 |
+
# Worker setup
|
| 29 |
+
_tokenizer = None
|
| 30 |
+
def init_worker():
|
| 31 |
+
global _tokenizer
|
| 32 |
+
from transformers import AutoTokenizer
|
| 33 |
+
_tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-Coder-0.5B", trust_remote_code=True)
|
| 34 |
+
|
| 35 |
+
def count_tokens(line: str) -> tuple[int, str]:
|
| 36 |
+
"""Return (n_tokens, original_line) so we can keep the line."""
|
| 37 |
+
o = json.loads(line)
|
| 38 |
+
text = o["messages"][0]["content"]
|
| 39 |
+
n = len(_tokenizer.encode(text, add_special_tokens=False))
|
| 40 |
+
return n, line
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def main() -> None:
|
| 44 |
+
# Read all lines first (cheap, ~10GB)
|
| 45 |
+
print(f"loading {SRC} ...")
|
| 46 |
+
with open(SRC, "r", encoding="utf-8") as f:
|
| 47 |
+
lines = f.readlines()
|
| 48 |
+
print(f"loaded {len(lines):,} lines")
|
| 49 |
+
|
| 50 |
+
out_s1 = open(DST_S1, "w", encoding="utf-8")
|
| 51 |
+
out_s2 = open(DST_S2, "w", encoding="utf-8")
|
| 52 |
+
out_s3 = open(DST_S3, "w", encoding="utf-8")
|
| 53 |
+
|
| 54 |
+
n_s1 = n_s2 = n_s3 = 0
|
| 55 |
+
import time
|
| 56 |
+
t0 = time.time()
|
| 57 |
+
with mp.Pool(N_WORKERS, initializer=init_worker) as pool:
|
| 58 |
+
for i, (n_tok, line) in enumerate(pool.imap_unordered(count_tokens, lines, chunksize=CHUNK)):
|
| 59 |
+
if n_tok <= T1:
|
| 60 |
+
out_s1.write(line); n_s1 += 1
|
| 61 |
+
elif n_tok <= T2:
|
| 62 |
+
out_s2.write(line); n_s2 += 1
|
| 63 |
+
else:
|
| 64 |
+
out_s3.write(line); n_s3 += 1
|
| 65 |
+
if (i + 1) % 50000 == 0:
|
| 66 |
+
elapsed = time.time() - t0
|
| 67 |
+
rate = (i + 1) / max(elapsed, 1e-9)
|
| 68 |
+
eta = (len(lines) - i - 1) / max(rate, 1e-9)
|
| 69 |
+
print(f" [{i+1:>8,}/{len(lines):,}] s1={n_s1:,} s2={n_s2:,} s3={n_s3:,} rate={rate:.0f}/s eta={eta/60:.1f}min", flush=True)
|
| 70 |
+
|
| 71 |
+
out_s1.close(); out_s2.close(); out_s3.close()
|
| 72 |
+
report = {
|
| 73 |
+
"src": str(SRC), "n_total": len(lines),
|
| 74 |
+
"stage1_path": str(DST_S1), "stage1_count": n_s1, "stage1_pct": n_s1/len(lines),
|
| 75 |
+
"stage2_path": str(DST_S2), "stage2_count": n_s2, "stage2_pct": n_s2/len(lines),
|
| 76 |
+
"stage3_path": str(DST_S3), "stage3_count": n_s3, "stage3_pct": n_s3/len(lines),
|
| 77 |
+
"thresholds": [T1, T2],
|
| 78 |
+
"tokenizer": "Qwen/Qwen2.5-Coder-0.5B",
|
| 79 |
+
"elapsed_min": round((time.time() - t0)/60, 1),
|
| 80 |
+
}
|
| 81 |
+
REPORT.write_text(json.dumps(report, indent=2, ensure_ascii=False))
|
| 82 |
+
print(json.dumps(report, indent=2, ensure_ascii=False))
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
if __name__ == "__main__":
|
| 86 |
+
main()
|
data/f3/intermediate/F3_stage1.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:167d17cd03fbbdbca40e3ef289c81898120107ba13f975db2ce23e3d6516c1a3
|
| 3 |
+
size 2276490009
|
data/f3/intermediate/F3_stage2.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:97353d440b3b0d292ff443cf2e705140ff5fa25ebbc2a65163d240b1eff03432
|
| 3 |
+
size 1956575594
|
data/f3/intermediate/F3_stage3.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c54871e7896bb83e49bed1f0fc07cef2021a8c7ddb5053c1f2c7d5eed8ddcb56
|
| 3 |
+
size 1935884904
|
data/f3/intermediate/F3_stage4_calibration_scores.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/f3/intermediate/F3_stage4_scores.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
environment/KNOWN_LIMITATIONS.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Environment Record and Known Reproducibility Limitations
|
| 2 |
+
|
| 3 |
+
## Best Available Training-Environment Evidence
|
| 4 |
+
|
| 5 |
+
The only nearby training run for which a complete environment snapshot was captured was a
|
| 6 |
+
text-only continued-pre-training run on 13 April 2026. It used the following key versions:
|
| 7 |
+
|
| 8 |
+
| Component | Version |
|
| 9 |
+
|---|---|
|
| 10 |
+
| ms-swift | 4.0.2 |
|
| 11 |
+
| PyTorch | 2.5.1+cu121 |
|
| 12 |
+
| Transformers | 5.3.0 |
|
| 13 |
+
| Accelerate | 1.13.0 |
|
| 14 |
+
| Datasets | 3.6.0 |
|
| 15 |
+
| PEFT | 0.18.1 |
|
| 16 |
+
| DeepSpeed | 0.18.8 |
|
| 17 |
+
| FlashAttention | 2.8.3 (CUDA 12 / PyTorch 2.5 / CPython 3.11 wheel) |
|
| 18 |
+
| CUDA / driver | 12.2 / 535.183.06 |
|
| 19 |
+
|
| 20 |
+
This environment is contextual evidence only. It is not a run-specific snapshot for either
|
| 21 |
+
checkpoint in this package.
|
| 22 |
+
|
| 23 |
+
## Known Gap
|
| 24 |
+
|
| 25 |
+
The following delivered runs were launched directly and do not have their own `pip freeze`
|
| 26 |
+
or complete system snapshot:
|
| 27 |
+
|
| 28 |
+
- `models/pretrained/stage1_cpt` (14–15 May 2026)
|
| 29 |
+
- `models/sft/sft_f3_refined_instruct` (8 May 2026)
|
| 30 |
+
|
| 31 |
+
Each checkpoint includes `args.json`, which records the effective ms-swift training
|
| 32 |
+
configuration, and `trainer_state.json`, which records the observed steps and loss history.
|
| 33 |
+
The exact datasets and historical launch scripts are also included. These artefacts support
|
| 34 |
+
procedural reproduction, but not a claim of bit-for-bit numerical reproduction.
|
| 35 |
+
|
| 36 |
+
The April environment is the best known approximation because the training container was
|
| 37 |
+
not intentionally changed between the April and May runs. This is an inference rather than
|
| 38 |
+
a contemporaneous record and must not be presented as confirmed run-specific evidence.
|
| 39 |
+
|
| 40 |
+
## Delivery Validation Environment
|
| 41 |
+
|
| 42 |
+
Both delivered checkpoints were loaded and executed successfully using:
|
| 43 |
+
|
| 44 |
+
| Component | Version |
|
| 45 |
+
|---|---|
|
| 46 |
+
| Python | 3.12 |
|
| 47 |
+
| PyTorch | 2.10.0+cu128 |
|
| 48 |
+
| Transformers | 5.7.0 |
|
| 49 |
+
| Safetensors | 0.7.0 |
|
| 50 |
+
|
| 51 |
+
`tools/smoke_test.py` confirmed that both checkpoints produce finite, non-degenerate logits.
|
| 52 |
+
The weights can therefore be loaded with the newer delivery environment. Rerunning the
|
| 53 |
+
historical training scripts requires a compatible ms-swift environment; version 4.0.2 is
|
| 54 |
+
the best available reference.
|
evidence/eval/f3_refined_9p1_summary.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"dataset": "/raid/data/weifeng/Runable_Benchmark/dataset/alignment_humaneval_runnable_benchmark_reviewed_primary.jsonl",
|
| 3 |
+
"provider": "hf",
|
| 4 |
+
"model": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu/v0-20260508-164342/checkpoint-6435",
|
| 5 |
+
"num_tasks": 200,
|
| 6 |
+
"samples_per_task": 5,
|
| 7 |
+
"pass@1": 0.09100000000000001,
|
| 8 |
+
"pass@5": 0.13,
|
| 9 |
+
"reasons": {
|
| 10 |
+
"test_runtime_error": 721,
|
| 11 |
+
"ok": 91,
|
| 12 |
+
"solution_syntax_error": 105,
|
| 13 |
+
"timeout": 2,
|
| 14 |
+
"solution_exec_error": 62,
|
| 15 |
+
"entry_point_not_found": 19
|
| 16 |
+
},
|
| 17 |
+
"elapsed_sec": 2452.127,
|
| 18 |
+
"attempts_file": "/raid/data/weifeng/Runable_Benchmark/outputs/attempts_hf__raid_data_weifeng_Pre_train_output_user_qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu_v0-20260508-164342_checkpoint-6435_20260508_191037.jsonl",
|
| 19 |
+
"generation_limit": {
|
| 20 |
+
"reasoning_model": false,
|
| 21 |
+
"max_new_tokens": 2048,
|
| 22 |
+
"batch_size": 5,
|
| 23 |
+
"temperature": 0.8
|
| 24 |
+
},
|
| 25 |
+
"num_attempts": 1000,
|
| 26 |
+
"resumed": true
|
| 27 |
+
}
|
evidence/instruction_recipe_results.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Instruction Tuning Recipe Results
|
| 2 |
+
|
| 3 |
+
Evaluation protocol for the main HF results:
|
| 4 |
+
- Dataset: runnable alignment benchmark, 200 tasks
|
| 5 |
+
- Samples per task: 5
|
| 6 |
+
- Attempts: 1000
|
| 7 |
+
- Metric: pass@1 / pass@5
|
| 8 |
+
|
| 9 |
+
## Same Instruct Initialization: F3 / F4 Data Recipe
|
| 10 |
+
|
| 11 |
+
| Setup | Data Recipe | Approx. Train Samples | pass@1 | pass@5 | Notes |
|
| 12 |
+
|---|---|---:|---:|---:|---|
|
| 13 |
+
| Qwen2.5-Coder-0.5B-Instruct + SFT | F3 clean | 473K | 9.1% | 13.0% | Strongest F3 baseline |
|
| 14 |
+
| Qwen2.5-Coder-0.5B-Instruct + SFT | F3 refined | 207K | 9.1% | 13.0% | Similar performance with fewer samples |
|
| 15 |
+
| Qwen2.5-Coder-0.5B-Instruct + SFT | F3 high-quality | 135K | 8.3% | 13.0% | Slight pass@1 drop after stronger filtering |
|
| 16 |
+
| Qwen2.5-Coder-0.5B-Instruct + SFT | F3 + F4 clean | 150K | 5.7% | 11.5% | Mixed recipe underperforms F3-only |
|
| 17 |
+
| Qwen2.5-Coder-0.5B-Instruct + SFT | F4 clean | 17.5K | 0.9% | 2.5% | Too small / narrow for this benchmark |
|
| 18 |
+
|
| 19 |
+
## Evol / Sequential Instruction Tuning
|
| 20 |
+
|
| 21 |
+
| Setup | Initialization | Data Recipe | Approx. Train Samples | pass@1 | pass@5 | Notes |
|
| 22 |
+
|---|---|---|---:|---:|---:|---|
|
| 23 |
+
| Stage2 CPT + SFT | Stage2 CPT | Evol + self-OSS | 80.7K | 1.7% | 5.5% | General instruction data alone is weak for the target benchmark |
|
| 24 |
+
| Stage2 CPT + SFT + SFT | Stage2 CPT + Evol/self-OSS SFT | F3 refined | 207K | 1.9% | 6.5% | F3 recovery is limited after weak Evol-stage alignment |
|
| 25 |
+
| Magicoder-style SFT | Qwen2.5-Coder Base | F3 refined, 3 epochs | 207K | 0.6% | 2.5% | F3 alone from base is weak under this setup |
|
| 26 |
+
| Magicoder-style SFT | Qwen2.5-Coder Base | Evol, 3 epochs | 30K | 1.7% | 5.0% | Evol improves over F3-only base setup |
|
| 27 |
+
| Magicoder-style SFT | Qwen2.5-Coder Base + Evol SFT | F3 refined, 1 epoch | 207K | 4.1% | 10.5% | Sequential Evol -> F3 gives the best result in this group |
|
| 28 |
+
|
| 29 |
+
## Initialization Reference
|
| 30 |
+
|
| 31 |
+
| Setup | Initialization | Data Recipe | pass@1 | pass@5 | Notes |
|
| 32 |
+
|---|---|---|---:|---:|---|
|
| 33 |
+
| Base + SFT | Qwen2.5-Coder-0.5B Base | F3 high-quality | 0.4% | 2.0% | Raw base lacks instruction-following prior |
|
| 34 |
+
| CPT + SFT | Continued-pretrained checkpoint | F3 clean | 2.8% | 8.5% | CPT helps but does not match instruct initialization |
|
| 35 |
+
| Stage1 CPT + SFT | Stage1 CPT | F3 high-quality | 4.9% | 10.5% | Stage1 CPT is better than raw base |
|
| 36 |
+
| Instruct + SFT | Qwen2.5-Coder-0.5B-Instruct | F3 high-quality | 8.3% | 13.0% | Instruct initialization remains strongest |
|
| 37 |
+
|
| 38 |
+
## PPT Takeaways
|
| 39 |
+
|
| 40 |
+
1. F3-style instruction data is the most reliable recipe for the runnable benchmark.
|
| 41 |
+
2. Stronger cleaning can reduce data size substantially with only small pass@1 loss, but overly small F4-style data loses coverage.
|
| 42 |
+
3. Evol-style general instruction data helps in sequential settings, especially Evol -> F3, but Evol alone does not solve the target benchmark.
|
| 43 |
+
4. Model initialization is a major confound: instruction-aligned initialization is much stronger than raw base initialization.
|
evidence/smoke_test_results.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"model": "pretrained/stage1_cpt",
|
| 4 |
+
"path": "models/pretrained/stage1_cpt",
|
| 5 |
+
"ok": true,
|
| 6 |
+
"architecture": "Qwen2ForCausalLM",
|
| 7 |
+
"hidden_size": 896,
|
| 8 |
+
"layers": 24,
|
| 9 |
+
"vocab_size": 151936,
|
| 10 |
+
"tokenizer": "Qwen2Tokenizer",
|
| 11 |
+
"parameters_million": 494.0,
|
| 12 |
+
"logits_shape": [
|
| 13 |
+
1,
|
| 14 |
+
14,
|
| 15 |
+
151936
|
| 16 |
+
],
|
| 17 |
+
"finite": true,
|
| 18 |
+
"top1_zscore": 13.02
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"model": "sft/sft_f3_refined_instruct",
|
| 22 |
+
"path": "models/sft/sft_f3_refined_instruct",
|
| 23 |
+
"ok": true,
|
| 24 |
+
"architecture": "Qwen2ForCausalLM",
|
| 25 |
+
"hidden_size": 896,
|
| 26 |
+
"layers": 24,
|
| 27 |
+
"vocab_size": 151936,
|
| 28 |
+
"tokenizer": "Qwen2Tokenizer",
|
| 29 |
+
"parameters_million": 494.0,
|
| 30 |
+
"logits_shape": [
|
| 31 |
+
1,
|
| 32 |
+
14,
|
| 33 |
+
151936
|
| 34 |
+
],
|
| 35 |
+
"finite": true,
|
| 36 |
+
"top1_zscore": 12.84
|
| 37 |
+
}
|
| 38 |
+
]
|
models/pretrained/stage1_cpt/args.json
ADDED
|
@@ -0,0 +1,344 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"output_dir": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_curriculum_filtered_stage1/v1-20260514-232114",
|
| 3 |
+
"per_device_train_batch_size": 8,
|
| 4 |
+
"num_train_epochs": 1.0,
|
| 5 |
+
"max_steps": -1,
|
| 6 |
+
"learning_rate": 5e-05,
|
| 7 |
+
"lr_scheduler_type": "cosine",
|
| 8 |
+
"lr_scheduler_kwargs": null,
|
| 9 |
+
"warmup_steps": 0,
|
| 10 |
+
"optim": "adamw_torch_fused",
|
| 11 |
+
"optim_args": null,
|
| 12 |
+
"weight_decay": 0.1,
|
| 13 |
+
"adam_beta1": 0.9,
|
| 14 |
+
"adam_beta2": 0.95,
|
| 15 |
+
"adam_epsilon": 1e-08,
|
| 16 |
+
"optim_target_modules": null,
|
| 17 |
+
"gradient_accumulation_steps": 4,
|
| 18 |
+
"average_tokens_across_devices": true,
|
| 19 |
+
"max_grad_norm": 1.0,
|
| 20 |
+
"label_smoothing_factor": 0.0,
|
| 21 |
+
"bf16": true,
|
| 22 |
+
"fp16": false,
|
| 23 |
+
"bf16_full_eval": false,
|
| 24 |
+
"fp16_full_eval": false,
|
| 25 |
+
"tf32": null,
|
| 26 |
+
"gradient_checkpointing": true,
|
| 27 |
+
"gradient_checkpointing_kwargs": null,
|
| 28 |
+
"torch_compile": false,
|
| 29 |
+
"torch_compile_backend": null,
|
| 30 |
+
"torch_compile_mode": null,
|
| 31 |
+
"use_liger_kernel": false,
|
| 32 |
+
"liger_kernel_config": null,
|
| 33 |
+
"use_cache": false,
|
| 34 |
+
"neftune_noise_alpha": null,
|
| 35 |
+
"torch_empty_cache_steps": null,
|
| 36 |
+
"auto_find_batch_size": false,
|
| 37 |
+
"logging_strategy": "steps",
|
| 38 |
+
"logging_steps": 50,
|
| 39 |
+
"logging_first_step": true,
|
| 40 |
+
"log_on_each_node": true,
|
| 41 |
+
"logging_nan_inf_filter": true,
|
| 42 |
+
"include_num_input_tokens_seen": false,
|
| 43 |
+
"log_level": "passive",
|
| 44 |
+
"log_level_replica": "warning",
|
| 45 |
+
"disable_tqdm": null,
|
| 46 |
+
"report_to": [
|
| 47 |
+
"tensorboard"
|
| 48 |
+
],
|
| 49 |
+
"run_name": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_curriculum_filtered_stage1/v1-20260514-232114",
|
| 50 |
+
"project": "huggingface",
|
| 51 |
+
"trackio_space_id": null,
|
| 52 |
+
"trackio_bucket_id": null,
|
| 53 |
+
"trackio_static_space_id": null,
|
| 54 |
+
"eval_strategy": "no",
|
| 55 |
+
"eval_steps": 2000.0,
|
| 56 |
+
"eval_delay": 0,
|
| 57 |
+
"per_device_eval_batch_size": 1,
|
| 58 |
+
"prediction_loss_only": false,
|
| 59 |
+
"eval_on_start": false,
|
| 60 |
+
"eval_do_concat_batches": true,
|
| 61 |
+
"eval_use_gather_object": false,
|
| 62 |
+
"eval_accumulation_steps": null,
|
| 63 |
+
"include_for_metrics": [],
|
| 64 |
+
"batch_eval_metrics": false,
|
| 65 |
+
"save_only_model": false,
|
| 66 |
+
"save_strategy": "steps",
|
| 67 |
+
"save_steps": 2000.0,
|
| 68 |
+
"save_on_each_node": false,
|
| 69 |
+
"save_total_limit": 3,
|
| 70 |
+
"enable_jit_checkpoint": false,
|
| 71 |
+
"push_to_hub": false,
|
| 72 |
+
"hub_token": null,
|
| 73 |
+
"hub_private_repo": null,
|
| 74 |
+
"hub_model_id": null,
|
| 75 |
+
"hub_strategy": "every_save",
|
| 76 |
+
"hub_always_push": false,
|
| 77 |
+
"hub_revision": null,
|
| 78 |
+
"load_best_model_at_end": false,
|
| 79 |
+
"metric_for_best_model": "loss",
|
| 80 |
+
"greater_is_better": false,
|
| 81 |
+
"ignore_data_skip": false,
|
| 82 |
+
"restore_callback_states_from_checkpoint": false,
|
| 83 |
+
"full_determinism": false,
|
| 84 |
+
"seed": 42,
|
| 85 |
+
"data_seed": 42,
|
| 86 |
+
"use_cpu": false,
|
| 87 |
+
"accelerator_config": {
|
| 88 |
+
"dispatch_batches": false
|
| 89 |
+
},
|
| 90 |
+
"parallelism_config": null,
|
| 91 |
+
"dataloader_drop_last": false,
|
| 92 |
+
"dataloader_num_workers": 8,
|
| 93 |
+
"dataloader_pin_memory": true,
|
| 94 |
+
"dataloader_persistent_workers": false,
|
| 95 |
+
"dataloader_prefetch_factor": null,
|
| 96 |
+
"remove_unused_columns": true,
|
| 97 |
+
"label_names": null,
|
| 98 |
+
"train_sampling_strategy": "random",
|
| 99 |
+
"length_column_name": "length",
|
| 100 |
+
"ddp_find_unused_parameters": null,
|
| 101 |
+
"ddp_bucket_cap_mb": null,
|
| 102 |
+
"ddp_broadcast_buffers": null,
|
| 103 |
+
"ddp_static_graph": null,
|
| 104 |
+
"ddp_backend": null,
|
| 105 |
+
"ddp_timeout": 18000000,
|
| 106 |
+
"fsdp": [],
|
| 107 |
+
"fsdp_config": null,
|
| 108 |
+
"deepspeed": null,
|
| 109 |
+
"debug": null,
|
| 110 |
+
"skip_memory_metrics": true,
|
| 111 |
+
"do_train": false,
|
| 112 |
+
"do_eval": false,
|
| 113 |
+
"do_predict": false,
|
| 114 |
+
"resume_from_checkpoint": null,
|
| 115 |
+
"warmup_ratio": 0.03,
|
| 116 |
+
"logging_dir": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_curriculum_filtered_stage1/v1-20260514-232114/runs",
|
| 117 |
+
"local_rank": 0,
|
| 118 |
+
"sortish_sampler": false,
|
| 119 |
+
"predict_with_generate": false,
|
| 120 |
+
"generation_max_length": null,
|
| 121 |
+
"generation_num_beams": null,
|
| 122 |
+
"generation_config": null,
|
| 123 |
+
"tuner_backend": "peft",
|
| 124 |
+
"vit_gradient_checkpointing": false,
|
| 125 |
+
"router_aux_loss_coef": 0.0,
|
| 126 |
+
"enable_dft_loss": false,
|
| 127 |
+
"enable_channel_loss": false,
|
| 128 |
+
"safe_serialization": true,
|
| 129 |
+
"max_shard_size": "5GB",
|
| 130 |
+
"check_model": true,
|
| 131 |
+
"acc_strategy": "token",
|
| 132 |
+
"train_dataloader_shuffle": true,
|
| 133 |
+
"group_by_length": false,
|
| 134 |
+
"max_epochs": null,
|
| 135 |
+
"aligner_lr": null,
|
| 136 |
+
"vit_lr": null,
|
| 137 |
+
"use_logits_to_keep": null,
|
| 138 |
+
"ds3_gather_for_generation": true,
|
| 139 |
+
"resume_only_model": false,
|
| 140 |
+
"optimizer": null,
|
| 141 |
+
"loss_type": null,
|
| 142 |
+
"eval_metric": null,
|
| 143 |
+
"callbacks": [],
|
| 144 |
+
"early_stop_interval": null,
|
| 145 |
+
"eval_use_evalscope": false,
|
| 146 |
+
"eval_dataset": [],
|
| 147 |
+
"eval_dataset_args": null,
|
| 148 |
+
"eval_limit": null,
|
| 149 |
+
"eval_generation_config": null,
|
| 150 |
+
"extra_eval_args": null,
|
| 151 |
+
"tuner_type": "full",
|
| 152 |
+
"use_galore": false,
|
| 153 |
+
"galore_target_modules": null,
|
| 154 |
+
"galore_rank": 128,
|
| 155 |
+
"galore_update_proj_gap": 50,
|
| 156 |
+
"galore_scale": 1.0,
|
| 157 |
+
"galore_proj_type": "std",
|
| 158 |
+
"galore_optim_per_parameter": false,
|
| 159 |
+
"galore_with_embedding": false,
|
| 160 |
+
"galore_quantization": false,
|
| 161 |
+
"galore_proj_quant": false,
|
| 162 |
+
"galore_proj_bits": 4,
|
| 163 |
+
"galore_proj_group_size": 256,
|
| 164 |
+
"galore_cos_threshold": 0.4,
|
| 165 |
+
"galore_gamma_proj": 2,
|
| 166 |
+
"galore_queue_size": 5,
|
| 167 |
+
"lisa_activated_layers": 0,
|
| 168 |
+
"lisa_step_interval": 20,
|
| 169 |
+
"use_flash_ckpt": false,
|
| 170 |
+
"use_ray": false,
|
| 171 |
+
"ray_exp_name": null,
|
| 172 |
+
"device_groups": null,
|
| 173 |
+
"model": "Qwen/Qwen2.5-Coder-0.5B",
|
| 174 |
+
"model_type": "qwen2",
|
| 175 |
+
"model_revision": null,
|
| 176 |
+
"task_type": "causal_lm",
|
| 177 |
+
"torch_dtype": "bfloat16",
|
| 178 |
+
"attn_impl": "flash_attn",
|
| 179 |
+
"experts_impl": null,
|
| 180 |
+
"new_special_tokens": [],
|
| 181 |
+
"num_labels": null,
|
| 182 |
+
"problem_type": null,
|
| 183 |
+
"rope_scaling": null,
|
| 184 |
+
"device_map": null,
|
| 185 |
+
"max_memory": {},
|
| 186 |
+
"max_model_len": null,
|
| 187 |
+
"local_repo_path": null,
|
| 188 |
+
"init_strategy": null,
|
| 189 |
+
"template": "qwen2_5",
|
| 190 |
+
"system": null,
|
| 191 |
+
"max_length": 1024,
|
| 192 |
+
"truncation_strategy": "delete",
|
| 193 |
+
"max_pixels": null,
|
| 194 |
+
"agent_template": null,
|
| 195 |
+
"norm_bbox": null,
|
| 196 |
+
"use_chat_template": false,
|
| 197 |
+
"padding_side": "right",
|
| 198 |
+
"padding_free": false,
|
| 199 |
+
"loss_scale": "all",
|
| 200 |
+
"sequence_parallel_size": 1,
|
| 201 |
+
"template_backend": "swift",
|
| 202 |
+
"response_prefix": null,
|
| 203 |
+
"enable_thinking": null,
|
| 204 |
+
"add_non_thinking_prefix": true,
|
| 205 |
+
"dataset": [
|
| 206 |
+
"/raid/data/weifeng/Datasets/code_messages_pre_train_filtered_stage1.jsonl"
|
| 207 |
+
],
|
| 208 |
+
"val_dataset": [],
|
| 209 |
+
"cached_dataset": [],
|
| 210 |
+
"cached_val_dataset": [],
|
| 211 |
+
"split_dataset_ratio": 0.0,
|
| 212 |
+
"dataset_num_proc": 8,
|
| 213 |
+
"load_from_cache_file": false,
|
| 214 |
+
"dataset_shuffle": true,
|
| 215 |
+
"val_dataset_shuffle": false,
|
| 216 |
+
"streaming": false,
|
| 217 |
+
"interleave_prob": null,
|
| 218 |
+
"stopping_strategy": "first_exhausted",
|
| 219 |
+
"shuffle_buffer_size": 1000,
|
| 220 |
+
"download_mode": "reuse_dataset_if_exists",
|
| 221 |
+
"columns": {},
|
| 222 |
+
"strict": false,
|
| 223 |
+
"model_name": null,
|
| 224 |
+
"model_author": null,
|
| 225 |
+
"custom_dataset_info": [],
|
| 226 |
+
"quant_method": null,
|
| 227 |
+
"quant_bits": null,
|
| 228 |
+
"hqq_axis": null,
|
| 229 |
+
"bnb_4bit_compute_dtype": "bfloat16",
|
| 230 |
+
"bnb_4bit_quant_type": "nf4",
|
| 231 |
+
"bnb_4bit_use_double_quant": true,
|
| 232 |
+
"bnb_4bit_quant_storage": null,
|
| 233 |
+
"max_new_tokens": 64,
|
| 234 |
+
"temperature": 0.0,
|
| 235 |
+
"top_k": null,
|
| 236 |
+
"top_p": null,
|
| 237 |
+
"repetition_penalty": null,
|
| 238 |
+
"num_beams": 1,
|
| 239 |
+
"stream": false,
|
| 240 |
+
"stop_words": [],
|
| 241 |
+
"logprobs": false,
|
| 242 |
+
"top_logprobs": null,
|
| 243 |
+
"structured_outputs_regex": null,
|
| 244 |
+
"adapters": [],
|
| 245 |
+
"external_plugins": [],
|
| 246 |
+
"custom_register_path": [],
|
| 247 |
+
"model_kwargs": {},
|
| 248 |
+
"load_args": false,
|
| 249 |
+
"load_data_args": false,
|
| 250 |
+
"packing": false,
|
| 251 |
+
"packing_length": null,
|
| 252 |
+
"packing_num_proc": 1,
|
| 253 |
+
"lazy_tokenize": false,
|
| 254 |
+
"use_hf": true,
|
| 255 |
+
"ignore_args_error": false,
|
| 256 |
+
"use_swift_lora": false,
|
| 257 |
+
"freeze_parameters": [],
|
| 258 |
+
"freeze_parameters_regex": null,
|
| 259 |
+
"freeze_parameters_ratio": 0.0,
|
| 260 |
+
"trainable_parameters": [],
|
| 261 |
+
"trainable_parameters_regex": null,
|
| 262 |
+
"freeze_llm": false,
|
| 263 |
+
"freeze_vit": true,
|
| 264 |
+
"freeze_aligner": true,
|
| 265 |
+
"target_modules": [
|
| 266 |
+
"all-linear"
|
| 267 |
+
],
|
| 268 |
+
"target_regex": null,
|
| 269 |
+
"target_parameters": null,
|
| 270 |
+
"modules_to_save": [],
|
| 271 |
+
"lora_rank": 8,
|
| 272 |
+
"lora_alpha": 32,
|
| 273 |
+
"lora_dropout": 0.05,
|
| 274 |
+
"lora_bias": "none",
|
| 275 |
+
"lora_dtype": null,
|
| 276 |
+
"lorap_lr_ratio": null,
|
| 277 |
+
"use_rslora": false,
|
| 278 |
+
"use_dora": false,
|
| 279 |
+
"lora_ga_batch_size": 2,
|
| 280 |
+
"lora_ga_iters": 2,
|
| 281 |
+
"lora_ga_max_length": 1024,
|
| 282 |
+
"lora_ga_direction": "ArB2r",
|
| 283 |
+
"lora_ga_scale": "stable",
|
| 284 |
+
"lora_ga_stable_gamma": 16,
|
| 285 |
+
"init_weights": true,
|
| 286 |
+
"fourier_n_frequency": 2000,
|
| 287 |
+
"fourier_scaling": 300.0,
|
| 288 |
+
"boft_block_size": 4,
|
| 289 |
+
"boft_block_num": 0,
|
| 290 |
+
"boft_n_butterfly_factor": 1,
|
| 291 |
+
"boft_dropout": 0.0,
|
| 292 |
+
"vera_rank": 256,
|
| 293 |
+
"vera_projection_prng_key": 0,
|
| 294 |
+
"vera_dropout": 0.0,
|
| 295 |
+
"vera_d_initial": 0.1,
|
| 296 |
+
"adapter_act": "gelu",
|
| 297 |
+
"adapter_length": 128,
|
| 298 |
+
"adalora_target_r": 8,
|
| 299 |
+
"adalora_init_r": 12,
|
| 300 |
+
"adalora_tinit": 0,
|
| 301 |
+
"adalora_tfinal": 0,
|
| 302 |
+
"adalora_deltaT": 1,
|
| 303 |
+
"adalora_beta1": 0.85,
|
| 304 |
+
"adalora_beta2": 0.85,
|
| 305 |
+
"adalora_orth_reg_weight": 0.5,
|
| 306 |
+
"llamapro_num_new_blocks": 4,
|
| 307 |
+
"llamapro_num_groups": null,
|
| 308 |
+
"reft_layer_key": null,
|
| 309 |
+
"reft_layers": null,
|
| 310 |
+
"reft_rank": 4,
|
| 311 |
+
"reft_intervention_type": "LoreftIntervention",
|
| 312 |
+
"reft_args": null,
|
| 313 |
+
"swanlab_token": null,
|
| 314 |
+
"swanlab_project": "ms-swift",
|
| 315 |
+
"swanlab_workspace": null,
|
| 316 |
+
"swanlab_exp_name": null,
|
| 317 |
+
"swanlab_notification_method": null,
|
| 318 |
+
"swanlab_webhook_url": null,
|
| 319 |
+
"swanlab_secret": null,
|
| 320 |
+
"swanlab_sender_email": null,
|
| 321 |
+
"swanlab_receiver_email": null,
|
| 322 |
+
"swanlab_smtp_server": null,
|
| 323 |
+
"swanlab_smtp_port": null,
|
| 324 |
+
"swanlab_email_language": "zh",
|
| 325 |
+
"swanlab_mode": "cloud",
|
| 326 |
+
"add_version": true,
|
| 327 |
+
"create_checkpoint_symlink": false,
|
| 328 |
+
"zero_hpz_partition_size": null,
|
| 329 |
+
"deepspeed_autotp_size": null,
|
| 330 |
+
"swift_version": "4.1.3",
|
| 331 |
+
"ckpt_dir": null,
|
| 332 |
+
"rank": 0,
|
| 333 |
+
"global_world_size": 1,
|
| 334 |
+
"local_world_size": 1,
|
| 335 |
+
"model_suffix": "Qwen2.5-Coder-0.5B",
|
| 336 |
+
"model_info": "ModelInfo(model_type='qwen2', model_dir='/home/weifeng/.cache/huggingface/hub/models--Qwen--Qwen2.5-Coder-0.5B/snapshots/8123ea2e9354afb7ffcc6c8641d1b2f5ecf18301', torch_dtype=torch.bfloat16, max_model_len=32768, quant_method=None, quant_bits=None, rope_scaling={'rope_theta': 1000000.0, 'rope_type': 'default'}, is_moe_model=False, is_multimodal=False, config=None, task_type='causal_lm', num_labels=None)",
|
| 337 |
+
"model_meta": "ModelMeta(model_type='qwen2', model_groups=[ModelGroup(models=[Model(ms_model_id='Qwen/Qwen1.5-0.5B-Chat', hf_model_id='Qwen/Qwen1.5-0.5B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-1.8B-Chat', hf_model_id='Qwen/Qwen1.5-1.8B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-4B-Chat', hf_model_id='Qwen/Qwen1.5-4B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-7B-Chat', hf_model_id='Qwen/Qwen1.5-7B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-14B-Chat', hf_model_id='Qwen/Qwen1.5-14B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-32B-Chat', hf_model_id='Qwen/Qwen1.5-32B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-72B-Chat', hf_model_id='Qwen/Qwen1.5-72B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-110B-Chat', hf_model_id='Qwen/Qwen1.5-110B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-0.5B', hf_model_id='Qwen/Qwen1.5-0.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-1.8B', hf_model_id='Qwen/Qwen1.5-1.8B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-4B', hf_model_id='Qwen/Qwen1.5-4B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-7B', hf_model_id='Qwen/Qwen1.5-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-14B', hf_model_id='Qwen/Qwen1.5-14B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-32B', hf_model_id='Qwen/Qwen1.5-32B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-72B', hf_model_id='Qwen/Qwen1.5-72B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-110B', hf_model_id='Qwen/Qwen1.5-110B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-0.5B-Chat-GPTQ-Int4', hf_model_id='Qwen/Qwen1.5-0.5B-Chat-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-1.8B-Chat-GPTQ-Int4', hf_model_id='Qwen/Qwen1.5-1.8B-Chat-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-4B-Chat-GPTQ-Int4', hf_model_id='Qwen/Qwen1.5-4B-Chat-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-7B-Chat-GPTQ-Int4', hf_model_id='Qwen/Qwen1.5-7B-Chat-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-14B-Chat-GPTQ-Int4', hf_model_id='Qwen/Qwen1.5-14B-Chat-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-32B-Chat-GPTQ-Int4', hf_model_id='Qwen/Qwen1.5-32B-Chat-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-72B-Chat-GPTQ-Int4', hf_model_id='Qwen/Qwen1.5-72B-Chat-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-110B-Chat-GPTQ-Int4', hf_model_id='Qwen/Qwen1.5-110B-Chat-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-0.5B-Chat-GPTQ-Int8', hf_model_id='Qwen/Qwen1.5-0.5B-Chat-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-1.8B-Chat-GPTQ-Int8', hf_model_id='Qwen/Qwen1.5-1.8B-Chat-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-4B-Chat-GPTQ-Int8', hf_model_id='Qwen/Qwen1.5-4B-Chat-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-7B-Chat-GPTQ-Int8', hf_model_id='Qwen/Qwen1.5-7B-Chat-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-14B-Chat-GPTQ-Int8', hf_model_id='Qwen/Qwen1.5-14B-Chat-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-72B-Chat-GPTQ-Int8', hf_model_id='Qwen/Qwen1.5-72B-Chat-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-0.5B-Chat-AWQ', hf_model_id='Qwen/Qwen1.5-0.5B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-1.8B-Chat-AWQ', hf_model_id='Qwen/Qwen1.5-1.8B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-4B-Chat-AWQ', hf_model_id='Qwen/Qwen1.5-4B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-7B-Chat-AWQ', hf_model_id='Qwen/Qwen1.5-7B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-14B-Chat-AWQ', hf_model_id='Qwen/Qwen1.5-14B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-32B-Chat-AWQ', hf_model_id='Qwen/Qwen1.5-32B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-72B-Chat-AWQ', hf_model_id='Qwen/Qwen1.5-72B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-110B-Chat-AWQ', hf_model_id='Qwen/Qwen1.5-110B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None)], template='qwen', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='Qwen/CodeQwen1.5-7B', hf_model_id='Qwen/CodeQwen1.5-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/CodeQwen1.5-7B-Chat', hf_model_id='Qwen/CodeQwen1.5-7B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/CodeQwen1.5-7B-Chat-AWQ', hf_model_id='Qwen/CodeQwen1.5-7B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None)], template='qwen', ignore_patterns=None, requires=None, tags=['coding']), ModelGroup(models=[Model(ms_model_id='Qwen/Qwen2-0.5B-Instruct', hf_model_id='Qwen/Qwen2-0.5B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-1.5B-Instruct', hf_model_id='Qwen/Qwen2-1.5B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-7B-Instruct', hf_model_id='Qwen/Qwen2-7B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-72B-Instruct', hf_model_id='Qwen/Qwen2-72B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-0.5B', hf_model_id='Qwen/Qwen2-0.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-1.5B', hf_model_id='Qwen/Qwen2-1.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-7B', hf_model_id='Qwen/Qwen2-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-72B', hf_model_id='Qwen/Qwen2-72B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-0.5B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2-0.5B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-1.5B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2-1.5B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-7B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2-7B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-72B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2-72B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-0.5B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2-0.5B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-1.5B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2-1.5B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-7B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2-7B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-72B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2-72B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-0.5B-Instruct-AWQ', hf_model_id='Qwen/Qwen2-0.5B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-1.5B-Instruct-AWQ', hf_model_id='Qwen/Qwen2-1.5B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-7B-Instruct-AWQ', hf_model_id='Qwen/Qwen2-7B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-72B-Instruct-AWQ', hf_model_id='Qwen/Qwen2-72B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None)], template='qwen', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='Qwen/Qwen2-Math-1.5B-Instruct', hf_model_id='Qwen/Qwen2-Math-1.5B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-Math-7B-Instruct', hf_model_id='Qwen/Qwen2-Math-7B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-Math-72B-Instruct', hf_model_id='Qwen/Qwen2-Math-72B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-Math-1.5B', hf_model_id='Qwen/Qwen2-Math-1.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-Math-7B', hf_model_id='Qwen/Qwen2-Math-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-Math-72B', hf_model_id='Qwen/Qwen2-Math-72B', model_path=None, ms_revision=None, hf_revision=None)], template='qwen', ignore_patterns=None, requires=None, tags=['math']), ModelGroup(models=[Model(ms_model_id='Qwen/Qwen2.5-7B-Instruct-1M', hf_model_id='Qwen/Qwen2.5-7B-Instruct-1M', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-14B-Instruct-1M', hf_model_id='Qwen/Qwen2.5-14B-Instruct-1M', model_path=None, ms_revision=None, hf_revision=None)], template='qwen', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='PowerInfer/SmallThinker-3B-Preview', hf_model_id='PowerInfer/SmallThinker-3B-Preview', model_path=None, ms_revision=None, hf_revision=None)], template='qwen', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='Qwen/Qwen2.5-0.5B-Instruct', hf_model_id='Qwen/Qwen2.5-0.5B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-1.5B-Instruct', hf_model_id='Qwen/Qwen2.5-1.5B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-3B-Instruct', hf_model_id='Qwen/Qwen2.5-3B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-7B-Instruct', hf_model_id='Qwen/Qwen2.5-7B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-14B-Instruct', hf_model_id='Qwen/Qwen2.5-14B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-32B-Instruct', hf_model_id='Qwen/Qwen2.5-32B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-72B-Instruct', hf_model_id='Qwen/Qwen2.5-72B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-0.5B', hf_model_id='Qwen/Qwen2.5-0.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-1.5B', hf_model_id='Qwen/Qwen2.5-1.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-3B', hf_model_id='Qwen/Qwen2.5-3B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-7B', hf_model_id='Qwen/Qwen2.5-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-14B', hf_model_id='Qwen/Qwen2.5-14B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-32B', hf_model_id='Qwen/Qwen2.5-32B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-72B', hf_model_id='Qwen/Qwen2.5-72B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-0.5B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-0.5B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-1.5B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-1.5B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-3B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-3B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-7B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-7B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-14B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-14B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-32B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-32B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-72B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-72B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-0.5B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-0.5B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-1.5B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-1.5B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-3B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-3B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-7B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-7B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-14B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-14B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-32B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-32B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-72B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-72B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-0.5B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-0.5B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-1.5B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-1.5B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-3B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-3B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-7B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-7B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-14B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-14B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-32B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-32B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-72B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-72B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None)], template='qwen2_5', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='Qwen/Qwen2.5-Coder-0.5B-Instruct', hf_model_id='Qwen/Qwen2.5-Coder-0.5B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-1.5B-Instruct', hf_model_id='Qwen/Qwen2.5-Coder-1.5B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-3B-Instruct', hf_model_id='Qwen/Qwen2.5-Coder-3B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-7B-Instruct', hf_model_id='Qwen/Qwen2.5-Coder-7B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-14B-Instruct', hf_model_id='Qwen/Qwen2.5-Coder-14B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-32B-Instruct', hf_model_id='Qwen/Qwen2.5-Coder-32B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-0.5B', hf_model_id='Qwen/Qwen2.5-Coder-0.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-1.5B', hf_model_id='Qwen/Qwen2.5-Coder-1.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-3B', hf_model_id='Qwen/Qwen2.5-Coder-3B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-7B', hf_model_id='Qwen/Qwen2.5-Coder-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-14B', hf_model_id='Qwen/Qwen2.5-Coder-14B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-32B', hf_model_id='Qwen/Qwen2.5-Coder-32B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-0.5B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-Coder-0.5B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-1.5B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-Coder-1.5B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-3B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-Coder-3B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-7B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-Coder-7B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-14B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-Coder-14B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-32B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-Coder-32B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-0.5B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-Coder-0.5B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-0.5B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-Coder-0.5B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-1.5B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-Coder-1.5B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-1.5B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-Coder-1.5B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-3B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-Coder-3B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-3B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-Coder-3B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-7B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-Coder-7B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-7B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-Coder-7B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-14B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-Coder-14B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-14B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-Coder-14B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-32B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-Coder-32B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-32B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-Coder-32B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None)], template='qwen2_5', ignore_patterns=None, requires=None, tags=['coding']), ModelGroup(models=[Model(ms_model_id='moonshotai/Kimi-Dev-72B', hf_model_id='moonshotai/Kimi-Dev-72B', model_path=None, ms_revision=None, hf_revision=None)], template='qwen2_5', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='Qwen/Qwen2.5-Math-1.5B-Instruct', hf_model_id='Qwen/Qwen2.5-Math-1.5B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Math-7B-Instruct', hf_model_id='Qwen/Qwen2.5-Math-7B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Math-72B-Instruct', hf_model_id='Qwen/Qwen2.5-Math-72B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Math-1.5B', hf_model_id='Qwen/Qwen2.5-Math-1.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Math-7B', hf_model_id='Qwen/Qwen2.5-Math-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Math-72B', hf_model_id='Qwen/Qwen2.5-Math-72B', model_path=None, ms_revision=None, hf_revision=None)], template='qwen2_5_math', ignore_patterns=None, requires=None, tags=['math']), ModelGroup(models=[Model(ms_model_id='AIDC-AI/Marco-o1', hf_model_id='AIDC-AI/Marco-o1', model_path=None, ms_revision=None, hf_revision=None)], template='marco_o1', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='Qwen/QwQ-32B-Preview', hf_model_id='Qwen/QwQ-32B-Preview', model_path=None, ms_revision=None, hf_revision=None)], template='qwq_preview', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='Qwen/QwQ-32B', hf_model_id='Qwen/QwQ-32B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/QwQ-32B-AWQ', hf_model_id='Qwen/QwQ-32B-AWQ', model_path=None, ms_revision=None, hf_revision=None)], template='qwq', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-7B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-14B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-14B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-32B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-32B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='iic/QwenLong-L1-32B', hf_model_id='Tongyi-Zhiwen/QwenLong-L1-32B', model_path=None, ms_revision=None, hf_revision=None)], template='deepseek_r1', ignore_patterns=None, requires=None, tags=[])], loader=<class 'swift.model.register.ModelLoader'>, template='qwen2_5', model_arch=ModelKeys(arch_name='llama', embedding='model.embed_tokens', module_list='model.layers', lm_head='lm_head', q_proj='model.layers.{}.self_attn.q_proj', k_proj='model.layers.{}.self_attn.k_proj', v_proj='model.layers.{}.self_attn.v_proj', o_proj='model.layers.{}.self_attn.o_proj', attention='model.layers.{}.self_attn', mlp='model.layers.{}.mlp', down_proj='model.layers.{}.mlp.down_proj', qkv_proj=None, qk_proj=None, qa_proj=None, qb_proj=None, kv_proj=None, kva_proj=None, kvb_proj=None), mcore_model_type=None, architectures=['Qwen2ForCausalLM'], additional_saved_files=[], torch_dtype=None, is_multimodal=False, is_reward=False, task_type=None, ignore_patterns=None, requires=['transformers>=4.37'], tags=['coding'])",
|
| 338 |
+
"model_dir": "/home/weifeng/.cache/huggingface/hub/models--Qwen--Qwen2.5-Coder-0.5B/snapshots/8123ea2e9354afb7ffcc6c8641d1b2f5ecf18301",
|
| 339 |
+
"template_meta": "Qwen2_5TemplateMeta(template_type='qwen2_5', prefix=[], prompt=['<|im_start|>user\\n{{QUERY}}<|im_end|>\\n<|im_start|>assistant\\n'], chat_sep=['<|im_end|>\\n'], suffix=['<|im_end|>\\n'], template_cls=<class 'swift.template.base.Template'>, system_prefix=['<|im_start|>system\\n{{SYSTEM}}<|im_end|>\\n'], default_system='You are Qwen, created by Alibaba Cloud. You are a helpful assistant.', auto_add_bos=False, stop_words=['<|endoftext|>'], agent_template='hermes', is_thinking=False, thinking_prefix='', non_thinking_prefix='', history_thinking_prefix='')",
|
| 340 |
+
"_val_dataset_exists": false,
|
| 341 |
+
"hub": "<class 'swift.hub.hub.HFHub'>",
|
| 342 |
+
"evaluation_strategy": "steps",
|
| 343 |
+
"training_args": "Seq2SeqTrainingArguments(output_dir='/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_curriculum_filtered_stage1/v1-20260514-232114', per_device_train_batch_size=8, num_train_epochs=1.0, max_steps=-1, learning_rate=5e-05, lr_scheduler_type=<SchedulerType.COSINE: 'cosine'>, lr_scheduler_kwargs=None, warmup_steps=0.03, optim=<OptimizerNames.ADAMW_TORCH_FUSED: 'adamw_torch_fused'>, optim_args=None, weight_decay=0.1, adam_beta1=0.9, adam_beta2=0.95, adam_epsilon=1e-08, optim_target_modules=None, gradient_accumulation_steps=4, average_tokens_across_devices=None, max_grad_norm=1.0, label_smoothing_factor=0.0, bf16=True, fp16=False, bf16_full_eval=False, fp16_full_eval=False, tf32=None, gradient_checkpointing=True, gradient_checkpointing_kwargs=None, torch_compile=False, torch_compile_backend=None, torch_compile_mode=None, use_liger_kernel=False, liger_kernel_config=None, use_cache=False, neftune_noise_alpha=None, torch_empty_cache_steps=None, auto_find_batch_size=False, logging_strategy=<IntervalStrategy.STEPS: 'steps'>, logging_steps=50, logging_first_step=True, log_on_each_node=True, logging_nan_inf_filter=True, include_num_input_tokens_seen=None, log_level='passive', log_level_replica='warning', disable_tqdm=False, report_to=['tensorboard'], run_name='/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_curriculum_filtered_stage1/v1-20260514-232114', project='huggingface', trackio_space_id=None, trackio_bucket_id=None, trackio_static_space_id=None, eval_strategy=<IntervalStrategy.NO: 'no'>, eval_steps=2000.0, eval_delay=0, per_device_eval_batch_size=1, prediction_loss_only=False, eval_on_start=False, eval_do_concat_batches=True, eval_use_gather_object=False, eval_accumulation_steps=None, include_for_metrics=[], batch_eval_metrics=False, save_only_model=False, save_strategy=<SaveStrategy.STEPS: 'steps'>, save_steps=2000, save_on_each_node=False, save_total_limit=3, enable_jit_checkpoint=False, push_to_hub=False, hub_token=None, hub_private_repo=None, hub_model_id=None, hub_strategy=<HubStrategy.EVERY_SAVE: 'every_save'>, hub_always_push=False, hub_revision=None, load_best_model_at_end=False, metric_for_best_model='loss', greater_is_better=False, ignore_data_skip=False, restore_callback_states_from_checkpoint=False, full_determinism=False, seed=42, data_seed=42, use_cpu=False, accelerator_config=AcceleratorConfig(split_batches=False, dispatch_batches=False, even_batches=True, use_seedable_sampler=True, non_blocking=False, gradient_accumulation_kwargs=None, use_configured_state=False), parallelism_config=None, dataloader_drop_last=False, dataloader_num_workers=8, dataloader_pin_memory=True, dataloader_persistent_workers=False, dataloader_prefetch_factor=2, remove_unused_columns=False, label_names=None, train_sampling_strategy='random', length_column_name='length', ddp_find_unused_parameters=None, ddp_bucket_cap_mb=None, ddp_broadcast_buffers=None, ddp_static_graph=None, ddp_backend=None, ddp_timeout=18000000, fsdp=[], fsdp_config={'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}, deepspeed=None, debug=[], skip_memory_metrics=True, do_train=False, do_eval=False, do_predict=False, resume_from_checkpoint=None, warmup_ratio=0.03, logging_dir='/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_curriculum_filtered_stage1/v1-20260514-232114/runs', local_rank=0, sortish_sampler=False, predict_with_generate=False, generation_max_length=None, generation_num_beams=None, generation_config=None, tuner_backend='peft', vit_gradient_checkpointing=False, router_aux_loss_coef=0.0, enable_dft_loss=False, enable_channel_loss=False, safe_serialization=True, max_shard_size='5GB', check_model=True, acc_strategy='token', train_dataloader_shuffle=True, group_by_length=False, max_epochs=None, aligner_lr=None, vit_lr=None, use_logits_to_keep=None, ds3_gather_for_generation=True, resume_only_model=False, optimizer=None, loss_type=None, eval_metric=None, callbacks=[], early_stop_interval=None, eval_use_evalscope=False, eval_dataset=[], eval_dataset_args=None, eval_limit=None, eval_generation_config=None, extra_eval_args=None, tuner_type='full', use_galore=False, galore_target_modules=None, galore_rank=128, galore_update_proj_gap=50, galore_scale=1.0, galore_proj_type='std', galore_optim_per_parameter=False, galore_with_embedding=False, galore_quantization=False, galore_proj_quant=False, galore_proj_bits=4, galore_proj_group_size=256, galore_cos_threshold=0.4, galore_gamma_proj=2, galore_queue_size=5, lisa_activated_layers=0, lisa_step_interval=20, use_flash_ckpt=False)"
|
| 344 |
+
}
|
models/pretrained/stage1_cpt/chat_template.jinja
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if tools %}
|
| 2 |
+
{{- '<|im_start|>system\n' }}
|
| 3 |
+
{%- if messages[0]['role'] == 'system' %}
|
| 4 |
+
{{- messages[0]['content'] }}
|
| 5 |
+
{%- else %}
|
| 6 |
+
{{- 'You are a helpful assistant.' }}
|
| 7 |
+
{%- endif %}
|
| 8 |
+
{{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
| 9 |
+
{%- for tool in tools %}
|
| 10 |
+
{{- "\n" }}
|
| 11 |
+
{{- tool | tojson }}
|
| 12 |
+
{%- endfor %}
|
| 13 |
+
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
| 14 |
+
{%- else %}
|
| 15 |
+
{%- if messages[0]['role'] == 'system' %}
|
| 16 |
+
{{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
|
| 17 |
+
{%- else %}
|
| 18 |
+
{{- '<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n' }}
|
| 19 |
+
{%- endif %}
|
| 20 |
+
{%- endif %}
|
| 21 |
+
{%- for message in messages %}
|
| 22 |
+
{%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
|
| 23 |
+
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
| 24 |
+
{%- elif message.role == "assistant" %}
|
| 25 |
+
{{- '<|im_start|>' + message.role }}
|
| 26 |
+
{%- if message.content %}
|
| 27 |
+
{{- '\n' + message.content }}
|
| 28 |
+
{%- endif %}
|
| 29 |
+
{%- for tool_call in message.tool_calls %}
|
| 30 |
+
{%- if tool_call.function is defined %}
|
| 31 |
+
{%- set tool_call = tool_call.function %}
|
| 32 |
+
{%- endif %}
|
| 33 |
+
{{- '\n<tool_call>\n{"name": "' }}
|
| 34 |
+
{{- tool_call.name }}
|
| 35 |
+
{{- '", "arguments": ' }}
|
| 36 |
+
{{- tool_call.arguments | tojson }}
|
| 37 |
+
{{- '}\n</tool_call>' }}
|
| 38 |
+
{%- endfor %}
|
| 39 |
+
{{- '<|im_end|>\n' }}
|
| 40 |
+
{%- elif message.role == "tool" %}
|
| 41 |
+
{%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
|
| 42 |
+
{{- '<|im_start|>user' }}
|
| 43 |
+
{%- endif %}
|
| 44 |
+
{{- '\n<tool_response>\n' }}
|
| 45 |
+
{{- message.content }}
|
| 46 |
+
{{- '\n</tool_response>' }}
|
| 47 |
+
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 48 |
+
{{- '<|im_end|>\n' }}
|
| 49 |
+
{%- endif %}
|
| 50 |
+
{%- endif %}
|
| 51 |
+
{%- endfor %}
|
| 52 |
+
{%- if add_generation_prompt %}
|
| 53 |
+
{{- '<|im_start|>assistant\n' }}
|
| 54 |
+
{%- endif %}
|
models/pretrained/stage1_cpt/config.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen2ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_dropout": 0.0,
|
| 6 |
+
"bos_token_id": null,
|
| 7 |
+
"dtype": "bfloat16",
|
| 8 |
+
"eos_token_id": 151643,
|
| 9 |
+
"hidden_act": "silu",
|
| 10 |
+
"hidden_size": 896,
|
| 11 |
+
"initializer_range": 0.02,
|
| 12 |
+
"intermediate_size": 4864,
|
| 13 |
+
"layer_types": [
|
| 14 |
+
"full_attention",
|
| 15 |
+
"full_attention",
|
| 16 |
+
"full_attention",
|
| 17 |
+
"full_attention",
|
| 18 |
+
"full_attention",
|
| 19 |
+
"full_attention",
|
| 20 |
+
"full_attention",
|
| 21 |
+
"full_attention",
|
| 22 |
+
"full_attention",
|
| 23 |
+
"full_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"full_attention",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"full_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"full_attention",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"full_attention"
|
| 38 |
+
],
|
| 39 |
+
"max_position_embeddings": 32768,
|
| 40 |
+
"max_window_layers": 24,
|
| 41 |
+
"model_type": "qwen2",
|
| 42 |
+
"num_attention_heads": 14,
|
| 43 |
+
"num_hidden_layers": 24,
|
| 44 |
+
"num_key_value_heads": 2,
|
| 45 |
+
"pad_token_id": 151643,
|
| 46 |
+
"rms_norm_eps": 1e-06,
|
| 47 |
+
"rope_parameters": {
|
| 48 |
+
"rope_theta": 1000000.0,
|
| 49 |
+
"rope_type": "default"
|
| 50 |
+
},
|
| 51 |
+
"sliding_window": null,
|
| 52 |
+
"tie_word_embeddings": true,
|
| 53 |
+
"transformers_version": "5.6.2",
|
| 54 |
+
"use_cache": false,
|
| 55 |
+
"use_sliding_window": false,
|
| 56 |
+
"vocab_size": 151936
|
| 57 |
+
}
|
models/pretrained/stage1_cpt/generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 151643,
|
| 3 |
+
"do_sample": false,
|
| 4 |
+
"eos_token_id": 151643,
|
| 5 |
+
"max_new_tokens": 2048,
|
| 6 |
+
"temperature": 1.0,
|
| 7 |
+
"top_k": 50,
|
| 8 |
+
"top_p": 1.0,
|
| 9 |
+
"transformers_version": "5.6.2"
|
| 10 |
+
}
|
models/pretrained/stage1_cpt/tokenizer_config.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": null,
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "<|endoftext|>",
|
| 7 |
+
"errors": "replace",
|
| 8 |
+
"extra_special_tokens": [
|
| 9 |
+
"<|im_start|>",
|
| 10 |
+
"<|im_end|>",
|
| 11 |
+
"<|object_ref_start|>",
|
| 12 |
+
"<|object_ref_end|>",
|
| 13 |
+
"<|box_start|>",
|
| 14 |
+
"<|box_end|>",
|
| 15 |
+
"<|quad_start|>",
|
| 16 |
+
"<|quad_end|>",
|
| 17 |
+
"<|vision_start|>",
|
| 18 |
+
"<|vision_end|>",
|
| 19 |
+
"<|vision_pad|>",
|
| 20 |
+
"<|image_pad|>",
|
| 21 |
+
"<|video_pad|>"
|
| 22 |
+
],
|
| 23 |
+
"is_local": true,
|
| 24 |
+
"local_files_only": false,
|
| 25 |
+
"model_max_length": 32768,
|
| 26 |
+
"pad_token": "<|endoftext|>",
|
| 27 |
+
"split_special_tokens": false,
|
| 28 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 29 |
+
"unk_token": null
|
| 30 |
+
}
|
models/pretrained/stage1_cpt/trainer_state.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
models/sft/sft_f3_refined_instruct/args.json
ADDED
|
@@ -0,0 +1,344 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"output_dir": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu/v0-20260508-164342",
|
| 3 |
+
"per_device_train_batch_size": 4,
|
| 4 |
+
"num_train_epochs": 1.0,
|
| 5 |
+
"max_steps": -1,
|
| 6 |
+
"learning_rate": 2e-05,
|
| 7 |
+
"lr_scheduler_type": "cosine",
|
| 8 |
+
"lr_scheduler_kwargs": null,
|
| 9 |
+
"warmup_steps": 0,
|
| 10 |
+
"optim": "adamw_torch_fused",
|
| 11 |
+
"optim_args": null,
|
| 12 |
+
"weight_decay": 0.1,
|
| 13 |
+
"adam_beta1": 0.9,
|
| 14 |
+
"adam_beta2": 0.95,
|
| 15 |
+
"adam_epsilon": 1e-08,
|
| 16 |
+
"optim_target_modules": null,
|
| 17 |
+
"gradient_accumulation_steps": 8,
|
| 18 |
+
"average_tokens_across_devices": true,
|
| 19 |
+
"max_grad_norm": 1.0,
|
| 20 |
+
"label_smoothing_factor": 0.0,
|
| 21 |
+
"bf16": true,
|
| 22 |
+
"fp16": false,
|
| 23 |
+
"bf16_full_eval": false,
|
| 24 |
+
"fp16_full_eval": false,
|
| 25 |
+
"tf32": null,
|
| 26 |
+
"gradient_checkpointing": true,
|
| 27 |
+
"gradient_checkpointing_kwargs": null,
|
| 28 |
+
"torch_compile": false,
|
| 29 |
+
"torch_compile_backend": null,
|
| 30 |
+
"torch_compile_mode": null,
|
| 31 |
+
"use_liger_kernel": false,
|
| 32 |
+
"liger_kernel_config": null,
|
| 33 |
+
"use_cache": false,
|
| 34 |
+
"neftune_noise_alpha": null,
|
| 35 |
+
"torch_empty_cache_steps": null,
|
| 36 |
+
"auto_find_batch_size": false,
|
| 37 |
+
"logging_strategy": "steps",
|
| 38 |
+
"logging_steps": 10,
|
| 39 |
+
"logging_first_step": true,
|
| 40 |
+
"log_on_each_node": true,
|
| 41 |
+
"logging_nan_inf_filter": true,
|
| 42 |
+
"include_num_input_tokens_seen": false,
|
| 43 |
+
"log_level": "passive",
|
| 44 |
+
"log_level_replica": "warning",
|
| 45 |
+
"disable_tqdm": null,
|
| 46 |
+
"report_to": [
|
| 47 |
+
"tensorboard"
|
| 48 |
+
],
|
| 49 |
+
"run_name": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu/v0-20260508-164342",
|
| 50 |
+
"project": "huggingface",
|
| 51 |
+
"trackio_space_id": null,
|
| 52 |
+
"trackio_bucket_id": null,
|
| 53 |
+
"trackio_static_space_id": null,
|
| 54 |
+
"eval_strategy": "no",
|
| 55 |
+
"eval_steps": 500.0,
|
| 56 |
+
"eval_delay": 0,
|
| 57 |
+
"per_device_eval_batch_size": 1,
|
| 58 |
+
"prediction_loss_only": false,
|
| 59 |
+
"eval_on_start": false,
|
| 60 |
+
"eval_do_concat_batches": true,
|
| 61 |
+
"eval_use_gather_object": false,
|
| 62 |
+
"eval_accumulation_steps": null,
|
| 63 |
+
"include_for_metrics": [],
|
| 64 |
+
"batch_eval_metrics": false,
|
| 65 |
+
"save_only_model": false,
|
| 66 |
+
"save_strategy": "steps",
|
| 67 |
+
"save_steps": 500.0,
|
| 68 |
+
"save_on_each_node": false,
|
| 69 |
+
"save_total_limit": 5,
|
| 70 |
+
"enable_jit_checkpoint": false,
|
| 71 |
+
"push_to_hub": false,
|
| 72 |
+
"hub_token": null,
|
| 73 |
+
"hub_private_repo": null,
|
| 74 |
+
"hub_model_id": null,
|
| 75 |
+
"hub_strategy": "every_save",
|
| 76 |
+
"hub_always_push": false,
|
| 77 |
+
"hub_revision": null,
|
| 78 |
+
"load_best_model_at_end": false,
|
| 79 |
+
"metric_for_best_model": "loss",
|
| 80 |
+
"greater_is_better": false,
|
| 81 |
+
"ignore_data_skip": false,
|
| 82 |
+
"restore_callback_states_from_checkpoint": false,
|
| 83 |
+
"full_determinism": false,
|
| 84 |
+
"seed": 42,
|
| 85 |
+
"data_seed": 42,
|
| 86 |
+
"use_cpu": false,
|
| 87 |
+
"accelerator_config": {
|
| 88 |
+
"dispatch_batches": false
|
| 89 |
+
},
|
| 90 |
+
"parallelism_config": null,
|
| 91 |
+
"dataloader_drop_last": false,
|
| 92 |
+
"dataloader_num_workers": 8,
|
| 93 |
+
"dataloader_pin_memory": true,
|
| 94 |
+
"dataloader_persistent_workers": false,
|
| 95 |
+
"dataloader_prefetch_factor": null,
|
| 96 |
+
"remove_unused_columns": true,
|
| 97 |
+
"label_names": null,
|
| 98 |
+
"train_sampling_strategy": "random",
|
| 99 |
+
"length_column_name": "length",
|
| 100 |
+
"ddp_find_unused_parameters": null,
|
| 101 |
+
"ddp_bucket_cap_mb": null,
|
| 102 |
+
"ddp_broadcast_buffers": null,
|
| 103 |
+
"ddp_static_graph": null,
|
| 104 |
+
"ddp_backend": null,
|
| 105 |
+
"ddp_timeout": 18000000,
|
| 106 |
+
"fsdp": [],
|
| 107 |
+
"fsdp_config": null,
|
| 108 |
+
"deepspeed": null,
|
| 109 |
+
"debug": null,
|
| 110 |
+
"skip_memory_metrics": true,
|
| 111 |
+
"do_train": false,
|
| 112 |
+
"do_eval": false,
|
| 113 |
+
"do_predict": false,
|
| 114 |
+
"resume_from_checkpoint": null,
|
| 115 |
+
"warmup_ratio": 0.03,
|
| 116 |
+
"logging_dir": "/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu/v0-20260508-164342/runs",
|
| 117 |
+
"local_rank": 0,
|
| 118 |
+
"sortish_sampler": false,
|
| 119 |
+
"predict_with_generate": false,
|
| 120 |
+
"generation_max_length": null,
|
| 121 |
+
"generation_num_beams": null,
|
| 122 |
+
"generation_config": null,
|
| 123 |
+
"tuner_backend": "peft",
|
| 124 |
+
"vit_gradient_checkpointing": false,
|
| 125 |
+
"router_aux_loss_coef": 0.0,
|
| 126 |
+
"enable_dft_loss": false,
|
| 127 |
+
"enable_channel_loss": false,
|
| 128 |
+
"safe_serialization": true,
|
| 129 |
+
"max_shard_size": "5GB",
|
| 130 |
+
"check_model": true,
|
| 131 |
+
"acc_strategy": "token",
|
| 132 |
+
"train_dataloader_shuffle": true,
|
| 133 |
+
"group_by_length": false,
|
| 134 |
+
"max_epochs": null,
|
| 135 |
+
"aligner_lr": null,
|
| 136 |
+
"vit_lr": null,
|
| 137 |
+
"use_logits_to_keep": null,
|
| 138 |
+
"ds3_gather_for_generation": true,
|
| 139 |
+
"resume_only_model": false,
|
| 140 |
+
"optimizer": null,
|
| 141 |
+
"loss_type": null,
|
| 142 |
+
"eval_metric": null,
|
| 143 |
+
"callbacks": [],
|
| 144 |
+
"early_stop_interval": null,
|
| 145 |
+
"eval_use_evalscope": false,
|
| 146 |
+
"eval_dataset": [],
|
| 147 |
+
"eval_dataset_args": null,
|
| 148 |
+
"eval_limit": null,
|
| 149 |
+
"eval_generation_config": null,
|
| 150 |
+
"extra_eval_args": null,
|
| 151 |
+
"tuner_type": "full",
|
| 152 |
+
"use_galore": false,
|
| 153 |
+
"galore_target_modules": null,
|
| 154 |
+
"galore_rank": 128,
|
| 155 |
+
"galore_update_proj_gap": 50,
|
| 156 |
+
"galore_scale": 1.0,
|
| 157 |
+
"galore_proj_type": "std",
|
| 158 |
+
"galore_optim_per_parameter": false,
|
| 159 |
+
"galore_with_embedding": false,
|
| 160 |
+
"galore_quantization": false,
|
| 161 |
+
"galore_proj_quant": false,
|
| 162 |
+
"galore_proj_bits": 4,
|
| 163 |
+
"galore_proj_group_size": 256,
|
| 164 |
+
"galore_cos_threshold": 0.4,
|
| 165 |
+
"galore_gamma_proj": 2,
|
| 166 |
+
"galore_queue_size": 5,
|
| 167 |
+
"lisa_activated_layers": 0,
|
| 168 |
+
"lisa_step_interval": 20,
|
| 169 |
+
"use_flash_ckpt": false,
|
| 170 |
+
"use_ray": false,
|
| 171 |
+
"ray_exp_name": null,
|
| 172 |
+
"device_groups": null,
|
| 173 |
+
"model": "Qwen/Qwen2.5-Coder-0.5B-Instruct",
|
| 174 |
+
"model_type": "qwen2",
|
| 175 |
+
"model_revision": null,
|
| 176 |
+
"task_type": "causal_lm",
|
| 177 |
+
"torch_dtype": "bfloat16",
|
| 178 |
+
"attn_impl": "flash_attn",
|
| 179 |
+
"experts_impl": null,
|
| 180 |
+
"new_special_tokens": [],
|
| 181 |
+
"num_labels": null,
|
| 182 |
+
"problem_type": null,
|
| 183 |
+
"rope_scaling": null,
|
| 184 |
+
"device_map": null,
|
| 185 |
+
"max_memory": {},
|
| 186 |
+
"max_model_len": null,
|
| 187 |
+
"local_repo_path": null,
|
| 188 |
+
"init_strategy": null,
|
| 189 |
+
"template": "qwen2_5",
|
| 190 |
+
"system": null,
|
| 191 |
+
"max_length": 4096,
|
| 192 |
+
"truncation_strategy": "delete",
|
| 193 |
+
"max_pixels": null,
|
| 194 |
+
"agent_template": null,
|
| 195 |
+
"norm_bbox": null,
|
| 196 |
+
"use_chat_template": true,
|
| 197 |
+
"padding_side": "right",
|
| 198 |
+
"padding_free": false,
|
| 199 |
+
"loss_scale": "default",
|
| 200 |
+
"sequence_parallel_size": 1,
|
| 201 |
+
"template_backend": "swift",
|
| 202 |
+
"response_prefix": null,
|
| 203 |
+
"enable_thinking": null,
|
| 204 |
+
"add_non_thinking_prefix": true,
|
| 205 |
+
"dataset": [
|
| 206 |
+
"/raid/data/weifeng/Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v2.jsonl"
|
| 207 |
+
],
|
| 208 |
+
"val_dataset": [],
|
| 209 |
+
"cached_dataset": [],
|
| 210 |
+
"cached_val_dataset": [],
|
| 211 |
+
"split_dataset_ratio": 0.0,
|
| 212 |
+
"dataset_num_proc": 8,
|
| 213 |
+
"load_from_cache_file": false,
|
| 214 |
+
"dataset_shuffle": true,
|
| 215 |
+
"val_dataset_shuffle": false,
|
| 216 |
+
"streaming": false,
|
| 217 |
+
"interleave_prob": null,
|
| 218 |
+
"stopping_strategy": "first_exhausted",
|
| 219 |
+
"shuffle_buffer_size": 1000,
|
| 220 |
+
"download_mode": "reuse_dataset_if_exists",
|
| 221 |
+
"columns": {},
|
| 222 |
+
"strict": false,
|
| 223 |
+
"model_name": null,
|
| 224 |
+
"model_author": null,
|
| 225 |
+
"custom_dataset_info": [],
|
| 226 |
+
"quant_method": null,
|
| 227 |
+
"quant_bits": null,
|
| 228 |
+
"hqq_axis": null,
|
| 229 |
+
"bnb_4bit_compute_dtype": "bfloat16",
|
| 230 |
+
"bnb_4bit_quant_type": "nf4",
|
| 231 |
+
"bnb_4bit_use_double_quant": true,
|
| 232 |
+
"bnb_4bit_quant_storage": null,
|
| 233 |
+
"max_new_tokens": 64,
|
| 234 |
+
"temperature": 0.0,
|
| 235 |
+
"top_k": null,
|
| 236 |
+
"top_p": null,
|
| 237 |
+
"repetition_penalty": null,
|
| 238 |
+
"num_beams": 1,
|
| 239 |
+
"stream": false,
|
| 240 |
+
"stop_words": [],
|
| 241 |
+
"logprobs": false,
|
| 242 |
+
"top_logprobs": null,
|
| 243 |
+
"structured_outputs_regex": null,
|
| 244 |
+
"adapters": [],
|
| 245 |
+
"external_plugins": [],
|
| 246 |
+
"custom_register_path": [],
|
| 247 |
+
"model_kwargs": {},
|
| 248 |
+
"load_args": false,
|
| 249 |
+
"load_data_args": false,
|
| 250 |
+
"packing": false,
|
| 251 |
+
"packing_length": null,
|
| 252 |
+
"packing_num_proc": 1,
|
| 253 |
+
"lazy_tokenize": false,
|
| 254 |
+
"use_hf": true,
|
| 255 |
+
"ignore_args_error": false,
|
| 256 |
+
"use_swift_lora": false,
|
| 257 |
+
"freeze_parameters": [],
|
| 258 |
+
"freeze_parameters_regex": null,
|
| 259 |
+
"freeze_parameters_ratio": 0.0,
|
| 260 |
+
"trainable_parameters": [],
|
| 261 |
+
"trainable_parameters_regex": null,
|
| 262 |
+
"freeze_llm": false,
|
| 263 |
+
"freeze_vit": true,
|
| 264 |
+
"freeze_aligner": true,
|
| 265 |
+
"target_modules": [
|
| 266 |
+
"all-linear"
|
| 267 |
+
],
|
| 268 |
+
"target_regex": null,
|
| 269 |
+
"target_parameters": null,
|
| 270 |
+
"modules_to_save": [],
|
| 271 |
+
"lora_rank": 8,
|
| 272 |
+
"lora_alpha": 32,
|
| 273 |
+
"lora_dropout": 0.05,
|
| 274 |
+
"lora_bias": "none",
|
| 275 |
+
"lora_dtype": null,
|
| 276 |
+
"lorap_lr_ratio": null,
|
| 277 |
+
"use_rslora": false,
|
| 278 |
+
"use_dora": false,
|
| 279 |
+
"lora_ga_batch_size": 2,
|
| 280 |
+
"lora_ga_iters": 2,
|
| 281 |
+
"lora_ga_max_length": 1024,
|
| 282 |
+
"lora_ga_direction": "ArB2r",
|
| 283 |
+
"lora_ga_scale": "stable",
|
| 284 |
+
"lora_ga_stable_gamma": 16,
|
| 285 |
+
"init_weights": true,
|
| 286 |
+
"fourier_n_frequency": 2000,
|
| 287 |
+
"fourier_scaling": 300.0,
|
| 288 |
+
"boft_block_size": 4,
|
| 289 |
+
"boft_block_num": 0,
|
| 290 |
+
"boft_n_butterfly_factor": 1,
|
| 291 |
+
"boft_dropout": 0.0,
|
| 292 |
+
"vera_rank": 256,
|
| 293 |
+
"vera_projection_prng_key": 0,
|
| 294 |
+
"vera_dropout": 0.0,
|
| 295 |
+
"vera_d_initial": 0.1,
|
| 296 |
+
"adapter_act": "gelu",
|
| 297 |
+
"adapter_length": 128,
|
| 298 |
+
"adalora_target_r": 8,
|
| 299 |
+
"adalora_init_r": 12,
|
| 300 |
+
"adalora_tinit": 0,
|
| 301 |
+
"adalora_tfinal": 0,
|
| 302 |
+
"adalora_deltaT": 1,
|
| 303 |
+
"adalora_beta1": 0.85,
|
| 304 |
+
"adalora_beta2": 0.85,
|
| 305 |
+
"adalora_orth_reg_weight": 0.5,
|
| 306 |
+
"llamapro_num_new_blocks": 4,
|
| 307 |
+
"llamapro_num_groups": null,
|
| 308 |
+
"reft_layer_key": null,
|
| 309 |
+
"reft_layers": null,
|
| 310 |
+
"reft_rank": 4,
|
| 311 |
+
"reft_intervention_type": "LoreftIntervention",
|
| 312 |
+
"reft_args": null,
|
| 313 |
+
"swanlab_token": null,
|
| 314 |
+
"swanlab_project": "ms-swift",
|
| 315 |
+
"swanlab_workspace": null,
|
| 316 |
+
"swanlab_exp_name": null,
|
| 317 |
+
"swanlab_notification_method": null,
|
| 318 |
+
"swanlab_webhook_url": null,
|
| 319 |
+
"swanlab_secret": null,
|
| 320 |
+
"swanlab_sender_email": null,
|
| 321 |
+
"swanlab_receiver_email": null,
|
| 322 |
+
"swanlab_smtp_server": null,
|
| 323 |
+
"swanlab_smtp_port": null,
|
| 324 |
+
"swanlab_email_language": "zh",
|
| 325 |
+
"swanlab_mode": "cloud",
|
| 326 |
+
"add_version": true,
|
| 327 |
+
"create_checkpoint_symlink": false,
|
| 328 |
+
"zero_hpz_partition_size": null,
|
| 329 |
+
"deepspeed_autotp_size": null,
|
| 330 |
+
"swift_version": "4.1.3",
|
| 331 |
+
"ckpt_dir": null,
|
| 332 |
+
"rank": 0,
|
| 333 |
+
"global_world_size": 1,
|
| 334 |
+
"local_world_size": 1,
|
| 335 |
+
"model_suffix": "Qwen2.5-Coder-0.5B-Instruct",
|
| 336 |
+
"model_info": "ModelInfo(model_type='qwen2', model_dir='/home/weifeng/.cache/huggingface/hub/models--Qwen--Qwen2.5-Coder-0.5B-Instruct/snapshots/ea3f2471cf1b1f0db85067f1ef93848e38e88c25', torch_dtype=torch.bfloat16, max_model_len=32768, quant_method=None, quant_bits=None, rope_scaling={'rope_theta': 1000000.0, 'rope_type': 'default'}, is_moe_model=False, is_multimodal=False, config=None, task_type='causal_lm', num_labels=None)",
|
| 337 |
+
"model_meta": "ModelMeta(model_type='qwen2', model_groups=[ModelGroup(models=[Model(ms_model_id='Qwen/Qwen1.5-0.5B-Chat', hf_model_id='Qwen/Qwen1.5-0.5B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-1.8B-Chat', hf_model_id='Qwen/Qwen1.5-1.8B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-4B-Chat', hf_model_id='Qwen/Qwen1.5-4B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-7B-Chat', hf_model_id='Qwen/Qwen1.5-7B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-14B-Chat', hf_model_id='Qwen/Qwen1.5-14B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-32B-Chat', hf_model_id='Qwen/Qwen1.5-32B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-72B-Chat', hf_model_id='Qwen/Qwen1.5-72B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-110B-Chat', hf_model_id='Qwen/Qwen1.5-110B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-0.5B', hf_model_id='Qwen/Qwen1.5-0.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-1.8B', hf_model_id='Qwen/Qwen1.5-1.8B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-4B', hf_model_id='Qwen/Qwen1.5-4B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-7B', hf_model_id='Qwen/Qwen1.5-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-14B', hf_model_id='Qwen/Qwen1.5-14B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-32B', hf_model_id='Qwen/Qwen1.5-32B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-72B', hf_model_id='Qwen/Qwen1.5-72B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-110B', hf_model_id='Qwen/Qwen1.5-110B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-0.5B-Chat-GPTQ-Int4', hf_model_id='Qwen/Qwen1.5-0.5B-Chat-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-1.8B-Chat-GPTQ-Int4', hf_model_id='Qwen/Qwen1.5-1.8B-Chat-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-4B-Chat-GPTQ-Int4', hf_model_id='Qwen/Qwen1.5-4B-Chat-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-7B-Chat-GPTQ-Int4', hf_model_id='Qwen/Qwen1.5-7B-Chat-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-14B-Chat-GPTQ-Int4', hf_model_id='Qwen/Qwen1.5-14B-Chat-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-32B-Chat-GPTQ-Int4', hf_model_id='Qwen/Qwen1.5-32B-Chat-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-72B-Chat-GPTQ-Int4', hf_model_id='Qwen/Qwen1.5-72B-Chat-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-110B-Chat-GPTQ-Int4', hf_model_id='Qwen/Qwen1.5-110B-Chat-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-0.5B-Chat-GPTQ-Int8', hf_model_id='Qwen/Qwen1.5-0.5B-Chat-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-1.8B-Chat-GPTQ-Int8', hf_model_id='Qwen/Qwen1.5-1.8B-Chat-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-4B-Chat-GPTQ-Int8', hf_model_id='Qwen/Qwen1.5-4B-Chat-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-7B-Chat-GPTQ-Int8', hf_model_id='Qwen/Qwen1.5-7B-Chat-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-14B-Chat-GPTQ-Int8', hf_model_id='Qwen/Qwen1.5-14B-Chat-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-72B-Chat-GPTQ-Int8', hf_model_id='Qwen/Qwen1.5-72B-Chat-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-0.5B-Chat-AWQ', hf_model_id='Qwen/Qwen1.5-0.5B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-1.8B-Chat-AWQ', hf_model_id='Qwen/Qwen1.5-1.8B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-4B-Chat-AWQ', hf_model_id='Qwen/Qwen1.5-4B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-7B-Chat-AWQ', hf_model_id='Qwen/Qwen1.5-7B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-14B-Chat-AWQ', hf_model_id='Qwen/Qwen1.5-14B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-32B-Chat-AWQ', hf_model_id='Qwen/Qwen1.5-32B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-72B-Chat-AWQ', hf_model_id='Qwen/Qwen1.5-72B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen1.5-110B-Chat-AWQ', hf_model_id='Qwen/Qwen1.5-110B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None)], template='qwen', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='Qwen/CodeQwen1.5-7B', hf_model_id='Qwen/CodeQwen1.5-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/CodeQwen1.5-7B-Chat', hf_model_id='Qwen/CodeQwen1.5-7B-Chat', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/CodeQwen1.5-7B-Chat-AWQ', hf_model_id='Qwen/CodeQwen1.5-7B-Chat-AWQ', model_path=None, ms_revision=None, hf_revision=None)], template='qwen', ignore_patterns=None, requires=None, tags=['coding']), ModelGroup(models=[Model(ms_model_id='Qwen/Qwen2-0.5B-Instruct', hf_model_id='Qwen/Qwen2-0.5B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-1.5B-Instruct', hf_model_id='Qwen/Qwen2-1.5B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-7B-Instruct', hf_model_id='Qwen/Qwen2-7B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-72B-Instruct', hf_model_id='Qwen/Qwen2-72B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-0.5B', hf_model_id='Qwen/Qwen2-0.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-1.5B', hf_model_id='Qwen/Qwen2-1.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-7B', hf_model_id='Qwen/Qwen2-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-72B', hf_model_id='Qwen/Qwen2-72B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-0.5B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2-0.5B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-1.5B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2-1.5B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-7B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2-7B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-72B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2-72B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-0.5B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2-0.5B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-1.5B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2-1.5B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-7B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2-7B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-72B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2-72B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-0.5B-Instruct-AWQ', hf_model_id='Qwen/Qwen2-0.5B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-1.5B-Instruct-AWQ', hf_model_id='Qwen/Qwen2-1.5B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-7B-Instruct-AWQ', hf_model_id='Qwen/Qwen2-7B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-72B-Instruct-AWQ', hf_model_id='Qwen/Qwen2-72B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None)], template='qwen', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='Qwen/Qwen2-Math-1.5B-Instruct', hf_model_id='Qwen/Qwen2-Math-1.5B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-Math-7B-Instruct', hf_model_id='Qwen/Qwen2-Math-7B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-Math-72B-Instruct', hf_model_id='Qwen/Qwen2-Math-72B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-Math-1.5B', hf_model_id='Qwen/Qwen2-Math-1.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-Math-7B', hf_model_id='Qwen/Qwen2-Math-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2-Math-72B', hf_model_id='Qwen/Qwen2-Math-72B', model_path=None, ms_revision=None, hf_revision=None)], template='qwen', ignore_patterns=None, requires=None, tags=['math']), ModelGroup(models=[Model(ms_model_id='Qwen/Qwen2.5-7B-Instruct-1M', hf_model_id='Qwen/Qwen2.5-7B-Instruct-1M', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-14B-Instruct-1M', hf_model_id='Qwen/Qwen2.5-14B-Instruct-1M', model_path=None, ms_revision=None, hf_revision=None)], template='qwen', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='PowerInfer/SmallThinker-3B-Preview', hf_model_id='PowerInfer/SmallThinker-3B-Preview', model_path=None, ms_revision=None, hf_revision=None)], template='qwen', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='Qwen/Qwen2.5-0.5B-Instruct', hf_model_id='Qwen/Qwen2.5-0.5B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-1.5B-Instruct', hf_model_id='Qwen/Qwen2.5-1.5B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-3B-Instruct', hf_model_id='Qwen/Qwen2.5-3B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-7B-Instruct', hf_model_id='Qwen/Qwen2.5-7B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-14B-Instruct', hf_model_id='Qwen/Qwen2.5-14B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-32B-Instruct', hf_model_id='Qwen/Qwen2.5-32B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-72B-Instruct', hf_model_id='Qwen/Qwen2.5-72B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-0.5B', hf_model_id='Qwen/Qwen2.5-0.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-1.5B', hf_model_id='Qwen/Qwen2.5-1.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-3B', hf_model_id='Qwen/Qwen2.5-3B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-7B', hf_model_id='Qwen/Qwen2.5-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-14B', hf_model_id='Qwen/Qwen2.5-14B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-32B', hf_model_id='Qwen/Qwen2.5-32B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-72B', hf_model_id='Qwen/Qwen2.5-72B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-0.5B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-0.5B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-1.5B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-1.5B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-3B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-3B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-7B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-7B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-14B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-14B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-32B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-32B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-72B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-72B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-0.5B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-0.5B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-1.5B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-1.5B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-3B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-3B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-7B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-7B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-14B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-14B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-32B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-32B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-72B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-72B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-0.5B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-0.5B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-1.5B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-1.5B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-3B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-3B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-7B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-7B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-14B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-14B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-32B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-32B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-72B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-72B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None)], template='qwen2_5', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='Qwen/Qwen2.5-Coder-0.5B-Instruct', hf_model_id='Qwen/Qwen2.5-Coder-0.5B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-1.5B-Instruct', hf_model_id='Qwen/Qwen2.5-Coder-1.5B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-3B-Instruct', hf_model_id='Qwen/Qwen2.5-Coder-3B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-7B-Instruct', hf_model_id='Qwen/Qwen2.5-Coder-7B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-14B-Instruct', hf_model_id='Qwen/Qwen2.5-Coder-14B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-32B-Instruct', hf_model_id='Qwen/Qwen2.5-Coder-32B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-0.5B', hf_model_id='Qwen/Qwen2.5-Coder-0.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-1.5B', hf_model_id='Qwen/Qwen2.5-Coder-1.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-3B', hf_model_id='Qwen/Qwen2.5-Coder-3B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-7B', hf_model_id='Qwen/Qwen2.5-Coder-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-14B', hf_model_id='Qwen/Qwen2.5-Coder-14B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-32B', hf_model_id='Qwen/Qwen2.5-Coder-32B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-0.5B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-Coder-0.5B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-1.5B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-Coder-1.5B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-3B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-Coder-3B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-7B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-Coder-7B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-14B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-Coder-14B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-32B-Instruct-AWQ', hf_model_id='Qwen/Qwen2.5-Coder-32B-Instruct-AWQ', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-0.5B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-Coder-0.5B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-0.5B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-Coder-0.5B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-1.5B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-Coder-1.5B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-1.5B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-Coder-1.5B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-3B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-Coder-3B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-3B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-Coder-3B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-7B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-Coder-7B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-7B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-Coder-7B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-14B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-Coder-14B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-14B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-Coder-14B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-32B-Instruct-GPTQ-Int4', hf_model_id='Qwen/Qwen2.5-Coder-32B-Instruct-GPTQ-Int4', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Coder-32B-Instruct-GPTQ-Int8', hf_model_id='Qwen/Qwen2.5-Coder-32B-Instruct-GPTQ-Int8', model_path=None, ms_revision=None, hf_revision=None)], template='qwen2_5', ignore_patterns=None, requires=None, tags=['coding']), ModelGroup(models=[Model(ms_model_id='moonshotai/Kimi-Dev-72B', hf_model_id='moonshotai/Kimi-Dev-72B', model_path=None, ms_revision=None, hf_revision=None)], template='qwen2_5', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='Qwen/Qwen2.5-Math-1.5B-Instruct', hf_model_id='Qwen/Qwen2.5-Math-1.5B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Math-7B-Instruct', hf_model_id='Qwen/Qwen2.5-Math-7B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Math-72B-Instruct', hf_model_id='Qwen/Qwen2.5-Math-72B-Instruct', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Math-1.5B', hf_model_id='Qwen/Qwen2.5-Math-1.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Math-7B', hf_model_id='Qwen/Qwen2.5-Math-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/Qwen2.5-Math-72B', hf_model_id='Qwen/Qwen2.5-Math-72B', model_path=None, ms_revision=None, hf_revision=None)], template='qwen2_5_math', ignore_patterns=None, requires=None, tags=['math']), ModelGroup(models=[Model(ms_model_id='AIDC-AI/Marco-o1', hf_model_id='AIDC-AI/Marco-o1', model_path=None, ms_revision=None, hf_revision=None)], template='marco_o1', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='Qwen/QwQ-32B-Preview', hf_model_id='Qwen/QwQ-32B-Preview', model_path=None, ms_revision=None, hf_revision=None)], template='qwq_preview', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='Qwen/QwQ-32B', hf_model_id='Qwen/QwQ-32B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='Qwen/QwQ-32B-AWQ', hf_model_id='Qwen/QwQ-32B-AWQ', model_path=None, ms_revision=None, hf_revision=None)], template='qwq', ignore_patterns=None, requires=None, tags=[]), ModelGroup(models=[Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-7B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-7B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-14B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-14B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-32B', hf_model_id='deepseek-ai/DeepSeek-R1-Distill-Qwen-32B', model_path=None, ms_revision=None, hf_revision=None), Model(ms_model_id='iic/QwenLong-L1-32B', hf_model_id='Tongyi-Zhiwen/QwenLong-L1-32B', model_path=None, ms_revision=None, hf_revision=None)], template='deepseek_r1', ignore_patterns=None, requires=None, tags=[])], loader=<class 'swift.model.register.ModelLoader'>, template='qwen2_5', model_arch=ModelKeys(arch_name='llama', embedding='model.embed_tokens', module_list='model.layers', lm_head='lm_head', q_proj='model.layers.{}.self_attn.q_proj', k_proj='model.layers.{}.self_attn.k_proj', v_proj='model.layers.{}.self_attn.v_proj', o_proj='model.layers.{}.self_attn.o_proj', attention='model.layers.{}.self_attn', mlp='model.layers.{}.mlp', down_proj='model.layers.{}.mlp.down_proj', qkv_proj=None, qk_proj=None, qa_proj=None, qb_proj=None, kv_proj=None, kva_proj=None, kvb_proj=None), mcore_model_type=None, architectures=['Qwen2ForCausalLM'], additional_saved_files=[], torch_dtype=None, is_multimodal=False, is_reward=False, task_type=None, ignore_patterns=None, requires=['transformers>=4.37'], tags=['coding'])",
|
| 338 |
+
"model_dir": "/home/weifeng/.cache/huggingface/hub/models--Qwen--Qwen2.5-Coder-0.5B-Instruct/snapshots/ea3f2471cf1b1f0db85067f1ef93848e38e88c25",
|
| 339 |
+
"template_meta": "Qwen2_5TemplateMeta(template_type='qwen2_5', prefix=[], prompt=['<|im_start|>user\\n{{QUERY}}<|im_end|>\\n<|im_start|>assistant\\n'], chat_sep=['<|im_end|>\\n'], suffix=['<|im_end|>\\n'], template_cls=<class 'swift.template.base.Template'>, system_prefix=['<|im_start|>system\\n{{SYSTEM}}<|im_end|>\\n'], default_system='You are Qwen, created by Alibaba Cloud. You are a helpful assistant.', auto_add_bos=False, stop_words=['<|endoftext|>'], agent_template='hermes', is_thinking=False, thinking_prefix='', non_thinking_prefix='', history_thinking_prefix='')",
|
| 340 |
+
"_val_dataset_exists": false,
|
| 341 |
+
"hub": "<class 'swift.hub.hub.HFHub'>",
|
| 342 |
+
"evaluation_strategy": "steps",
|
| 343 |
+
"training_args": "Seq2SeqTrainingArguments(output_dir='/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu/v0-20260508-164342', per_device_train_batch_size=4, num_train_epochs=1.0, max_steps=-1, learning_rate=2e-05, lr_scheduler_type=<SchedulerType.COSINE: 'cosine'>, lr_scheduler_kwargs=None, warmup_steps=0.03, optim=<OptimizerNames.ADAMW_TORCH_FUSED: 'adamw_torch_fused'>, optim_args=None, weight_decay=0.1, adam_beta1=0.9, adam_beta2=0.95, adam_epsilon=1e-08, optim_target_modules=None, gradient_accumulation_steps=8, average_tokens_across_devices=None, max_grad_norm=1.0, label_smoothing_factor=0.0, bf16=True, fp16=False, bf16_full_eval=False, fp16_full_eval=False, tf32=None, gradient_checkpointing=True, gradient_checkpointing_kwargs=None, torch_compile=False, torch_compile_backend=None, torch_compile_mode=None, use_liger_kernel=False, liger_kernel_config=None, use_cache=False, neftune_noise_alpha=None, torch_empty_cache_steps=None, auto_find_batch_size=False, logging_strategy=<IntervalStrategy.STEPS: 'steps'>, logging_steps=10, logging_first_step=True, log_on_each_node=True, logging_nan_inf_filter=True, include_num_input_tokens_seen=None, log_level='passive', log_level_replica='warning', disable_tqdm=False, report_to=['tensorboard'], run_name='/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu/v0-20260508-164342', project='huggingface', trackio_space_id=None, trackio_bucket_id=None, trackio_static_space_id=None, eval_strategy=<IntervalStrategy.NO: 'no'>, eval_steps=500.0, eval_delay=0, per_device_eval_batch_size=1, prediction_loss_only=False, eval_on_start=False, eval_do_concat_batches=True, eval_use_gather_object=False, eval_accumulation_steps=None, include_for_metrics=[], batch_eval_metrics=False, save_only_model=False, save_strategy=<SaveStrategy.STEPS: 'steps'>, save_steps=500, save_on_each_node=False, save_total_limit=5, enable_jit_checkpoint=False, push_to_hub=False, hub_token=None, hub_private_repo=None, hub_model_id=None, hub_strategy=<HubStrategy.EVERY_SAVE: 'every_save'>, hub_always_push=False, hub_revision=None, load_best_model_at_end=False, metric_for_best_model='loss', greater_is_better=False, ignore_data_skip=False, restore_callback_states_from_checkpoint=False, full_determinism=False, seed=42, data_seed=42, use_cpu=False, accelerator_config=AcceleratorConfig(split_batches=False, dispatch_batches=False, even_batches=True, use_seedable_sampler=True, non_blocking=False, gradient_accumulation_kwargs=None, use_configured_state=False), parallelism_config=None, dataloader_drop_last=False, dataloader_num_workers=8, dataloader_pin_memory=True, dataloader_persistent_workers=False, dataloader_prefetch_factor=2, remove_unused_columns=False, label_names=None, train_sampling_strategy='random', length_column_name='length', ddp_find_unused_parameters=None, ddp_bucket_cap_mb=None, ddp_broadcast_buffers=None, ddp_static_graph=None, ddp_backend=None, ddp_timeout=18000000, fsdp=[], fsdp_config={'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}, deepspeed=None, debug=[], skip_memory_metrics=True, do_train=False, do_eval=False, do_predict=False, resume_from_checkpoint=None, warmup_ratio=0.03, logging_dir='/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu/v0-20260508-164342/runs', local_rank=0, sortish_sampler=False, predict_with_generate=False, generation_max_length=None, generation_num_beams=None, generation_config=None, tuner_backend='peft', vit_gradient_checkpointing=False, router_aux_loss_coef=0.0, enable_dft_loss=False, enable_channel_loss=False, safe_serialization=True, max_shard_size='5GB', check_model=True, acc_strategy='token', train_dataloader_shuffle=True, group_by_length=False, max_epochs=None, aligner_lr=None, vit_lr=None, use_logits_to_keep=None, ds3_gather_for_generation=True, resume_only_model=False, optimizer=None, loss_type=None, eval_metric=None, callbacks=[], early_stop_interval=None, eval_use_evalscope=False, eval_dataset=[], eval_dataset_args=None, eval_limit=None, eval_generation_config=None, extra_eval_args=None, tuner_type='full', use_galore=False, galore_target_modules=None, galore_rank=128, galore_update_proj_gap=50, galore_scale=1.0, galore_proj_type='std', galore_optim_per_parameter=False, galore_with_embedding=False, galore_quantization=False, galore_proj_quant=False, galore_proj_bits=4, galore_proj_group_size=256, galore_cos_threshold=0.4, galore_gamma_proj=2, galore_queue_size=5, lisa_activated_layers=0, lisa_step_interval=20, use_flash_ckpt=False)"
|
| 344 |
+
}
|
models/sft/sft_f3_refined_instruct/chat_template.jinja
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if tools %}
|
| 2 |
+
{{- '<|im_start|>system\n' }}
|
| 3 |
+
{%- if messages[0]['role'] == 'system' %}
|
| 4 |
+
{{- messages[0]['content'] }}
|
| 5 |
+
{%- else %}
|
| 6 |
+
{{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
|
| 7 |
+
{%- endif %}
|
| 8 |
+
{{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
| 9 |
+
{%- for tool in tools %}
|
| 10 |
+
{{- "\n" }}
|
| 11 |
+
{{- tool | tojson }}
|
| 12 |
+
{%- endfor %}
|
| 13 |
+
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
| 14 |
+
{%- else %}
|
| 15 |
+
{%- if messages[0]['role'] == 'system' %}
|
| 16 |
+
{{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
|
| 17 |
+
{%- else %}
|
| 18 |
+
{{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
|
| 19 |
+
{%- endif %}
|
| 20 |
+
{%- endif %}
|
| 21 |
+
{%- for message in messages %}
|
| 22 |
+
{%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
|
| 23 |
+
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
| 24 |
+
{%- elif message.role == "assistant" %}
|
| 25 |
+
{{- '<|im_start|>' + message.role }}
|
| 26 |
+
{%- if message.content %}
|
| 27 |
+
{{- '\n' + message.content }}
|
| 28 |
+
{%- endif %}
|
| 29 |
+
{%- for tool_call in message.tool_calls %}
|
| 30 |
+
{%- if tool_call.function is defined %}
|
| 31 |
+
{%- set tool_call = tool_call.function %}
|
| 32 |
+
{%- endif %}
|
| 33 |
+
{{- '\n<tool_call>\n{"name": "' }}
|
| 34 |
+
{{- tool_call.name }}
|
| 35 |
+
{{- '", "arguments": ' }}
|
| 36 |
+
{{- tool_call.arguments | tojson }}
|
| 37 |
+
{{- '}\n</tool_call>' }}
|
| 38 |
+
{%- endfor %}
|
| 39 |
+
{{- '<|im_end|>\n' }}
|
| 40 |
+
{%- elif message.role == "tool" %}
|
| 41 |
+
{%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
|
| 42 |
+
{{- '<|im_start|>user' }}
|
| 43 |
+
{%- endif %}
|
| 44 |
+
{{- '\n<tool_response>\n' }}
|
| 45 |
+
{{- message.content }}
|
| 46 |
+
{{- '\n</tool_response>' }}
|
| 47 |
+
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 48 |
+
{{- '<|im_end|>\n' }}
|
| 49 |
+
{%- endif %}
|
| 50 |
+
{%- endif %}
|
| 51 |
+
{%- endfor %}
|
| 52 |
+
{%- if add_generation_prompt %}
|
| 53 |
+
{{- '<|im_start|>assistant\n' }}
|
| 54 |
+
{%- endif %}
|
models/sft/sft_f3_refined_instruct/config.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen2ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_dropout": 0.0,
|
| 6 |
+
"bos_token_id": null,
|
| 7 |
+
"dtype": "bfloat16",
|
| 8 |
+
"eos_token_id": 151645,
|
| 9 |
+
"hidden_act": "silu",
|
| 10 |
+
"hidden_size": 896,
|
| 11 |
+
"initializer_range": 0.02,
|
| 12 |
+
"intermediate_size": 4864,
|
| 13 |
+
"layer_types": [
|
| 14 |
+
"full_attention",
|
| 15 |
+
"full_attention",
|
| 16 |
+
"full_attention",
|
| 17 |
+
"full_attention",
|
| 18 |
+
"full_attention",
|
| 19 |
+
"full_attention",
|
| 20 |
+
"full_attention",
|
| 21 |
+
"full_attention",
|
| 22 |
+
"full_attention",
|
| 23 |
+
"full_attention",
|
| 24 |
+
"full_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"full_attention",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"full_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"full_attention",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"full_attention"
|
| 38 |
+
],
|
| 39 |
+
"max_position_embeddings": 32768,
|
| 40 |
+
"max_window_layers": 24,
|
| 41 |
+
"model_type": "qwen2",
|
| 42 |
+
"num_attention_heads": 14,
|
| 43 |
+
"num_hidden_layers": 24,
|
| 44 |
+
"num_key_value_heads": 2,
|
| 45 |
+
"pad_token_id": 151643,
|
| 46 |
+
"rms_norm_eps": 1e-06,
|
| 47 |
+
"rope_parameters": {
|
| 48 |
+
"rope_theta": 1000000.0,
|
| 49 |
+
"rope_type": "default"
|
| 50 |
+
},
|
| 51 |
+
"sliding_window": null,
|
| 52 |
+
"tie_word_embeddings": true,
|
| 53 |
+
"transformers_version": "5.6.2",
|
| 54 |
+
"use_cache": false,
|
| 55 |
+
"use_sliding_window": false,
|
| 56 |
+
"vocab_size": 151936
|
| 57 |
+
}
|
models/sft/sft_f3_refined_instruct/generation_config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 151643,
|
| 3 |
+
"do_sample": true,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
151645,
|
| 6 |
+
151643
|
| 7 |
+
],
|
| 8 |
+
"pad_token_id": 151643,
|
| 9 |
+
"repetition_penalty": 1.05,
|
| 10 |
+
"temperature": 0.7,
|
| 11 |
+
"top_k": 20,
|
| 12 |
+
"top_p": 0.8,
|
| 13 |
+
"transformers_version": "5.6.2"
|
| 14 |
+
}
|
models/sft/sft_f3_refined_instruct/tokenizer_config.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": null,
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "<|im_end|>",
|
| 7 |
+
"errors": "replace",
|
| 8 |
+
"extra_special_tokens": [
|
| 9 |
+
"<|im_start|>",
|
| 10 |
+
"<|im_end|>",
|
| 11 |
+
"<|object_ref_start|>",
|
| 12 |
+
"<|object_ref_end|>",
|
| 13 |
+
"<|box_start|>",
|
| 14 |
+
"<|box_end|>",
|
| 15 |
+
"<|quad_start|>",
|
| 16 |
+
"<|quad_end|>",
|
| 17 |
+
"<|vision_start|>",
|
| 18 |
+
"<|vision_end|>",
|
| 19 |
+
"<|vision_pad|>",
|
| 20 |
+
"<|image_pad|>",
|
| 21 |
+
"<|video_pad|>"
|
| 22 |
+
],
|
| 23 |
+
"is_local": true,
|
| 24 |
+
"local_files_only": false,
|
| 25 |
+
"model_max_length": 32768,
|
| 26 |
+
"pad_token": "<|endoftext|>",
|
| 27 |
+
"split_special_tokens": false,
|
| 28 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 29 |
+
"unk_token": null
|
| 30 |
+
}
|
models/sft/sft_f3_refined_instruct/trainer_state.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tools/build_manifest.py
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Generate a provenance manifest and SHA256SUMS for this delivery directory."""
|
| 3 |
+
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import hashlib
|
| 7 |
+
import json
|
| 8 |
+
import os
|
| 9 |
+
from datetime import datetime, timezone
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 14 |
+
WORKSPACE = Path(os.environ.get("DELIVERY_SOURCE_ROOT", "/raid/data/weifeng"))
|
| 15 |
+
|
| 16 |
+
SOURCE_PREFIXES = {
|
| 17 |
+
"models/pretrained/stage1_cpt": WORKSPACE / "Pre_train/output_user/qwen25_coder_0p5b_curriculum_filtered_stage1/v1-20260514-232114/checkpoint-28175",
|
| 18 |
+
"models/sft/sft_f3_refined_instruct": WORKSPACE / "Pre_train/output_user/qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu/v0-20260508-164342/checkpoint-6435",
|
| 19 |
+
"code/f3_filtering": WORKSPACE / "Datasets/Instruction-turning/F3_v2_pipeline",
|
| 20 |
+
"code/pretrain_data_prep": WORKSPACE / "Datasets",
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
SOURCE_FILES = {
|
| 24 |
+
"data/pretrain/code_messages_pre_train_filtered_stage1.jsonl": WORKSPACE / "Datasets/code_messages_pre_train_filtered_stage1.jsonl",
|
| 25 |
+
"data/f3/input/scicode_sft_swift_F3_clean.jsonl": WORKSPACE / "Datasets/Instruction-turning/scicode_sft_swift_F3_clean.jsonl",
|
| 26 |
+
"data/f3/intermediate/F3_stage1.jsonl": WORKSPACE / "Datasets/Instruction-turning/F3_v2_pipeline/F3_stage1.jsonl",
|
| 27 |
+
"data/f3/intermediate/F3_stage2.jsonl": WORKSPACE / "Datasets/Instruction-turning/F3_v2_pipeline/F3_stage2.jsonl",
|
| 28 |
+
"data/f3/intermediate/F3_stage3.jsonl": WORKSPACE / "Datasets/Instruction-turning/F3_v2_pipeline/F3_stage3.jsonl",
|
| 29 |
+
"data/f3/intermediate/F3_stage4_scores.jsonl": WORKSPACE / "Datasets/Instruction-turning/F3_v2_pipeline/F3_stage4_scores.jsonl",
|
| 30 |
+
"data/f3/intermediate/F3_stage4_calibration_scores.jsonl": WORKSPACE / "Datasets/Instruction-turning/F3_v2_pipeline/F3_stage4_calibration_scores.jsonl",
|
| 31 |
+
"data/f3/output/scicode_sft_swift_F3_clean_v2.jsonl": WORKSPACE / "Datasets/Instruction-turning/scicode_sft_swift_F3_clean_v2.jsonl",
|
| 32 |
+
"training_scripts/pretrain/stage1_short.sh": WORKSPACE / "Pre_train/swift_runs_curriculum_filtered_0p5b/stage1_short.sh",
|
| 33 |
+
"training_scripts/sft/run_qwen25_coder_0p5b_instruct_F3_v2_1gpu.sh": WORKSPACE / "Pre_train/swift_runs_F3_v2_0p5b_instruct/run_qwen25_coder_0p5b_instruct_F3_v2_1gpu.sh",
|
| 34 |
+
"evidence/eval/f3_refined_9p1_summary.json": WORKSPACE / "DELIVERY_0p5B_CPT_SFT/eval/summaries/summary_hf__raid_data_weifeng_Pre_train_output_user_qwen25_coder_0p5b_instruct_F3_v2_1epoch_1gpu_v0-20260508-164342_checkpoint-6435_20260508_191037.json",
|
| 35 |
+
"evidence/instruction_recipe_results.md": WORKSPACE / "DELIVERY_0p5B_CPT_SFT/reports/instruction_recipe_results.md",
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def source_for(relative: str) -> Path | None:
|
| 40 |
+
if relative in SOURCE_FILES:
|
| 41 |
+
return SOURCE_FILES[relative]
|
| 42 |
+
# Reports were grouped into a delivery-only ``reports/`` directory. In
|
| 43 |
+
# the historical source trees they live beside the corresponding scripts.
|
| 44 |
+
if relative.startswith("code/f3_filtering/reports/"):
|
| 45 |
+
return (
|
| 46 |
+
WORKSPACE
|
| 47 |
+
/ "Datasets/Instruction-turning/F3_v2_pipeline"
|
| 48 |
+
/ Path(relative).name
|
| 49 |
+
)
|
| 50 |
+
if relative.startswith("code/pretrain_data_prep/reports/"):
|
| 51 |
+
return WORKSPACE / "Datasets" / Path(relative).name
|
| 52 |
+
for prefix, source_root in sorted(SOURCE_PREFIXES.items(), key=lambda item: -len(item[0])):
|
| 53 |
+
if relative == prefix or relative.startswith(prefix + "/"):
|
| 54 |
+
return source_root / Path(relative).relative_to(prefix)
|
| 55 |
+
return None
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def hash_and_count(path: Path) -> tuple[str, int | None]:
|
| 59 |
+
digest = hashlib.sha256()
|
| 60 |
+
lines = 0 if path.suffix == ".jsonl" else None
|
| 61 |
+
with path.open("rb") as handle:
|
| 62 |
+
while chunk := handle.read(8 * 1024 * 1024):
|
| 63 |
+
digest.update(chunk)
|
| 64 |
+
if lines is not None:
|
| 65 |
+
lines += chunk.count(b"\n")
|
| 66 |
+
return digest.hexdigest(), lines
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def role_for(relative: str) -> str:
|
| 70 |
+
return relative.split("/", 1)[0]
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def main() -> None:
|
| 74 |
+
excluded = {"MANIFEST.json", "SHA256SUMS"}
|
| 75 |
+
paths = sorted(
|
| 76 |
+
path for path in ROOT.rglob("*")
|
| 77 |
+
if path.is_file() and path.relative_to(ROOT).as_posix() not in excluded
|
| 78 |
+
)
|
| 79 |
+
files = []
|
| 80 |
+
copied_bytes = 0
|
| 81 |
+
hardlinked_bytes = 0
|
| 82 |
+
|
| 83 |
+
for path in paths:
|
| 84 |
+
relative = path.relative_to(ROOT).as_posix()
|
| 85 |
+
source = source_for(relative)
|
| 86 |
+
sha256, records = hash_and_count(path)
|
| 87 |
+
mode = "authored"
|
| 88 |
+
source_sha256_matches = None
|
| 89 |
+
if source is not None:
|
| 90 |
+
if not source.is_file():
|
| 91 |
+
raise FileNotFoundError(f"missing provenance source: {source}")
|
| 92 |
+
same_inode = os.path.samefile(path, source)
|
| 93 |
+
mode = "hardlink" if same_inode else "copy"
|
| 94 |
+
source_sha256, _ = hash_and_count(source) if not same_inode else (sha256, None)
|
| 95 |
+
source_sha256_matches = source_sha256 == sha256
|
| 96 |
+
if not source_sha256_matches:
|
| 97 |
+
raise RuntimeError(f"delivery/source mismatch: {relative}")
|
| 98 |
+
|
| 99 |
+
size = path.stat().st_size
|
| 100 |
+
if mode == "hardlink":
|
| 101 |
+
hardlinked_bytes += size
|
| 102 |
+
else:
|
| 103 |
+
copied_bytes += size
|
| 104 |
+
record = {
|
| 105 |
+
"path": relative,
|
| 106 |
+
"role": role_for(relative),
|
| 107 |
+
"bytes": size,
|
| 108 |
+
"sha256": sha256,
|
| 109 |
+
"mode": mode,
|
| 110 |
+
"source": str(source) if source is not None else None,
|
| 111 |
+
"source_sha256_matches": source_sha256_matches,
|
| 112 |
+
}
|
| 113 |
+
if records is not None:
|
| 114 |
+
record["records"] = records
|
| 115 |
+
files.append(record)
|
| 116 |
+
|
| 117 |
+
manifest = {
|
| 118 |
+
"schema_version": "delivery-0p5b-pretrain-f3refine-v1",
|
| 119 |
+
"generated_utc": datetime.now(timezone.utc).isoformat(timespec="seconds"),
|
| 120 |
+
"delivery_root": str(ROOT),
|
| 121 |
+
"headline": {
|
| 122 |
+
"pretrained_model": "models/pretrained/stage1_cpt",
|
| 123 |
+
"instruction_tuned_model": "models/sft/sft_f3_refined_instruct",
|
| 124 |
+
"reported_pass_at_1_pct": 9.1,
|
| 125 |
+
"reported_pass_at_5_pct": 13.0,
|
| 126 |
+
"evaluation": "Runnable alignment benchmark; 200 tasks; 5 samples/task; 1000 attempts",
|
| 127 |
+
},
|
| 128 |
+
"exclusions": [
|
| 129 |
+
"optimizer.pt, scheduler.pt, rng_state.pth and training_args.bin are not included",
|
| 130 |
+
"upstream Qwen base/instruct checkpoints are not included",
|
| 131 |
+
"the exact May training environment snapshot was not captured",
|
| 132 |
+
],
|
| 133 |
+
"storage": {
|
| 134 |
+
"hardlinked_bytes": hardlinked_bytes,
|
| 135 |
+
"copied_or_authored_bytes": copied_bytes,
|
| 136 |
+
"note": "Hard links save local disk; tar/zip/upload reads complete file bytes.",
|
| 137 |
+
},
|
| 138 |
+
"file_count": len(files),
|
| 139 |
+
"files": files,
|
| 140 |
+
}
|
| 141 |
+
manifest_path = ROOT / "MANIFEST.json"
|
| 142 |
+
manifest_path.write_text(json.dumps(manifest, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
|
| 143 |
+
|
| 144 |
+
checksum_paths = sorted(path for path in ROOT.rglob("*") if path.is_file() and path.name != "SHA256SUMS")
|
| 145 |
+
checksum_lines = []
|
| 146 |
+
for path in checksum_paths:
|
| 147 |
+
digest, _ = hash_and_count(path)
|
| 148 |
+
checksum_lines.append(f"{digest} {path.relative_to(ROOT).as_posix()}")
|
| 149 |
+
(ROOT / "SHA256SUMS").write_text("\n".join(checksum_lines) + "\n", encoding="utf-8")
|
| 150 |
+
|
| 151 |
+
print(json.dumps({
|
| 152 |
+
"root": str(ROOT),
|
| 153 |
+
"files": len(files),
|
| 154 |
+
"hardlinked_bytes": hardlinked_bytes,
|
| 155 |
+
"copied_or_authored_bytes": copied_bytes,
|
| 156 |
+
}, ensure_ascii=False))
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
if __name__ == "__main__":
|
| 160 |
+
main()
|
tools/smoke_test.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Load each delivered checkpoint on CPU and verify finite logits."""
|
| 3 |
+
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import json
|
| 7 |
+
import os
|
| 8 |
+
import sys
|
| 9 |
+
import traceback
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
THREADS = "4"
|
| 14 |
+
for variable in (
|
| 15 |
+
"OMP_NUM_THREADS",
|
| 16 |
+
"MKL_NUM_THREADS",
|
| 17 |
+
"OPENBLAS_NUM_THREADS",
|
| 18 |
+
"NUMEXPR_NUM_THREADS",
|
| 19 |
+
"VECLIB_MAXIMUM_THREADS",
|
| 20 |
+
"BLIS_NUM_THREADS",
|
| 21 |
+
):
|
| 22 |
+
os.environ.setdefault(variable, THREADS)
|
| 23 |
+
os.environ.setdefault("CUDA_VISIBLE_DEVICES", "")
|
| 24 |
+
|
| 25 |
+
import torch # noqa: E402
|
| 26 |
+
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer # noqa: E402
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 30 |
+
PROMPT = 'def rmsd(a, b):\n """Root-mean-square deviation."""\n'
|
| 31 |
+
TARGETS = {
|
| 32 |
+
"pretrained/stage1_cpt": ROOT / "models/pretrained/stage1_cpt",
|
| 33 |
+
"sft/sft_f3_refined_instruct": ROOT / "models/sft/sft_f3_refined_instruct",
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def check(name: str, path: Path) -> dict:
|
| 38 |
+
result = {"model": name, "path": str(path.relative_to(ROOT)), "ok": False}
|
| 39 |
+
try:
|
| 40 |
+
config = AutoConfig.from_pretrained(path)
|
| 41 |
+
result.update(
|
| 42 |
+
architecture=(config.architectures or [type(config).__name__])[0],
|
| 43 |
+
hidden_size=getattr(config, "hidden_size", None),
|
| 44 |
+
layers=getattr(config, "num_hidden_layers", None),
|
| 45 |
+
vocab_size=getattr(config, "vocab_size", None),
|
| 46 |
+
)
|
| 47 |
+
tokenizer = AutoTokenizer.from_pretrained(path)
|
| 48 |
+
model = AutoModelForCausalLM.from_pretrained(path, dtype=torch.float32)
|
| 49 |
+
model.eval()
|
| 50 |
+
inputs = tokenizer(PROMPT, return_tensors="pt")
|
| 51 |
+
with torch.no_grad():
|
| 52 |
+
logits = model(**inputs).logits
|
| 53 |
+
last = logits[0, -1].float()
|
| 54 |
+
result.update(
|
| 55 |
+
tokenizer=type(tokenizer).__name__,
|
| 56 |
+
parameters_million=round(sum(p.numel() for p in model.parameters()) / 1e6, 1),
|
| 57 |
+
logits_shape=list(logits.shape),
|
| 58 |
+
finite=bool(torch.isfinite(logits).all()),
|
| 59 |
+
top1_zscore=round(((last.max() - last.mean()) / last.std()).item(), 2),
|
| 60 |
+
)
|
| 61 |
+
result["ok"] = result["finite"] and result["top1_zscore"] > 3.0
|
| 62 |
+
del model
|
| 63 |
+
except Exception as error: # noqa: BLE001
|
| 64 |
+
result["error"] = f"{type(error).__name__}: {error}"
|
| 65 |
+
result["traceback"] = traceback.format_exc(limit=3)
|
| 66 |
+
return result
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def main() -> int:
|
| 70 |
+
torch.set_num_threads(int(THREADS))
|
| 71 |
+
results = [check(name, path) for name, path in TARGETS.items()]
|
| 72 |
+
output = ROOT / "evidence/smoke_test_results.json"
|
| 73 |
+
output.write_text(json.dumps(results, indent=2, ensure_ascii=False) + "\n", encoding="utf-8")
|
| 74 |
+
for result in results:
|
| 75 |
+
status = "PASS" if result["ok"] else "FAIL"
|
| 76 |
+
detail = f"{result.get('parameters_million', '?')}M, z={result.get('top1_zscore', '?')}"
|
| 77 |
+
print(f"{status}: {result['model']} ({detail})")
|
| 78 |
+
passed = sum(result["ok"] for result in results)
|
| 79 |
+
print(f"{passed}/{len(results)} checkpoints passed; results: {output}")
|
| 80 |
+
return 0 if passed == len(results) else 1
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
if __name__ == "__main__":
|
| 84 |
+
sys.exit(main())
|
training_scripts/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Historical Training Scripts
|
| 2 |
+
|
| 3 |
+
This directory contains the original launch scripts for the two principal training runs.
|
| 4 |
+
Machine-specific absolute paths have intentionally not been rewritten.
|
| 5 |
+
|
| 6 |
+
- `pretrain/stage1_short.sh`: Stage-1 short-sequence continued pre-training.
|
| 7 |
+
- `sft/run_qwen25_coder_0p5b_instruct_F3_v2_1gpu.sh`: full-parameter F3-refined SFT.
|
| 8 |
+
|
| 9 |
+
Before rerunning either script, review `CUDA_VISIBLE_DEVICES`, `DATASET`, `OUTPUT_DIR`, cache
|
| 10 |
+
directories, ports, and the FlashAttention/ms-swift environment. Use each checkpoint's
|
| 11 |
+
`args.json` to verify the effective parameters item by item.
|
training_scripts/pretrain/stage1_short.sh
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
# Curriculum Stage 1 (short, token <= 1024)
|
| 5 |
+
# Start: Qwen2.5-Coder-0.5B (base)
|
| 6 |
+
# Data: 902,115 samples
|
| 7 |
+
# lr: 5e-5, cosine
|
| 8 |
+
|
| 9 |
+
export CUDA_VISIBLE_DEVICES=3
|
| 10 |
+
export NPROC_PER_NODE=1
|
| 11 |
+
export NNODES=1
|
| 12 |
+
export NODE_RANK=0
|
| 13 |
+
export MASTER_ADDR=127.0.0.1
|
| 14 |
+
export MASTER_PORT=29540
|
| 15 |
+
|
| 16 |
+
export USE_HF=1
|
| 17 |
+
export HF_HOME=/home/weifeng/.cache/huggingface
|
| 18 |
+
export HUGGINGFACE_HUB_CACHE=/home/weifeng/.cache/huggingface/hub
|
| 19 |
+
export TRANSFORMERS_CACHE=/home/weifeng/.cache/huggingface/transformers
|
| 20 |
+
export MODELSCOPE_CACHE=/home/weifeng/.cache/modelscope
|
| 21 |
+
|
| 22 |
+
mkdir -p "${HF_HOME}" "${HUGGINGFACE_HUB_CACHE}" "${TRANSFORMERS_CACHE}" "${MODELSCOPE_CACHE}"
|
| 23 |
+
|
| 24 |
+
DATASET="/raid/data/weifeng/Datasets/code_messages_pre_train_filtered_stage1.jsonl"
|
| 25 |
+
OUTPUT_DIR="/raid/data/weifeng/Pre_train/output_user/qwen25_coder_0p5b_curriculum_filtered_stage1"
|
| 26 |
+
|
| 27 |
+
swift pt \
|
| 28 |
+
--model Qwen/Qwen2.5-Coder-0.5B \
|
| 29 |
+
--tuner_type full \
|
| 30 |
+
--dataset "${DATASET}" \
|
| 31 |
+
--torch_dtype bfloat16 \
|
| 32 |
+
--attn_impl flash_attn \
|
| 33 |
+
--per_device_train_batch_size 8 \
|
| 34 |
+
--learning_rate 5e-5 \
|
| 35 |
+
--gradient_accumulation_steps 4 \
|
| 36 |
+
--save_steps 2000 \
|
| 37 |
+
--save_total_limit 3 \
|
| 38 |
+
--logging_steps 50 \
|
| 39 |
+
--max_length 1024 \
|
| 40 |
+
--num_train_epochs 1 \
|
| 41 |
+
--warmup_ratio 0.03 \
|
| 42 |
+
--lr_scheduler_type cosine \
|
| 43 |
+
--dataloader_num_workers 8 \
|
| 44 |
+
--dataset_num_proc 8 \
|
| 45 |
+
--use_hf true \
|
| 46 |
+
--save_only_model false \
|
| 47 |
+
--output_dir "${OUTPUT_DIR}"
|