Skip to content

Official Codebase of 3DCodeVerse

Python

finetune: sync scripts, configs, eval stack and docs

gaoypengaba9e1397f30
diff --git a/finetune/configs/lf/README.md b/finetune/configs/lf/README.md
new file mode 100644
index 00000000..cc227779
--- /dev/null
+++ b/finetune/configs/lf/README.md
@@ -0,0 +1,19 @@
+# configs/lf/
+
+Named `<stage>_<model>_<tuning>_lr<lr>_len<ctx>_<data>.yaml`, so the filename carries the settings that vary.
+Everything else (batch 1, bf16, cosine schedule, 1 epoch for SFT) is the same across runs.
+
+| config | data |
+|---|---|
+| `sft_9b_lora64_lr1e-4_len8k_mmmix-plus.yaml` | current best SFT line: mm image+text pairs + `md_9b_plus` |
+| `sft_9b_lora64_lr1e-4_len8k_mmmix-noleak.yaml` | same recipe on the leak-free mix (source of the transferable stop pairs) |
+| `sft_9b_lora64_lr1e-4_len8k_full9b.yaml` | the full corpus |
+| `sft_9b_lora64_lr1e-4_len8k_pubimg.yaml` | the published image pairs (169k rows), local `media_dir` |
+| `sft_9b_lora64_lr1e-4_len8k_pairsmix.yaml` | published image+text and text pairs |
+| `sft_9b_lora64_lr1e-4_len8k_hub-remote.yaml` | text-only, streamed with `dataset_dir: REMOTE:ilabai/3dcodeverse` |
+| `dpo_9b_lora16_lr5e-6_len2k_stop-r1.yaml` | stop-DPO round 1 (also the template `stop_dpo_round.sh` seds) |
+| `dpo_9b_lora16_lr5e-6_len2k_stop-r2.yaml` | round 2, from the round-1 model |
+
+`export_lora_template.yaml` is the merge template used by `scripts/export_lora.sh`; `ds_z3_offload.json` is the
+ZeRO-3 config (LoRA runs are ~7.8x slower under it than DDP — use it only when the model does not fit).
+Superseded configs are in `archive/configs/`.
diff --git a/finetune/configs/lf/_probe_img.yaml b/finetune/configs/lf/_probe_img.yaml
deleted file mode 100644
index 32a7005d..00000000
--- a/finetune/configs/lf/_probe_img.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 8
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /tmp/claude-1035/-wekafs-ict-hx-624/8a069962-27e5-496d-b000-d4e3dd4dac29/scratchpad/lftest
-dataset: probe
-media_dir: /wekafs/ict/hx_624/data/pair_images_small
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 4096
-packing: false
-neat_packing: false
-preprocessing_num_workers: 4
-dataloader_num_workers: 2
-output_dir: /tmp/claude-1035/-wekafs-ict-hx-624/8a069962-27e5-496d-b000-d4e3dd4dac29/scratchpad/lftest/out
-overwrite_output_dir: true
-max_steps: 2
-logging_steps: 1
-save_steps: 100000
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 1
-learning_rate: 0.00001
-bf16: true
-gradient_checkpointing: true
-report_to: none
diff --git a/finetune/configs/lf/_probe_local.yaml b/finetune/configs/lf/_probe_local.yaml
deleted file mode 100644
index 335ee8f9..00000000
--- a/finetune/configs/lf/_probe_local.yaml
+++ /dev/null
@@ -1,40 +0,0 @@
-### Trains straight from the published dataset, exercising the path an outside user takes:
-### dataset_dir: REMOTE:<repo> makes LLaMA-Factory fetch dataset_info.json from the Hub, and media_dir points at
-### the downloaded pair_renders tree. If this runs, the artifact works as published.
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /tmp/claude-1035/-wekafs-ict-hx-624/8a069962-27e5-496d-b000-d4e3dd4dac29/scratchpad/localds
-dataset: cb_factories_geo_imgtext,bio_geo_imgtext
-media_dir: /wekafs/ict/hx_624/data/pair_media_root
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-packing: false
-neat_packing: false
-preprocessing_num_workers: 16
-dataloader_num_workers: 8
-output_dir: /tmp/claude-1035/-wekafs-ict-hx-624/8a069962-27e5-496d-b000-d4e3dd4dac29/scratchpad/localds/out
-overwrite_output_dir: true
-logging_steps: 10
-save_steps: 500
-save_only_model: true
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-max_steps: 3
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-report_to: none
diff --git a/finetune/configs/lf/archive/export_9b_mm1_img_text.yaml b/finetune/configs/lf/archive/export_9b_mm1_img_text.yaml
deleted file mode 100644
index 979754c1..00000000
--- a/finetune/configs/lf/archive/export_9b_mm1_img_text.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mm1_img_text
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mm1_img_text/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_bal_lr1e4.yaml b/finetune/configs/lf/archive/export_bal_lr1e4.yaml
deleted file mode 100644
index 7e91da3c..00000000
--- a/finetune/configs/lf/archive/export_bal_lr1e4.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_bal_lr1e4
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_bal_lr1e4/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_bal.yaml b/finetune/configs/lf/archive/export_md_bal.yaml
deleted file mode 100644
index 1a9a7f8b..00000000
--- a/finetune/configs/lf/archive/export_md_bal.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_bal
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_bal/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_big_ck2200.yaml b/finetune/configs/lf/archive/export_md_big_ck2200.yaml
deleted file mode 100644
index 8b05ac97..00000000
--- a/finetune/configs/lf/archive/export_md_big_ck2200.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big/checkpoint-2200
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big/checkpoint-2200/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_big_ck2420.yaml b/finetune/configs/lf/archive/export_md_big_ck2420.yaml
deleted file mode 100644
index b94ab337..00000000
--- a/finetune/configs/lf/archive/export_md_big_ck2420.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big/checkpoint-2420
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big/checkpoint-2420/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_big_ck2640.yaml b/finetune/configs/lf/archive/export_md_big_ck2640.yaml
deleted file mode 100644
index d5c70c4c..00000000
--- a/finetune/configs/lf/archive/export_md_big_ck2640.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big/checkpoint-2640
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big/checkpoint-2640/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_big_ck2860.yaml b/finetune/configs/lf/archive/export_md_big_ck2860.yaml
deleted file mode 100644
index 38ddb9d7..00000000
--- a/finetune/configs/lf/archive/export_md_big_ck2860.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big/checkpoint-2860
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big/checkpoint-2860/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_big_ck3080.yaml b/finetune/configs/lf/archive/export_md_big_ck3080.yaml
deleted file mode 100644
index ec45a8ce..00000000
--- a/finetune/configs/lf/archive/export_md_big_ck3080.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big/checkpoint-3080
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big/checkpoint-3080/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_big_ck3292.yaml b/finetune/configs/lf/archive/export_md_big_ck3292.yaml
deleted file mode 100644
index 1ba58e15..00000000
--- a/finetune/configs/lf/archive/export_md_big_ck3292.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big/checkpoint-3292
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big/checkpoint-3292/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_blender.yaml b/finetune/configs/lf/archive/export_md_blender.yaml
deleted file mode 100644
index 6adc1487..00000000
--- a/finetune/configs/lf/archive/export_md_blender.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_blender
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_blender/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_cadquery.yaml b/finetune/configs/lf/archive/export_md_cadquery.yaml
deleted file mode 100644
index 73477fb5..00000000
--- a/finetune/configs/lf/archive/export_md_cadquery.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_cadquery
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_cadquery/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_glsl.yaml b/finetune/configs/lf/archive/export_md_glsl.yaml
deleted file mode 100644
index 6bca1ca4..00000000
--- a/finetune/configs/lf/archive/export_md_glsl.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_glsl
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_glsl/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_openscad.yaml b/finetune/configs/lf/archive/export_md_openscad.yaml
deleted file mode 100644
index 26fd21c5..00000000
--- a/finetune/configs/lf/archive/export_md_openscad.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_openscad
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_openscad/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_xl_ck1350.yaml b/finetune/configs/lf/archive/export_md_xl_ck1350.yaml
deleted file mode 100644
index 147064c7..00000000
--- a/finetune/configs/lf/archive/export_md_xl_ck1350.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/checkpoint-1350
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/checkpoint-1350/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_xl_ck1800.yaml b/finetune/configs/lf/archive/export_md_xl_ck1800.yaml
deleted file mode 100644
index 49c8bbf0..00000000
--- a/finetune/configs/lf/archive/export_md_xl_ck1800.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/checkpoint-1800
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/checkpoint-1800/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_xl_ck2250.yaml b/finetune/configs/lf/archive/export_md_xl_ck2250.yaml
deleted file mode 100644
index 238e03cf..00000000
--- a/finetune/configs/lf/archive/export_md_xl_ck2250.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/checkpoint-2250
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/checkpoint-2250/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_xl_ck2700.yaml b/finetune/configs/lf/archive/export_md_xl_ck2700.yaml
deleted file mode 100644
index 8d739754..00000000
--- a/finetune/configs/lf/archive/export_md_xl_ck2700.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/checkpoint-2700
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/checkpoint-2700/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_xl_ck3150.yaml b/finetune/configs/lf/archive/export_md_xl_ck3150.yaml
deleted file mode 100644
index 838a7dc1..00000000
--- a/finetune/configs/lf/archive/export_md_xl_ck3150.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/checkpoint-3150
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/checkpoint-3150/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_xl_ck3600.yaml b/finetune/configs/lf/archive/export_md_xl_ck3600.yaml
deleted file mode 100644
index 8009ea3b..00000000
--- a/finetune/configs/lf/archive/export_md_xl_ck3600.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/checkpoint-3600
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/checkpoint-3600/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_xl_ck450.yaml b/finetune/configs/lf/archive/export_md_xl_ck450.yaml
deleted file mode 100644
index 3dc49d14..00000000
--- a/finetune/configs/lf/archive/export_md_xl_ck450.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/checkpoint-450
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/checkpoint-450/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_xl_ck900.yaml b/finetune/configs/lf/archive/export_md_xl_ck900.yaml
deleted file mode 100644
index 21c131e3..00000000
--- a/finetune/configs/lf/archive/export_md_xl_ck900.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/checkpoint-900
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/checkpoint-900/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_md_xl_geo.yaml b/finetune/configs/lf/archive/export_md_xl_geo.yaml
deleted file mode 100644
index 72d06ece..00000000
--- a/finetune/configs/lf/archive/export_md_xl_geo.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/merged_geo
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_mm_img.yaml b/finetune/configs/lf/archive/export_mm_img.yaml
deleted file mode 100644
index 99fe5dff..00000000
--- a/finetune/configs/lf/archive/export_mm_img.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mm_img
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mm_img/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_mm_img_text.yaml b/finetune/configs/lf/archive/export_mm_img_text.yaml
deleted file mode 100644
index cc151739..00000000
--- a/finetune/configs/lf/archive/export_mm_img_text.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mm_img_text
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mm_img_text/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_mm_text.yaml b/finetune/configs/lf/archive/export_mm_text.yaml
deleted file mode 100644
index cd14ea17..00000000
--- a/finetune/configs/lf/archive/export_mm_text.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mm_text
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mm_text/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v10_4b.yaml b/finetune/configs/lf/archive/export_v10_4b.yaml
deleted file mode 100644
index 47055b84..00000000
--- a/finetune/configs/lf/archive/export_v10_4b.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-4B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v10_4b
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v10_4b/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v11_selftrain.yaml b/finetune/configs/lf/archive/export_v11_selftrain.yaml
deleted file mode 100644
index 0d2ecd19..00000000
--- a/finetune/configs/lf/archive/export_v11_selftrain.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v11_selftrain
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v11_selftrain/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v11b_selfprompts.yaml b/finetune/configs/lf/archive/export_v11b_selfprompts.yaml
deleted file mode 100644
index fde0c71a..00000000
--- a/finetune/configs/lf/archive/export_v11b_selfprompts.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v11b_selfprompts
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v11b_selfprompts/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v12_qwen3_8b.yaml b/finetune/configs/lf/archive/export_v12_qwen3_8b.yaml
deleted file mode 100644
index 3fa9e2cb..00000000
--- a/finetune/configs/lf/archive/export_v12_qwen3_8b.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3-8B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v12_qwen3_8b
-template: qwen3
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v12_qwen3_8b/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v13_boot.yaml b/finetune/configs/lf/archive/export_v13_boot.yaml
deleted file mode 100644
index 7b29279f..00000000
--- a/finetune/configs/lf/archive/export_v13_boot.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v13_boot
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v13_boot/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v1_ckpt100.yaml b/finetune/configs/lf/archive/export_v1_ckpt100.yaml
deleted file mode 100644
index 8e0cf7e0..00000000
--- a/finetune/configs/lf/archive/export_v1_ckpt100.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v1/checkpoint-100
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v1/checkpoint-100/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v1_rep.yaml b/finetune/configs/lf/archive/export_v1_rep.yaml
deleted file mode 100644
index 0572fc33..00000000
--- a/finetune/configs/lf/archive/export_v1_rep.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v1_rep
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v1_rep/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v2_indist.yaml b/finetune/configs/lf/archive/export_v2_indist.yaml
deleted file mode 100644
index f8501a47..00000000
--- a/finetune/configs/lf/archive/export_v2_indist.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v2_indist
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v2_indist/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v2b_indist16k.yaml b/finetune/configs/lf/archive/export_v2b_indist16k.yaml
deleted file mode 100644
index 600cd46f..00000000
--- a/finetune/configs/lf/archive/export_v2b_indist16k.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v2b_indist16k
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v2b_indist16k/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v3_bio.yaml b/finetune/configs/lf/archive/export_v3_bio.yaml
deleted file mode 100644
index ca2ceee7..00000000
--- a/finetune/configs/lf/archive/export_v3_bio.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v3_bio
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v3_bio/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v3_bio_ckpt100.yaml b/finetune/configs/lf/archive/export_v3_bio_ckpt100.yaml
deleted file mode 100644
index 58510df2..00000000
--- a/finetune/configs/lf/archive/export_v3_bio_ckpt100.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v3_bio/checkpoint-100
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v3_bio/checkpoint-100/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v3_bio_ckpt50.yaml b/finetune/configs/lf/archive/export_v3_bio_ckpt50.yaml
deleted file mode 100644
index 18e2b383..00000000
--- a/finetune/configs/lf/archive/export_v3_bio_ckpt50.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v3_bio/checkpoint-50
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v3_bio/checkpoint-50/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v4_cq.yaml b/finetune/configs/lf/archive/export_v4_cq.yaml
deleted file mode 100644
index 51fa42e0..00000000
--- a/finetune/configs/lf/archive/export_v4_cq.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v4_cq
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v4_cq/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v5_instr.yaml b/finetune/configs/lf/archive/export_v5_instr.yaml
deleted file mode 100644
index bb75a95a..00000000
--- a/finetune/configs/lf/archive/export_v5_instr.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v5_instr
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v5_instr/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v7_ep4.yaml b/finetune/configs/lf/archive/export_v7_ep4.yaml
deleted file mode 100644
index 62243783..00000000
--- a/finetune/configs/lf/archive/export_v7_ep4.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v7_ep4
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v7_ep4/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v8_r16.yaml b/finetune/configs/lf/archive/export_v8_r16.yaml
deleted file mode 100644
index c96edf7d..00000000
--- a/finetune/configs/lf/archive/export_v8_r16.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v8_r16
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v8_r16/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/archive/export_v9_lr2e4.yaml b/finetune/configs/lf/archive/export_v9_lr2e4.yaml
deleted file mode 100644
index 9b5a3de2..00000000
--- a/finetune/configs/lf/archive/export_v9_lr2e4.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v9_lr2e4
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v9_lr2e4/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/dpo_27b.yaml b/finetune/configs/lf/dpo_27b.yaml
deleted file mode 100644
index 4b9c5d41..00000000
--- a/finetune/configs/lf/dpo_27b.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-### DPO with execution-feedback preference pairs, on top of LoRA-v1 (merged)
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_v2/merged
-trust_remote_code: true
-flash_attn: fa2
-stage: dpo
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-pref_beta: 0.1
-pref_loss: sigmoid
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: dpo_27b_pairs
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 2
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_dpo
-logging_steps: 5
-save_steps: 1000
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_dpo
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 5.0e-6
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.1
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-val_size: 0.02
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
diff --git a/finetune/configs/lf/dpo_stop_plus.yaml b/finetune/configs/lf/dpo_9b_lora16_lr5e-6_len2k_stop-r1.yaml
similarity index 100%
rename from finetune/configs/lf/dpo_stop_plus.yaml
rename to finetune/configs/lf/dpo_9b_lora16_lr5e-6_len2k_stop-r1.yaml
diff --git a/finetune/configs/lf/dpo_stop_plus_own.yaml b/finetune/configs/lf/dpo_9b_lora16_lr5e-6_len2k_stop-r2.yaml
similarity index 95%
rename from finetune/configs/lf/dpo_stop_plus_own.yaml
rename to finetune/configs/lf/dpo_9b_lora16_lr5e-6_len2k_stop-r2.yaml
index 39ecbde7..c2d6b5d4 100644
--- a/finetune/configs/lf/dpo_stop_plus_own.yaml
+++ b/finetune/configs/lf/dpo_9b_lora16_lr5e-6_len2k_stop-r2.yaml
@@ -1,5 +1,5 @@
### DPO with execution-feedback preference pairs, on top of LoRA-v1 (merged)
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_plus/merged
+model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_plus_stop/merged
trust_remote_code: true
flash_attn: fa2
stage: dpo
@@ -14,13 +14,13 @@ freeze_multi_modal_projector: true
pref_beta: 0.1
pref_loss: sigmoid
dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: stop_dpo_pairs_plus
+dataset: stop_dpo_pairs_plusr2
template: qwen3_5
enable_thinking: false
cutoff_len: 2048
preprocessing_num_workers: 16
dataloader_num_workers: 2
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_plus_stopown
+output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_plus_stop_r2
logging_steps: 5
save_steps: 1000
save_only_model: true
diff --git a/finetune/configs/lf/dpo_best_stop.yaml b/finetune/configs/lf/dpo_best_stop.yaml
deleted file mode 100644
index fe9ca378..00000000
--- a/finetune/configs/lf/dpo_best_stop.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-### DPO with execution-feedback preference pairs, on top of LoRA-v1 (merged)
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_exec_v2/merged
-trust_remote_code: true
-flash_attn: fa2
-stage: dpo
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-pref_beta: 0.1
-pref_loss: sigmoid
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: stop_dpo_pairs
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 2048
-preprocessing_num_workers: 16
-dataloader_num_workers: 2
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_best_stop
-logging_steps: 5
-save_steps: 1000
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 5.0e-6
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.1
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-val_size: 0.02
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
diff --git a/finetune/configs/lf/dpo_exec_v1.yaml b/finetune/configs/lf/dpo_exec_v1.yaml
deleted file mode 100644
index ade129d3..00000000
--- a/finetune/configs/lf/dpo_exec_v1.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-### DPO with execution-feedback preference pairs, on top of LoRA-v1 (merged)
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v1/merged
-trust_remote_code: true
-flash_attn: fa2
-stage: dpo
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-pref_beta: 0.1
-pref_loss: sigmoid
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: dpo_exec_pairs
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 2
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_exec_v1
-logging_steps: 5
-save_steps: 1000
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 5.0e-6
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.1
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-val_size: 0.02
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
diff --git a/finetune/configs/lf/dpo_exec_v2.yaml b/finetune/configs/lf/dpo_exec_v2.yaml
deleted file mode 100644
index 6bd40832..00000000
--- a/finetune/configs/lf/dpo_exec_v2.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-### DPO with execution-feedback preference pairs, on top of LoRA-v1 (merged)
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_exec_v1/merged_r2
-trust_remote_code: true
-flash_attn: fa2
-stage: dpo
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-pref_beta: 0.1
-pref_loss: sigmoid
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: dpo_exec_pairs_r2
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 2
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_exec_v2
-logging_steps: 5
-save_steps: 1000
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_exec_v2
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 5.0e-6
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.1
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-val_size: 0.02
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
diff --git a/finetune/configs/lf/dpo_geo_md_xl.yaml b/finetune/configs/lf/dpo_geo_md_xl.yaml
deleted file mode 100644
index 9bd44edf..00000000
--- a/finetune/configs/lf/dpo_geo_md_xl.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-### DPO with execution-feedback preference pairs, on top of LoRA-v1 (merged)
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/merged_geo
-trust_remote_code: true
-flash_attn: fa2
-stage: dpo
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-pref_beta: 0.1
-pref_loss: sigmoid
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: dpo_geo_pairs
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 2
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_geo_md_xl
-logging_steps: 5
-save_steps: 1000
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 5.0e-6
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.1
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-val_size: 0.02
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
diff --git a/finetune/configs/lf/dpo_md_big.yaml b/finetune/configs/lf/dpo_md_big.yaml
deleted file mode 100644
index e1f83b0e..00000000
--- a/finetune/configs/lf/dpo_md_big.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-### DPO with execution-feedback preference pairs, on top of LoRA-v1 (merged)
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big/merged
-trust_remote_code: true
-flash_attn: fa2
-stage: dpo
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-pref_beta: 0.1
-pref_loss: sigmoid
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: dpo_md_big_pairs
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 2
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_md_big
-logging_steps: 5
-save_steps: 1000
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_md_big
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 5.0e-6
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.1
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-val_size: 0.02
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
diff --git a/finetune/configs/lf/dpo_md_mixed.yaml b/finetune/configs/lf/dpo_md_mixed.yaml
deleted file mode 100644
index d05a50c1..00000000
--- a/finetune/configs/lf/dpo_md_mixed.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-### DPO with execution-feedback preference pairs, on top of LoRA-v1 (merged)
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_mixed/merged
-trust_remote_code: true
-flash_attn: fa2
-stage: dpo
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-pref_beta: 0.1
-pref_loss: sigmoid
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: dpo_md_pairs
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 2
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_md_mixed
-logging_steps: 5
-save_steps: 1000
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_md_mixed
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 5.0e-6
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.1
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-val_size: 0.02
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
diff --git a/finetune/configs/lf/dpo_md_xl.yaml b/finetune/configs/lf/dpo_md_xl.yaml
deleted file mode 100644
index 7b3397ad..00000000
--- a/finetune/configs/lf/dpo_md_xl.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-### DPO with execution-feedback preference pairs, on top of LoRA-v1 (merged)
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/merged
-trust_remote_code: true
-flash_attn: fa2
-stage: dpo
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-pref_beta: 0.1
-pref_loss: sigmoid
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: dpo_md_xl_pairs
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 2
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_md_xl
-logging_steps: 5
-save_steps: 1000
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_md_xl
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 5.0e-6
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.1
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-val_size: 0.02
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
diff --git a/finetune/configs/lf/dpo_stop.yaml b/finetune/configs/lf/dpo_stop.yaml
deleted file mode 100644
index 20b73652..00000000
--- a/finetune/configs/lf/dpo_stop.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-### DPO with execution-feedback preference pairs, on top of LoRA-v1 (merged)
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mmmix2/merged
-trust_remote_code: true
-flash_attn: fa2
-stage: dpo
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-pref_beta: 0.1
-pref_loss: sigmoid
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: stop_dpo_pairs
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 2048
-preprocessing_num_workers: 16
-dataloader_num_workers: 2
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_stopdpo
-logging_steps: 5
-save_steps: 1000
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 5.0e-6
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.1
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-val_size: 0.02
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
diff --git a/finetune/configs/lf/dpo_stop_27b.yaml b/finetune/configs/lf/dpo_stop_27b.yaml
deleted file mode 100644
index 02e15065..00000000
--- a/finetune/configs/lf/dpo_stop_27b.yaml
+++ /dev/null
@@ -1,43 +0,0 @@
-### DPO with execution-feedback preference pairs, on top of LoRA-v1 (merged)
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_v2/merged
-trust_remote_code: true
-flash_attn: fa2
-stage: dpo
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-pref_beta: 0.1
-pref_loss: sigmoid
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: stop_dpo_pairs_27bv2
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 1024
-preprocessing_num_workers: 16
-dataloader_num_workers: 2
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_stopdpo
-logging_steps: 5
-save_steps: 1000
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 5.0e-6
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.1
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-val_size: 0.02
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-deepspeed: /wekafs/ict/hx_624/tools/LLaMA-Factory/examples/deepspeed/ds_z3_offload_config.json
diff --git a/finetune/configs/lf/dpo_stop_r2.yaml b/finetune/configs/lf/dpo_stop_r2.yaml
deleted file mode 100644
index e193045e..00000000
--- a/finetune/configs/lf/dpo_stop_r2.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-### DPO with execution-feedback preference pairs, on top of LoRA-v1 (merged)
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_stopdpo/merged
-trust_remote_code: true
-flash_attn: fa2
-stage: dpo
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-pref_beta: 0.1
-pref_loss: sigmoid
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: stop_dpo_pairs_r2
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 4096
-preprocessing_num_workers: 16
-dataloader_num_workers: 2
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_stopdpo_r2
-logging_steps: 5
-save_steps: 1000
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 5.0e-6
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.1
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-val_size: 0.02
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
diff --git a/finetune/configs/lf/export_27b_clean.yaml b/finetune/configs/lf/export_27b_clean.yaml
deleted file mode 100644
index 279d6399..00000000
--- a/finetune/configs/lf/export_27b_clean.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_clean
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_clean/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_27b_dpo.yaml b/finetune/configs/lf/export_27b_dpo.yaml
deleted file mode 100644
index e5201274..00000000
--- a/finetune/configs/lf/export_27b_dpo.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_v2/merged
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_dpo
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_dpo/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_27b_max.yaml b/finetune/configs/lf/export_27b_max.yaml
deleted file mode 100644
index 4c6ed795..00000000
--- a/finetune/configs/lf/export_27b_max.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_md_max
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_md_max/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_27b_mm.yaml b/finetune/configs/lf/export_27b_mm.yaml
deleted file mode 100644
index c51bf103..00000000
--- a/finetune/configs/lf/export_27b_mm.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_mm_img_text
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_mm_img_text/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_27b_v2.yaml b/finetune/configs/lf/export_27b_v2.yaml
deleted file mode 100644
index 73ae5c5d..00000000
--- a/finetune/configs/lf/export_27b_v2.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_v2
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_v2/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_27b_v3.yaml b/finetune/configs/lf/export_27b_v3.yaml
deleted file mode 100644
index 83cde3cd..00000000
--- a/finetune/configs/lf/export_27b_v3.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_v3
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_v3/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_27b_v4.yaml b/finetune/configs/lf/export_27b_v4.yaml
deleted file mode 100644
index a440f3cc..00000000
--- a/finetune/configs/lf/export_27b_v4.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_v4
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_v4/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_27b_v5.yaml b/finetune/configs/lf/export_27b_v5.yaml
deleted file mode 100644
index f7a2d6f3..00000000
--- a/finetune/configs/lf/export_27b_v5.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_v5
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_v5/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_9b_clean.yaml b/finetune/configs/lf/export_9b_clean.yaml
deleted file mode 100644
index 6122a4bc..00000000
--- a/finetune/configs/lf/export_9b_clean.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_clean
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_clean/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_9b_full.yaml b/finetune/configs/lf/export_9b_full.yaml
deleted file mode 100644
index 4da48bae..00000000
--- a/finetune/configs/lf/export_9b_full.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_full
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_full/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_9b_img.yaml b/finetune/configs/lf/export_9b_img.yaml
deleted file mode 100644
index 4f4f9b5a..00000000
--- a/finetune/configs/lf/export_9b_img.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_img
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_img/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_9b_img4.yaml b/finetune/configs/lf/export_9b_img4.yaml
deleted file mode 100644
index 771d965b..00000000
--- a/finetune/configs/lf/export_9b_img4.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_img4
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_img4/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_9b_imgmix.yaml b/finetune/configs/lf/export_9b_imgmix.yaml
deleted file mode 100644
index 8cfeb3be..00000000
--- a/finetune/configs/lf/export_9b_imgmix.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_imgmix
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_imgmix/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_9b_mmmix2.yaml b/finetune/configs/lf/export_9b_mmmix2.yaml
deleted file mode 100644
index 6a622e6c..00000000
--- a/finetune/configs/lf/export_9b_mmmix2.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mmmix2
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mmmix2/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_9b_mmvis.yaml b/finetune/configs/lf/export_9b_mmvis.yaml
deleted file mode 100644
index 665a1dfd..00000000
--- a/finetune/configs/lf/export_9b_mmvis.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mmvis
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mmvis/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_9b_noleak.yaml b/finetune/configs/lf/export_9b_noleak.yaml
deleted file mode 100644
index 2ba495a6..00000000
--- a/finetune/configs/lf/export_9b_noleak.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_noleak
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_noleak/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_9b_plus.yaml b/finetune/configs/lf/export_9b_plus.yaml
deleted file mode 100644
index 5ed4646f..00000000
--- a/finetune/configs/lf/export_9b_plus.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_plus
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_plus/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_best_stop.yaml b/finetune/configs/lf/export_best_stop.yaml
deleted file mode 100644
index aed922bf..00000000
--- a/finetune/configs/lf/export_best_stop.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_exec_v2/merged
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_best_stop
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_best_stop/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_dpo_exec_v1.yaml b/finetune/configs/lf/export_dpo_exec_v1.yaml
deleted file mode 100644
index 19dd568a..00000000
--- a/finetune/configs/lf/export_dpo_exec_v1.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v1/merged
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_exec_v1
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_exec_v1/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_dpo_exec_v1_r2.yaml b/finetune/configs/lf/export_dpo_exec_v1_r2.yaml
deleted file mode 100644
index 86c82577..00000000
--- a/finetune/configs/lf/export_dpo_exec_v1_r2.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v1/merged
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_exec_v1
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_exec_v1/merged_r2
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_dpo_exec_v2.yaml b/finetune/configs/lf/export_dpo_exec_v2.yaml
deleted file mode 100644
index be216069..00000000
--- a/finetune/configs/lf/export_dpo_exec_v2.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_exec_v1/merged_r2
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_exec_v2
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_exec_v2/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_dpo_geo_md_xl.yaml b/finetune/configs/lf/export_dpo_geo_md_xl.yaml
deleted file mode 100644
index ee105071..00000000
--- a/finetune/configs/lf/export_dpo_geo_md_xl.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/merged_geo
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_geo_md_xl
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_geo_md_xl/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_dpo_md_big.yaml b/finetune/configs/lf/export_dpo_md_big.yaml
deleted file mode 100644
index d3a5d00d..00000000
--- a/finetune/configs/lf/export_dpo_md_big.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big/merged
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_md_big
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_md_big/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_dpo_md_mixed.yaml b/finetune/configs/lf/export_dpo_md_mixed.yaml
deleted file mode 100644
index e55a44c4..00000000
--- a/finetune/configs/lf/export_dpo_md_mixed.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_mixed/merged
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_md_mixed
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_md_mixed/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_dpo_md_xl.yaml b/finetune/configs/lf/export_dpo_md_xl.yaml
deleted file mode 100644
index bda73106..00000000
--- a/finetune/configs/lf/export_dpo_md_xl.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/merged
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_md_xl
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_md_xl/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_lf_qwen35_9b_plus_stop.yaml b/finetune/configs/lf/export_lf_qwen35_9b_plus_stop.yaml
deleted file mode 100644
index 104622d9..00000000
--- a/finetune/configs/lf/export_lf_qwen35_9b_plus_stop.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_plus/merged
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_plus_stop
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_plus_stop/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_lf_qwen35_9b_plus_stopown.yaml b/finetune/configs/lf/export_lf_qwen35_9b_plus_stopown.yaml
deleted file mode 100644
index 1b786185..00000000
--- a/finetune/configs/lf/export_lf_qwen35_9b_plus_stopown.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_plus/merged
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_plus_stopown
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_plus_stopown/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_md_big.yaml b/finetune/configs/lf/export_md_big.yaml
deleted file mode 100644
index d2760a99..00000000
--- a/finetune/configs/lf/export_md_big.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_md_max_9b.yaml b/finetune/configs/lf/export_md_max_9b.yaml
deleted file mode 100644
index e8581c46..00000000
--- a/finetune/configs/lf/export_md_max_9b.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_max
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_max/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_md_mixed.yaml b/finetune/configs/lf/export_md_mixed.yaml
deleted file mode 100644
index 4040c6dd..00000000
--- a/finetune/configs/lf/export_md_mixed.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_mixed
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_mixed/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_md_threejs.yaml b/finetune/configs/lf/export_md_threejs.yaml
deleted file mode 100644
index be0d2128..00000000
--- a/finetune/configs/lf/export_md_threejs.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_threejs
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_threejs/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_md_v3.yaml b/finetune/configs/lf/export_md_v3.yaml
deleted file mode 100644
index 642197cb..00000000
--- a/finetune/configs/lf/export_md_v3.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_v3
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_v3/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_md_xl.yaml b/finetune/configs/lf/export_md_xl.yaml
deleted file mode 100644
index 469e0218..00000000
--- a/finetune/configs/lf/export_md_xl.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_stopdpo.yaml b/finetune/configs/lf/export_stopdpo.yaml
deleted file mode 100644
index 637cc067..00000000
--- a/finetune/configs/lf/export_stopdpo.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mmmix2/merged
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_stopdpo
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_stopdpo/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_stopdpo_r2.yaml b/finetune/configs/lf/export_stopdpo_r2.yaml
deleted file mode 100644
index 8fa21d26..00000000
--- a/finetune/configs/lf/export_stopdpo_r2.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_stopdpo/merged
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_stopdpo_r2
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_stopdpo_r2/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_v1.yaml b/finetune/configs/lf/export_v1.yaml
deleted file mode 100644
index cb180b71..00000000
--- a/finetune/configs/lf/export_v1.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v1
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v1/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/export_v6_detail.yaml b/finetune/configs/lf/export_v6_detail.yaml
deleted file mode 100644
index 2cdca3eb..00000000
--- a/finetune/configs/lf/export_v6_detail.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-### Merge a LoRA adapter into the base model (LLaMA-Factory): llamafactory-cli export <this file>
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-adapter_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v6_detail
-template: qwen3_5
-enable_thinking: false
-trust_remote_code: true
-finetuning_type: lora
-
-export_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v6_detail/merged
-export_size: 5
-export_device: cpu
-export_legacy_format: false
diff --git a/finetune/configs/lf/full_md_bal.yaml b/finetune/configs/lf/full_md_bal.yaml
deleted file mode 100644
index a4cb4bf0..00000000
--- a/finetune/configs/lf/full_md_bal.yaml
+++ /dev/null
@@ -1,41 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: full
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-deepspeed: /wekafs/ict/hx_624/tools/LLaMA-Factory/examples/deepspeed/ds_z3_config.json
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_bal_train
-eval_dataset: md_bal_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_bal_full_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_full_md_bal
-logging_steps: 5
-save_steps: 200
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 2
-learning_rate: 1.0e-05
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 200
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_27b_clean.yaml b/finetune/configs/lf/lora_27b_clean.yaml
deleted file mode 100644
index 56122f4e..00000000
--- a/finetune/configs/lf/lora_27b_clean.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_9b_noleak_train
-eval_dataset: md_9b_clean_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 3072
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_27b_clean_3072
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_clean
-logging_steps: 5
-save_steps: 300
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 6
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 300
-save_total_limit: 8
diff --git a/finetune/configs/lf/lora_27b_ddp.yaml b/finetune/configs/lf/lora_27b_ddp.yaml
deleted file mode 100644
index 57b35eb1..00000000
--- a/finetune/configs/lf/lora_27b_ddp.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_27b_max4k_train
-eval_dataset: md_27b_max4k_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 4096
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_27b_max4k_len4096_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_md_max
-logging_steps: 5
-save_steps: 200
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 4
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 200
-save_total_limit: 8
diff --git a/finetune/configs/lf/lora_27b_md.yaml b/finetune/configs/lf/lora_27b_md.yaml
deleted file mode 100644
index 91bdb5ef..00000000
--- a/finetune/configs/lf/lora_27b_md.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_27b_train
-eval_dataset: md_27b_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_27b_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_md_27b
-logging_steps: 5
-save_steps: 180
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 2
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 180
-save_total_limit: 6
diff --git a/finetune/configs/lf/lora_27b_md_z3.yaml b/finetune/configs/lf/lora_27b_md_z3.yaml
deleted file mode 100644
index 85ac3a76..00000000
--- a/finetune/configs/lf/lora_27b_md_z3.yaml
+++ /dev/null
@@ -1,45 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_27b_max_train
-eval_dataset: md_27b_max_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_27b_max_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_md_max
-logging_steps: 5
-save_steps: 150
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 2
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 150
-save_total_limit: 8
-deepspeed: /wekafs/ict/hx_624/tools/LLaMA-Factory/examples/deepspeed/ds_z3_config.json
diff --git a/finetune/configs/lf/lora_27b_mm_img_text.yaml b/finetune/configs/lf/lora_27b_mm_img_text.yaml
deleted file mode 100644
index be3413cb..00000000
--- a/finetune/configs/lf/lora_27b_mm_img_text.yaml
+++ /dev/null
@@ -1,45 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-image_max_pixels: 200704
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/mm1
-dataset: 3dcv_mm_img_text_train
-eval_dataset: 3dcv_mm_img_text_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 4096
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: false
-packing: false
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_mm1_27b_len4096_px448b
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_mm_img_text
-logging_steps: 5
-save_steps: 300
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 4
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 300
-save_total_limit: 3
diff --git a/finetune/configs/lf/lora_27b_v2.yaml b/finetune/configs/lf/lora_27b_v2.yaml
deleted file mode 100644
index 7a609a1b..00000000
--- a/finetune/configs/lf/lora_27b_v2.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_27b_v2s_train
-eval_dataset: md_27b_v2s_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 4096
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_27b_v2s_len4096_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_v2
-logging_steps: 5
-save_steps: 250
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 4
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 250
-save_total_limit: 8
diff --git a/finetune/configs/lf/lora_27b_v3.yaml b/finetune/configs/lf/lora_27b_v3.yaml
deleted file mode 100644
index 967088f6..00000000
--- a/finetune/configs/lf/lora_27b_v3.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 32
-lora_alpha: 64
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_27b_v3_train
-eval_dataset: md_27b_v3_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 3072
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_27b_v3_len3072_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_v3
-logging_steps: 5
-save_steps: 250
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 6
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 250
-save_total_limit: 8
diff --git a/finetune/configs/lf/lora_27b_v4.yaml b/finetune/configs/lf/lora_27b_v4.yaml
deleted file mode 100644
index 85f31697..00000000
--- a/finetune/configs/lf/lora_27b_v4.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_27b_v4_train
-eval_dataset: md_27b_v4_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 4096
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_27b_v4_len4096_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_v4
-logging_steps: 5
-save_steps: 300
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 4
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 300
-save_total_limit: 8
diff --git a/finetune/configs/lf/lora_27b_v5.yaml b/finetune/configs/lf/lora_27b_v5.yaml
deleted file mode 100644
index b7a2e607..00000000
--- a/finetune/configs/lf/lora_27b_v5.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_27b_v5_train
-eval_dataset: md_27b_v5_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 3072
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_v5_3072
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_v5
-logging_steps: 5
-save_steps: 300
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 6
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 300
-save_total_limit: 8
diff --git a/finetune/configs/lf/lora_27b_z3_8gpu.yaml b/finetune/configs/lf/lora_27b_z3_8gpu.yaml
deleted file mode 100644
index c65922a1..00000000
--- a/finetune/configs/lf/lora_27b_z3_8gpu.yaml
+++ /dev/null
@@ -1,45 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_27b_v2s_train
-eval_dataset: md_27b_v2s_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_27b_v2s_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_lora_v4
-logging_steps: 5
-save_steps: 250
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 1
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 250
-save_total_limit: 8
-deepspeed: /wekafs/ict/hx_624/tools/LLaMA-Factory/examples/deepspeed/ds_z3_config.json
diff --git a/finetune/configs/lf/lora_9b_bal_lr1e4.yaml b/finetune/configs/lf/lora_9b_bal_lr1e4.yaml
deleted file mode 100644
index 29ae6077..00000000
--- a/finetune/configs/lf/lora_9b_bal_lr1e4.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_bal9b_hard_train
-eval_dataset: md_bal9b_hard_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_bal9b_hard
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_bal_lr1e4
-logging_steps: 5
-save_steps: 300
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 300
-save_total_limit: 3
diff --git a/finetune/configs/lf/lora_9b_bal_lr3e5.yaml b/finetune/configs/lf/lora_9b_bal_lr3e5.yaml
deleted file mode 100644
index 2331cf6f..00000000
--- a/finetune/configs/lf/lora_9b_bal_lr3e5.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_bal9b_hard_train
-eval_dataset: md_bal9b_hard_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_bal9b_hard
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_bal_lr3e5
-logging_steps: 5
-save_steps: 300
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.00003
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 300
-save_total_limit: 3
diff --git a/finetune/configs/lf/lora_9b_clean.yaml b/finetune/configs/lf/lora_9b_clean.yaml
deleted file mode 100644
index 1b6717f3..00000000
--- a/finetune/configs/lf/lora_9b_clean.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_9b_clean_train
-eval_dataset: md_9b_clean_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_9b_clean_8192
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_clean
-logging_steps: 5
-save_steps: 400
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 400
-save_total_limit: 8
diff --git a/finetune/configs/lf/lora_9b_full_resume.yaml b/finetune/configs/lf/lora_9b_full_resume.yaml
deleted file mode 100644
index 9827b215..00000000
--- a/finetune/configs/lf/lora_9b_full_resume.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/full9b
-dataset: 3dcv_mm_img_text_train,3dcv_mm_img_train,md_full9b_train
-eval_dataset: 3dcv_mm_img_text_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 16
-neat_packing: false
-packing: false
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_full9b_len8192
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_full
-logging_steps: 5
-save_steps: 600
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 7
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_full/checkpoint-4200
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 600
-save_total_limit: 4
diff --git a/finetune/configs/lf/lora_9b_img.yaml b/finetune/configs/lf/lora_9b_img.yaml
deleted file mode 100644
index d8ee482a..00000000
--- a/finetune/configs/lf/lora_9b_img.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/img_code
-dataset: img_code_train
-eval_dataset: img_code_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: false
-packing: false
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_img_code
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_img
-logging_steps: 5
-save_steps: 200
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 200
-save_total_limit: 4
diff --git a/finetune/configs/lf/lora_9b_img4.yaml b/finetune/configs/lf/lora_9b_img4.yaml
deleted file mode 100644
index 55b1c32a..00000000
--- a/finetune/configs/lf/lora_9b_img4.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/img_code4
-dataset: img_code_train
-eval_dataset: img_code_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: false
-packing: false
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_img_code4
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_img4
-logging_steps: 5
-save_steps: 200
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 200
-save_total_limit: 4
diff --git a/finetune/configs/lf/lora_9b_mm1_img_text.yaml b/finetune/configs/lf/lora_9b_mm1_img_text.yaml
deleted file mode 100644
index 0b441c65..00000000
--- a/finetune/configs/lf/lora_9b_mm1_img_text.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/mm1
-dataset: 3dcv_mm_img_text_train
-eval_dataset: 3dcv_mm_img_text_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: false
-packing: false
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_mm1_9b_img_text
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mm1_img_text
-logging_steps: 5
-save_steps: 300
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 300
-save_total_limit: 3
diff --git a/finetune/configs/lf/lora_9b_mm_img.yaml b/finetune/configs/lf/lora_9b_mm_img.yaml
deleted file mode 100644
index 1be1453d..00000000
--- a/finetune/configs/lf/lora_9b_mm_img.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/mm
-dataset: 3dcv_mm_img_train
-eval_dataset: 3dcv_mm_img_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: false
-packing: false
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_mm_img
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mm_img
-logging_steps: 5
-save_steps: 300
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 300
-save_total_limit: 3
diff --git a/finetune/configs/lf/lora_9b_mm_img_text.yaml b/finetune/configs/lf/lora_9b_mm_img_text.yaml
deleted file mode 100644
index c798d800..00000000
--- a/finetune/configs/lf/lora_9b_mm_img_text.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/mm
-dataset: 3dcv_mm_img_text_train
-eval_dataset: 3dcv_mm_img_text_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: false
-packing: false
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_mm_img_text
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mm_img_text
-logging_steps: 5
-save_steps: 300
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 300
-save_total_limit: 3
diff --git a/finetune/configs/lf/lora_9b_mm_text.yaml b/finetune/configs/lf/lora_9b_mm_text.yaml
deleted file mode 100644
index 84ca05e0..00000000
--- a/finetune/configs/lf/lora_9b_mm_text.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/mm
-dataset: 3dcv_mm_text_train
-eval_dataset: 3dcv_mm_text_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: false
-packing: false
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_mm_text
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mm_text
-logging_steps: 5
-save_steps: 300
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 300
-save_total_limit: 3
diff --git a/finetune/configs/lf/lora_9b_mmvis.yaml b/finetune/configs/lf/lora_9b_mmvis.yaml
deleted file mode 100644
index c40a062f..00000000
--- a/finetune/configs/lf/lora_9b_mmvis.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: false
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/mm_mix
-dataset: 3dcv_mm_img_text_train,3dcv_mm_img_train,md_9b_noleak_train
-eval_dataset: 3dcv_mm_img_text_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: false
-packing: false
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_mm_mix
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mmvis
-logging_steps: 5
-save_steps: 500
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 500
-save_total_limit: 4
diff --git a/finetune/configs/lf/lora_9b_noleak.yaml b/finetune/configs/lf/lora_9b_noleak.yaml
deleted file mode 100644
index b2ec18fd..00000000
--- a/finetune/configs/lf/lora_9b_noleak.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_9b_noleak_train
-eval_dataset: md_9b_clean_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_9b_noleak_8192
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_noleak
-logging_steps: 5
-save_steps: 400
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 400
-save_total_limit: 8
diff --git a/finetune/configs/lf/lora_md_bal.yaml b/finetune/configs/lf/lora_md_bal.yaml
deleted file mode 100644
index 4d8ed44c..00000000
--- a/finetune/configs/lf/lora_md_bal.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_bal_train
-eval_dataset: md_bal_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_bal_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_bal
-logging_steps: 5
-save_steps: 200
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 200
-save_total_limit: 12
diff --git a/finetune/configs/lf/lora_md_big.yaml b/finetune/configs/lf/lora_md_big.yaml
deleted file mode 100644
index 83cc865d..00000000
--- a/finetune/configs/lf/lora_md_big.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_big_train
-eval_dataset: md_big_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_big_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big
-logging_steps: 5
-save_steps: 220
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 220
-save_total_limit: 6
diff --git a/finetune/configs/lf/lora_md_blender.yaml b/finetune/configs/lf/lora_md_blender.yaml
deleted file mode 100644
index 69b0fd2c..00000000
--- a/finetune/configs/lf/lora_md_blender.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_blender_train
-eval_dataset: md_blender_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_blender_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_blender
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_md_cadquery.yaml b/finetune/configs/lf/lora_md_cadquery.yaml
deleted file mode 100644
index c4a555b0..00000000
--- a/finetune/configs/lf/lora_md_cadquery.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_cadquery_train
-eval_dataset: md_cadquery_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_cadquery_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_cadquery
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_md_glsl.yaml b/finetune/configs/lf/lora_md_glsl.yaml
deleted file mode 100644
index b0039aa3..00000000
--- a/finetune/configs/lf/lora_md_glsl.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_glsl_train
-eval_dataset: md_glsl_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_glsl_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_glsl
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_md_max_9b.yaml b/finetune/configs/lf/lora_md_max_9b.yaml
deleted file mode 100644
index 60e9a4c8..00000000
--- a/finetune/configs/lf/lora_md_max_9b.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_max_9b_train
-eval_dataset: md_max_9b_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_max_9b_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_max
-logging_steps: 5
-save_steps: 500
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 500
-save_total_limit: 10
diff --git a/finetune/configs/lf/lora_md_mixed.yaml b/finetune/configs/lf/lora_md_mixed.yaml
deleted file mode 100644
index d3ba9ff8..00000000
--- a/finetune/configs/lf/lora_md_mixed.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_mixed_train
-eval_dataset: md_mixed_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_mixed_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_mixed
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_md_openscad.yaml b/finetune/configs/lf/lora_md_openscad.yaml
deleted file mode 100644
index 89250f53..00000000
--- a/finetune/configs/lf/lora_md_openscad.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_openscad_train
-eval_dataset: md_openscad_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_openscad_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_openscad
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_md_threejs.yaml b/finetune/configs/lf/lora_md_threejs.yaml
deleted file mode 100644
index e6ad9357..00000000
--- a/finetune/configs/lf/lora_md_threejs.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_threejs_train
-eval_dataset: md_threejs_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 16384
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_threejs_len16384_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_threejs
-logging_steps: 5
-save_steps: 1000
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 3.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 1000
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_md_v3.yaml b/finetune/configs/lf/lora_md_v3.yaml
deleted file mode 100644
index a265ff27..00000000
--- a/finetune/configs/lf/lora_md_v3.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_v3_train
-eval_dataset: md_v3_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_v3_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_v3
-logging_steps: 5
-save_steps: 500
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 500
-save_total_limit: 10
diff --git a/finetune/configs/lf/lora_md_xl.yaml b/finetune/configs/lf/lora_md_xl.yaml
deleted file mode 100644
index b298f06a..00000000
--- a/finetune/configs/lf/lora_md_xl.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: md_xl_train
-eval_dataset: md_xl_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_xl_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl
-logging_steps: 5
-save_steps: 450
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 1.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 450
-save_total_limit: 14
diff --git a/finetune/configs/lf/lora_v1.yaml b/finetune/configs/lf/lora_v1.yaml
deleted file mode 100644
index 40607d24..00000000
--- a/finetune/configs/lf/lora_v1.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: blender3d_v1_train
-eval_dataset: blender3d_v1_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_blender3d_v1_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v1
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_v10_4b.yaml b/finetune/configs/lf/lora_v10_4b.yaml
deleted file mode 100644
index 7f660d31..00000000
--- a/finetune/configs/lf/lora_v10_4b.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-4B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: blender3d_v1_train
-eval_dataset: blender3d_v1_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_blender3d_v1_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v10_4b
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_v11_selftrain.yaml b/finetune/configs/lf/lora_v11_selftrain.yaml
deleted file mode 100644
index eaf67c23..00000000
--- a/finetune/configs/lf/lora_v11_selftrain.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: v11_selftrain_train
-eval_dataset: v11_selftrain_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_v11_selftrain_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v11_selftrain
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_v11b_selfprompts.yaml b/finetune/configs/lf/lora_v11b_selfprompts.yaml
deleted file mode 100644
index 2acb9306..00000000
--- a/finetune/configs/lf/lora_v11b_selfprompts.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: v11b_selfprompts_train
-eval_dataset: v11b_selfprompts_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_v11b_selfprompts_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v11b_selfprompts
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_v12_qwen3_8b.yaml b/finetune/configs/lf/lora_v12_qwen3_8b.yaml
deleted file mode 100644
index 5e614d0c..00000000
--- a/finetune/configs/lf/lora_v12_qwen3_8b.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3-8B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: blender3d_v1_train
-eval_dataset: blender3d_v1_val
-template: qwen3
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_blender3d_v1_qwen3_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v12_qwen3_8b
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_v13_boot.yaml b/finetune/configs/lf/lora_v13_boot.yaml
deleted file mode 100644
index 033cb840..00000000
--- a/finetune/configs/lf/lora_v13_boot.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: v13_boot_train
-eval_dataset: v13_boot_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_v13_boot_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v13_boot
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_v1_rep.yaml b/finetune/configs/lf/lora_v1_rep.yaml
deleted file mode 100644
index 919978e9..00000000
--- a/finetune/configs/lf/lora_v1_rep.yaml
+++ /dev/null
@@ -1,45 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: blender3d_v1_train
-eval_dataset: blender3d_v1_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_blender3d_v1_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v1_rep
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
-seed: 1
diff --git a/finetune/configs/lf/lora_v2_indist.yaml b/finetune/configs/lf/lora_v2_indist.yaml
deleted file mode 100644
index a3a34010..00000000
--- a/finetune/configs/lf/lora_v2_indist.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: v2_indist_train
-eval_dataset: v2_indist_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_v2_indist_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v2_indist
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_v2b_indist16k.yaml b/finetune/configs/lf/lora_v2b_indist16k.yaml
deleted file mode 100644
index 0efc29b8..00000000
--- a/finetune/configs/lf/lora_v2b_indist16k.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: v2b_indist16k_train
-eval_dataset: v2b_indist16k_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 16384
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_v2b_indist16k_len16384_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v2b_indist16k
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_v3_bio.yaml b/finetune/configs/lf/lora_v3_bio.yaml
deleted file mode 100644
index 0eafe410..00000000
--- a/finetune/configs/lf/lora_v3_bio.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: v3_bio_train
-eval_dataset: v3_bio_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_v3_bio_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v3_bio
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_v4_cq.yaml b/finetune/configs/lf/lora_v4_cq.yaml
deleted file mode 100644
index 33a62b4d..00000000
--- a/finetune/configs/lf/lora_v4_cq.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: v4_cq_train
-eval_dataset: v4_cq_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_v4_cq_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v4_cq
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_v5_instr.yaml b/finetune/configs/lf/lora_v5_instr.yaml
deleted file mode 100644
index a5eaaa1c..00000000
--- a/finetune/configs/lf/lora_v5_instr.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: v5_instr_train
-eval_dataset: v5_instr_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_v5_instr_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v5_instr
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_v6_detail.yaml b/finetune/configs/lf/lora_v6_detail.yaml
deleted file mode 100644
index f374b184..00000000
--- a/finetune/configs/lf/lora_v6_detail.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: v6_detail_train
-eval_dataset: v6_detail_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_v6_detail_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v6_detail
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_v7_ep4.yaml b/finetune/configs/lf/lora_v7_ep4.yaml
deleted file mode 100644
index afa1ec53..00000000
--- a/finetune/configs/lf/lora_v7_ep4.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: blender3d_v1_train
-eval_dataset: blender3d_v1_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_blender3d_v1_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v7_ep4
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 4.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_v8_r16.yaml b/finetune/configs/lf/lora_v8_r16.yaml
deleted file mode 100644
index 35275900..00000000
--- a/finetune/configs/lf/lora_v8_r16.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 16
-lora_alpha: 32
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: blender3d_v1_train
-eval_dataset: blender3d_v1_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_blender3d_v1_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v8_r16
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/lora_v9_lr2e4.yaml b/finetune/configs/lf/lora_v9_lr2e4.yaml
deleted file mode 100644
index 7d30553d..00000000
--- a/finetune/configs/lf/lora_v9_lr2e4.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: blender3d_v1_train
-eval_dataset: blender3d_v1_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_blender3d_v1_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v9_lr2e4
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0002
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/qwen35_9b_full_sft.yaml b/finetune/configs/lf/qwen35_9b_full_sft.yaml
deleted file mode 100644
index caf070dc..00000000
--- a/finetune/configs/lf/qwen35_9b_full_sft.yaml
+++ /dev/null
@@ -1,41 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: full
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-deepspeed: /wekafs/ict/hx_624/tools/LLaMA-Factory/examples/deepspeed/ds_z3_config.json
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: blender3d_v1_train
-eval_dataset: blender3d_v1_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_qwen35_v1_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_full_v1
-logging_steps: 5
-save_steps: 60
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 3
-learning_rate: 1.0e-05
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 60
-save_total_limit: 1
diff --git a/finetune/configs/lf/qwen35_9b_full_sft_3gpu.yaml b/finetune/configs/lf/qwen35_9b_full_sft_3gpu.yaml
deleted file mode 100644
index 7b00d840..00000000
--- a/finetune/configs/lf/qwen35_9b_full_sft_3gpu.yaml
+++ /dev/null
@@ -1,41 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: full
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-deepspeed: /wekafs/ict/hx_624/tools/LLaMA-Factory/examples/deepspeed/ds_z3_config.json
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: blender3d_v1_train
-eval_dataset: blender3d_v1_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_qwen35_v1_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_full_v2_3gpu
-logging_steps: 5
-save_steps: 1000
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 3
-learning_rate: 1.0e-05
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 50
-save_total_limit: 1
diff --git a/finetune/configs/lf/qwen35_9b_full_sft_4gpu.yaml b/finetune/configs/lf/qwen35_9b_full_sft_4gpu.yaml
deleted file mode 100644
index a461fa6d..00000000
--- a/finetune/configs/lf/qwen35_9b_full_sft_4gpu.yaml
+++ /dev/null
@@ -1,41 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: full
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-deepspeed: /wekafs/ict/hx_624/tools/LLaMA-Factory/examples/deepspeed/ds_z3_config.json
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: blender3d_v1_train
-eval_dataset: blender3d_v1_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_qwen35_v1_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_full_v3_4gpu
-logging_steps: 5
-save_steps: 1000
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 2
-learning_rate: 1.0e-05
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 1000
-save_total_limit: 1
diff --git a/finetune/configs/lf/qwen35_9b_lora_sft.yaml b/finetune/configs/lf/qwen35_9b_lora_sft.yaml
deleted file mode 100644
index 599e6dff..00000000
--- a/finetune/configs/lf/qwen35_9b_lora_sft.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-flash_attn: fa2
-stage: sft
-do_train: true
-finetuning_type: lora
-lora_rank: 64
-lora_alpha: 128
-lora_dropout: 0.05
-lora_target: all
-freeze_vision_tower: true
-freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: blender3d_v1_train
-eval_dataset: blender3d_v1_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-dataloader_num_workers: 4
-neat_packing: true
-packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_qwen35_v1_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v1
-logging_steps: 5
-save_steps: 50
-save_only_model: true
-plot_loss: true
-overwrite_output_dir: true
-report_to: tensorboard
-per_device_train_batch_size: 1
-gradient_accumulation_steps: 8
-learning_rate: 0.0001
-num_train_epochs: 2.0
-lr_scheduler_type: cosine
-warmup_ratio: 0.05
-bf16: true
-gradient_checkpointing: true
-ddp_timeout: 180000000
-resume_from_checkpoint: null
-per_device_eval_batch_size: 1
-eval_strategy: steps
-eval_steps: 100
-save_total_limit: 2
diff --git a/finetune/configs/lf/qwen35_9b_preprocess.yaml b/finetune/configs/lf/qwen35_9b_preprocess.yaml
deleted file mode 100644
index b3683907..00000000
--- a/finetune/configs/lf/qwen35_9b_preprocess.yaml
+++ /dev/null
@@ -1,17 +0,0 @@
-model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B
-trust_remote_code: true
-stage: sft
-do_train: true
-finetuning_type: lora
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/lf
-dataset: blender3d_v1_train
-eval_dataset: blender3d_v1_val
-template: qwen3_5
-enable_thinking: false
-cutoff_len: 8192
-preprocessing_num_workers: 16
-packing: true
-neat_packing: true
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tokenized_qwen35_v1_len8192_packed
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/_preprocess_tmp
-overwrite_output_dir: true
diff --git a/finetune/configs/lf/lora_9b_full.yaml b/finetune/configs/lf/sft_9b_lora64_lr1e-4_len8k_full9b.yaml
similarity index 100%
rename from finetune/configs/lf/lora_9b_full.yaml
rename to finetune/configs/lf/sft_9b_lora64_lr1e-4_len8k_full9b.yaml
diff --git a/finetune/configs/lf/lora_9b_remote.yaml b/finetune/configs/lf/sft_9b_lora64_lr1e-4_len8k_hub-remote.yaml
similarity index 100%
rename from finetune/configs/lf/lora_9b_remote.yaml
rename to finetune/configs/lf/sft_9b_lora64_lr1e-4_len8k_hub-remote.yaml
diff --git a/finetune/configs/lf/lora_9b_mmmix2.yaml b/finetune/configs/lf/sft_9b_lora64_lr1e-4_len8k_mmmix-noleak.yaml
similarity index 100%
rename from finetune/configs/lf/lora_9b_mmmix2.yaml
rename to finetune/configs/lf/sft_9b_lora64_lr1e-4_len8k_mmmix-noleak.yaml
diff --git a/finetune/configs/lf/lora_9b_plus.yaml b/finetune/configs/lf/sft_9b_lora64_lr1e-4_len8k_mmmix-plus.yaml
similarity index 100%
rename from finetune/configs/lf/lora_9b_plus.yaml
rename to finetune/configs/lf/sft_9b_lora64_lr1e-4_len8k_mmmix-plus.yaml
diff --git a/finetune/configs/lf/lora_9b_pairsmix.yaml b/finetune/configs/lf/sft_9b_lora64_lr1e-4_len8k_pairsmix.yaml
similarity index 100%
rename from finetune/configs/lf/lora_9b_pairsmix.yaml
rename to finetune/configs/lf/sft_9b_lora64_lr1e-4_len8k_pairsmix.yaml
diff --git a/finetune/configs/lf/lora_9b_imgmix.yaml b/finetune/configs/lf/sft_9b_lora64_lr1e-4_len8k_pubimg.yaml
similarity index 75%
rename from finetune/configs/lf/lora_9b_imgmix.yaml
rename to finetune/configs/lf/sft_9b_lora64_lr1e-4_len8k_pubimg.yaml
index 66e1b19f..c6fc30ac 100644
--- a/finetune/configs/lf/lora_9b_imgmix.yaml
+++ b/finetune/configs/lf/sft_9b_lora64_lr1e-4_len8k_pubimg.yaml
@@ -10,9 +10,8 @@ lora_dropout: 0.05
lora_target: all
freeze_vision_tower: true
freeze_multi_modal_projector: true
-dataset_dir: /wekafs/ict/hx_624/llm-ft/data/img_mix
-dataset: img_code_train,md_9b_noleak_train
-eval_dataset: md_9b_clean_val
+dataset_dir: /wekafs/ict/hx_624/llm-ft/data/pub_img
+dataset: pub_img
template: qwen3_5
enable_thinking: false
cutoff_len: 8192
@@ -20,8 +19,8 @@ preprocessing_num_workers: 16
dataloader_num_workers: 4
neat_packing: false
packing: false
-tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_img_mix
-output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_imgmix
+tokenized_path: /wekafs/ict/hx_624/llm-ft/data/lf/tok_pubimg
+output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_pubimg
logging_steps: 5
save_steps: 500
save_only_model: true
@@ -39,6 +38,7 @@ gradient_checkpointing: true
ddp_timeout: 180000000
resume_from_checkpoint: null
per_device_eval_batch_size: 1
-eval_strategy: steps
+eval_strategy: "no"
eval_steps: 500
save_total_limit: 4
+media_dir: /wekafs/ict/hx_624/data/pair_media_root
diff --git a/finetune/data_specs/dataset_info.json b/finetune/data_specs/dataset_info.json
index b17d1313..2e792468 100644
--- a/finetune/data_specs/dataset_info.json
+++ b/finetune/data_specs/dataset_info.json
@@ -650,5 +650,16 @@
"chosen": "chosen",
"rejected": "rejected"
}
+ },
+ "stop_dpo_pairs_plusr2": {
+ "file_name": "stop_dpo_pairs_plusr2.json",
+ "ranking": true,
+ "formatting": "sharegpt",
+ "columns": {
+ "messages": "conversations",
+ "system": "system",
+ "chosen": "chosen",
+ "rejected": "rejected"
+ }
}
}
\ No newline at end of file
diff --git a/finetune/docs/REPORT.md b/finetune/docs/REPORT.md
index 0a030a6b..f21e4a37 100644
--- a/finetune/docs/REPORT.md
+++ b/finetune/docs/REPORT.md
@@ -10,12 +10,16 @@ Qwen3.5-9B / Qwen3.8-27B 在 3DCodeVerse 上的微调记录。评测全部是**
| 模型 | bench | blender | cadquery | openscad | glsl | threejs |
|---|---|---|---|---|---|---|
-| **best+stopDPO**(贪心) | **95.8%** | 92.2% | 39.5% | 82.0% | 49.5% | 57.5% |
-| **stopDPO_r2**(采样) | 89.1% | 92.2% | **97.5%** | **94.0%** | **87.0%** | 60.0% |
-| mmmix2(纯 SFT) | 93.9% | 92.2% | 94.5% | 6.0% | 60.0% | 45.0% |
-| 基座 Qwen3.5-9B(未微调) | ~0% | 1.0% | 10.0% | 46.0% | 39.0% | 77.5% |
+| **best+stopDPO**(贪心) | 95.8% | 92.2% | 39.5% | 82.0% | 49.5% | 57.5% |
+| **md_9b_plus+stopDPO**(贪心) | 85.9% | 93.2% | 99.0% | 74.0% | 79.5% | 75.0% |
+| **md_9b_plus+stopDPO**(采样) | 86.8% | 91.3% | 98.0% | 82.0% | 85.0% | 42.5% |
+| **stopDPO_r2**(采样) | 89.1% | 92.2% | 97.5% | 94.0% | 87.0% | 60.0% |
+| mmmix2(纯 SFT,未修复) | 93.9% | 92.2% | 94.5% | 6.0% | 60.0% | 45.0% |
+| 基座 Qwen3.5-9B(未微调) | 0.0% | 1.0% | 10.0% | 46.0% | 39.0% | 77.5% |
-没有单一模型在所有方言上最好。`best+stopDPO` 的 3DCodeBench 最高,`stopDPO_r2` 的方言覆盖最好。
+没有单一模型在所有方言上最好:`best+stopDPO` 的 3DCodeBench 最高,`stopDPO_r2` 的方言覆盖最好,`md_9b_plus+stopDPO` 最均衡。
+
+每一个带 stopDPO 的模型都比它自己的 SFT 底座在四到五个方言上更好——第 3 节说明了为什么。
---
diff --git a/finetune/scripts/README.md b/finetune/scripts/README.md
index 9c0da89f..9d775b76 100644
--- a/finetune/scripts/README.md
+++ b/finetune/scripts/README.md
@@ -1,62 +1,19 @@
-# `scripts/` — index
+# scripts/
-88 shell scripts and 32 Python scripts. Most are **one-off runners**: a single experiment's
-"train → merge → evaluate" recipe, kept so the run in `runs/` can be reproduced. You almost never need to
-read one unless you are reproducing that specific experiment.
-
-The files below are the ones that are actually infrastructure.
-
-## The five you will use
+Everything here is generic. Per-experiment drivers were one-offs bound to a single config; they are in
+`archive/scripts/` (kept on disk, not synced).
| script | what it does |
|---|---|
-| `lf_train.sh <cfg> [k=v ...]` | train. `GPUS=0,1,2,3` picks devices; extra `key=value` args override the YAML. Called by 53 other scripts. |
-| `lf_export.sh <cfg>` | merge a LoRA adapter into its base so vLLM can load it. Called by 57 other scripts. |
-| `free_gpus.sh [min_free_mb]` | list GPUs with enough free memory. The scheduling primitive everything waits on. |
-| `supervisor2.sh` | the job queue. Reads `queue.txt` (`<label>\|<command>` per line), runs one job at a time when the GPUs are free, records completions in `logs/.supervisor_done`, logs to `logs/supervisor.log`. |
-| `sync_repo.sh ["msg"]` | mirror `scripts/ configs/ eval/` + docs into `repos/3dcodeverse/finetune/` and push. |
-
-`queue.txt` is the live work list — append a line to schedule a job; `supervisor2.sh` picks it up.
-
-## Runner naming
-
-```
-run_<model>_<experiment>.sh train + merge + evaluate one experiment end to end
-run_exp*.sh, run_md_exp.sh parameterised runners: pass an experiment name, they generate the config
-*_dpo_round.sh build preference pairs by executing samples, then DPO, then evaluate
-*_ckpt_sweep.sh merge and evaluate every checkpoint of one run
-eval_*.sh, *_eval.sh evaluation only, against an already-merged model
-build_*.py dataset construction (see `docs/REPORT.md` §2)
-```
-
-Generation of a merge config is inlined in each runner as a `sed` over
-`configs/lf/export_lora_template.yaml` — see [`configs/README.md`](../configs/README.md) §2.
-
-## Two pairs that look like duplicates
-
-* **`supervisor2.sh` supersedes `archive/supervisor.sh`.** Identical except that `supervisor2.sh`
- re-checks the done-list after its GPU wait, which can last hours. Without that check a job whose
- label was completed by another process meanwhile got run a second time (this happened to
- `mm_multisuite`). Use `supervisor2.sh`.
-* **`eval/eval_all_run2.sh` supersedes `eval/eval_all.sh`** and is what all 20 current callers use.
- `eval_all.sh` is kept only because `run_27b.sh` still names it, and because `docs/REPORT.md` quotes it
- when reporting the zero-shot baselines. The two differ by one comment line; they are functionally
- identical.
-
-## `archive/`
-
-Nine scripts, referenced by nothing and superseded:
-
-* `supervisor.sh` — see above.
-* `after_lora.sh` — superseded by `after_lora_v2.sh` (vLLM merge-and-eval path with an HF fallback).
- `logs/after_lora.log` is 0 bytes: it never produced output.
-* `explore_sched.sh` — the first 8-hour scheduling plan, replaced by `explore_sched2.sh` the same day
- when GPU availability changed. `logs/explore_sched.log` is 0 bytes; `explore_sched2.log` is not.
-* `run_full_ft2.sh` … `run_full_ft7.sh` — six successive one-off edits of `run_full_ft.sh`, each changing
- only which log line it waits for before starting. They produced no run of their own.
-
-## Do not edit a running script
-
-Bash reads a script incrementally *as it executes it*, so editing one mid-run corrupts the run. This has
-already broken two 9B evaluations in this project. Check `pgrep -af 'scripts/'` before touching anything,
-and copy to a new filename instead of editing in place.
+| `lf_train.sh <config>` | run a LLaMA-Factory config on `GPUS=<ids>` |
+| `train_when_free.sh <config> [need_mib] [log]` | wait for a card that is *still* free at launch, retry if another user takes it mid-load |
+| `free_gpus.sh [need_mib] [gpu_list]` | list cards with that much free memory (the box is shared) |
+| `lf_export.sh <config>` / `export_lora.sh <run_dir> [base]` | merge a LoRA adapter into `<run_dir>/merged` |
+| `stop_dpo_pairs.sh` | build termination preference pairs (`TAG`, `BASE_MODEL` env) |
+| `stop_dpo_round.sh <base_model> <tag>` | one full stop-DPO round: pairs → train → merge |
+| `supervisor2.sh` | keeps the queue in `queue.txt` running and warns on idle cards |
+| `sync_repo.sh` | mirror scripts/configs/eval + REPORT.md to the 3dcodeverse repo |
+
+Data tooling: `build_pairs_3dcodebench.py` (pair builder), `convert_subdirs.py`, `shrink_pair_images.py`,
+`audit_pairs.py` (**run before publishing** — scans every row for absolute paths, missing images and
+`<image>`-count mismatches), `upload_pairs.py`, `drop_old_pair_trees.py`, `verify_unflattened_glsl.py`.
diff --git a/finetune/scripts/after_lora_v2.sh b/finetune/scripts/after_lora_v2.sh
deleted file mode 100755
index c490d139..00000000
--- a/finetune/scripts/after_lora_v2.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-# wait LoRA-v1 -> merge -> test vLLM on GPU 0 -> eval merged model with vLLM (GPU 0); fallback: HF sharded eval on GPUs 0,2
-RUN=/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v1; cd /wekafs/ict/hx_624/llm-ft
-until [ -f $RUN/train_results.json ] || ! pgrep -f "configs/lf/qwen35_9b_lora_sft.yaml" >/dev/null; do sleep 20; done
-[ -f $RUN/train_results.json ] || { echo "LORA_TRAIN_DID_NOT_FINISH"; exit 1; }
-echo "[after_lora] train finished: $(tr -d '\n' < $RUN/train_results.json)"
-scripts/lf_export.sh configs/lf/export_lora_template.yaml > logs/export_lora_v1.log 2>&1 && echo "[after_lora] export done" || { echo "EXPORT_FAILED"; exit 1; }
-echo "[after_lora] vllm smoke test on GPU 0"
-if GPUS=0 eval/run_eval_vllm.sh /wekafs/ict/hx_624/models/Qwen3.5-9B eval/out/_vllm_smoke --no_think --limit 8 --max_new_tokens 1024 > logs/vllm_smoke.log 2>&1; then
- echo "[after_lora] VLLM_OK -> eval merged model with vLLM on GPU 0"
- GPUS=0 eval/run_eval_vllm.sh $RUN/merged eval/out/qwen35_9b_lora_v1 --no_think --max_new_tokens 6144 > logs/eval_qwen35_9b_lora_v1.log 2>&1
-else
- echo "[after_lora] VLLM_FAILED -> HF eval on GPUs 0,2"; tail -20 logs/vllm_smoke.log
- GPUS=0,2 eval/run_eval.sh $RUN/merged eval/out/qwen35_9b_lora_v1 --no_think --batch_size 48 --max_new_tokens 6144 > logs/eval_qwen35_9b_lora_v1.log 2>&1
-fi
-echo "[after_lora] eval done"; cat eval/out/qwen35_9b_lora_v1/summary.json; echo AFTER_LORA_DONE
diff --git a/finetune/scripts/analyze_3dcodeverse.py b/finetune/scripts/analyze_3dcodeverse.py
deleted file mode 100644
index 699914fd..00000000
--- a/finetune/scripts/analyze_3dcodeverse.py
+++ /dev/null
@@ -1,54 +0,0 @@
-"""Survey every metadata.parquet in 3DCodeVerse: counts, code length, caption availability, language, license, multi_file.
-Writes data/analysis/3dcodeverse_survey.md (+ .json). Token counts are estimated with the Qwen3.5 tokenizer on a sample."""
-import glob, json, os, random, sys
-import numpy as np, pandas as pd
-ROOT = "/wekafs/ict/hx_624/data/3dcodeverse_meta"
-OUT = "/wekafs/ict/hx_624/llm-ft/data/analysis"; os.makedirs(OUT, exist_ok=True)
-try:
- from transformers import AutoTokenizer
- tok = AutoTokenizer.from_pretrained("/wekafs/ict/hx_624/models/Qwen3.5-9B")
-except Exception as e:
- tok = None; print("no tokenizer:", e)
-random.seed(0)
-rows = []
-files = sorted(glob.glob(f"{ROOT}/**/metadata.parquet", recursive=True))
-print(len(files), "metadata.parquet files")
-agg = {}
-for f in files:
- rel = os.path.relpath(os.path.dirname(f), ROOT)
- src = rel.split("/")[0]
- df = pd.read_parquet(f)
- n = len(df)
- code = df["code"].fillna("")
- clen = code.str.len().values
- meta0 = json.loads(df["meta_json"].iloc[0]) if "meta_json" in df and n else {}
- lang = df["language"].iloc[0] if "language" in df else meta0.get("language")
- caps = df["captions"].iloc[0] if "captions" in df else None
- cap_keys = list(caps.keys()) if isinstance(caps, dict) else []
- # caption availability
- def has(k): return float(np.mean([isinstance(c, dict) and bool(c.get(k)) for c in df["captions"]])) if "captions" in df else 0.0
- cap_avail = {k: round(has(k), 3) for k in ["detailed", "instruction", "factory", "brief", "synthetic_prompt"]}
- # token estimate on up to 200 random samples
- tok_p50 = tok_p90 = tok_mean = None
- if tok is not None and n:
- idx = random.sample(range(n), min(200, n))
- tl = np.array([len(tok(code.iloc[i]).input_ids) for i in idx])
- tok_p50, tok_p90, tok_mean = int(np.percentile(tl, 50)), int(np.percentile(tl, 90)), float(tl.mean())
- uniq = code.nunique()
- rows.append(dict(subset=rel, source=src, n=n, language=lang, license=meta0.get("license"), multi_file=meta0.get("multi_file"),
- entry=meta0.get("entry"), chars_p50=int(np.percentile(clen, 50)) if n else 0, chars_p90=int(np.percentile(clen, 90)) if n else 0,
- tok_p50=tok_p50, tok_p90=tok_p90, tok_mean=tok_mean, est_total_tokens=(tok_mean * n if tok_mean else None),
- unique_code_frac=round(uniq / max(n, 1), 3), caption_keys=cap_keys, cap_avail=cap_avail, columns=list(df.columns)))
- a = agg.setdefault(src, dict(n=0, est_tokens=0.0, langs=set()))
- a["n"] += n; a["est_tokens"] += (tok_mean * n if tok_mean else 0); a["langs"].add(str(lang))
- print(f"{rel:45s} n={n:6d} lang={str(lang):16s} tok_p50={tok_p50} tok_p90={tok_p90} uniq={uniq/max(n,1):.2f} caps={cap_avail}")
-json.dump({"subsets": rows, "by_source": {k: dict(n=v["n"], est_tokens=v["est_tokens"], langs=sorted(v["langs"])) for k, v in agg.items()}},
- open(f"{OUT}/3dcodeverse_survey.json", "w"), indent=1, default=str)
-with open(f"{OUT}/3dcodeverse_survey.md", "w") as f:
- f.write("| source | #samples | languages | est. tokens (code only) |\n|---|---|---|---|\n")
- for k, v in sorted(agg.items(), key=lambda kv: -kv[1]["n"]):
- f.write(f"| {k} | {v['n']} | {', '.join(sorted(v['langs']))} | {v['est_tokens']/1e6:.1f}M |\n")
- f.write("\n| subset | n | lang | tok p50 | tok p90 | unique code | captions (detailed/instruction/factory) | license |\n|---|---|---|---|---|---|---|---|\n")
- for r in rows:
- f.write(f"| {r['subset']} | {r['n']} | {r['language']} | {r['tok_p50']} | {r['tok_p90']} | {r['unique_code_frac']} | {r['cap_avail']['detailed']}/{r['cap_avail']['instruction']}/{r['cap_avail']['factory']} | {r['license']} |\n")
-print("written", OUT)
diff --git a/finetune/scripts/archive/after_lora.sh b/finetune/scripts/archive/after_lora.sh
deleted file mode 100755
index e5bf6f3b..00000000
--- a/finetune/scripts/archive/after_lora.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-# wait for LoRA run to finish -> merge adapter -> eval merged model on 3DCodeBench
-RUN=/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v1
-cd /wekafs/ict/hx_624/llm-ft
-until [ -f $RUN/train_results.json ] || ! pgrep -f "configs/lf/qwen35_9b_lora_sft.yaml" >/dev/null; do sleep 20; done
-[ -f $RUN/train_results.json ] || { echo "LORA_TRAIN_DID_NOT_FINISH"; exit 1; }
-echo "[after_lora] train finished: $(cat $RUN/train_results.json | tr -d '\n')"
-scripts/lf_export.sh configs/lf/export_lora_template.yaml > logs/export_lora_v1.log 2>&1 && echo "[after_lora] export done" || { echo "EXPORT_FAILED"; exit 1; }
-ls $RUN/merged | head
-GPUS=${EVAL_GPUS:-1} eval/run_eval.sh $RUN/merged eval/out/qwen35_9b_lora_v1 --no_think --batch_size 48 --max_new_tokens 6144 > logs/eval_qwen35_9b_lora_v1.log 2>&1
-echo "[after_lora] eval done"; cat eval/out/qwen35_9b_lora_v1/summary.json; echo AFTER_LORA_DONE
diff --git a/finetune/scripts/archive/explore_sched.sh b/finetune/scripts/archive/explore_sched.sh
deleted file mode 100755
index c758f847..00000000
--- a/finetune/scripts/archive/explore_sched.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/bash
-# 8h exploration scheduler: (1) after md_xl sweep + DPO finish -> md_bal LoRA on 4 GPUs (train+evals)
-# (2) right after md_bal 'train done' -> full FT on the same md_bal data on GPUs 1,2,3 (ZeRO-3) (3) after md_bal evals free GPU 0 -> geometry-feedback DPO train+eval on GPU 0
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-until grep -q "\[bigsweep\] DONE" logs/md_xl_ckpt_sweep.log 2>/dev/null; do sleep 60; done
-until grep -qE "\[xldpo\] (DONE|TRAIN FAILED|EXPORT.* FAILED)" logs/md_xl_dpo_round.log 2>/dev/null; do sleep 60; done
-echo "[sched] $(date) md_bal LoRA on GPUs 0,1,2,3"
-scripts/run_md_exp.sh 0,1,2,3 md_bal > logs/exp_md_bal.log 2>&1 &
-until grep -qE "\[md md_bal\] .*train done|TRAIN FAILED" logs/exp_md_bal.log 2>/dev/null; do sleep 60; done
-sleep 60
-echo "[sched] $(date) full FT md_bal on GPUs 1,2,3 (ZeRO-3, accum 3)"
-( GPUS=1,2,3 scripts/lf_train.sh configs/lf/full_md_bal.yaml gradient_accumulation_steps=3 > logs/train_full_md_bal.log 2>&1
- RUN=runs/lf_qwen35_9b_full_md_bal; [ -f $RUN/train_results.json ] || { echo "[sched] FULL TRAIN FAILED"; exit 1; }
- echo "[sched] $(date) full md_bal train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-200)"
- until grep -q "\[md md_bal\] DONE" logs/exp_md_bal.log 2>/dev/null; do sleep 60; done # wait until GPU 1 is surely free of md_bal evals? (evals run on GPU 0) -> use GPU 1
- GPUS=1 eval/run_eval_vllm.sh $RUN eval/out/qwen35_9b_full_md_bal --no_think --max_new_tokens 6144 > logs/eval_full_md_bal.log 2>&1
- echo "[sched] full md_bal 3DCodeBench: $(python3 -c "import json; s=json.load(open('eval/out/qwen35_9b_full_md_bal/summary.json')); print(s['exec_ok'], round(s['[email protected]_mean_all(fail=0)'],3))")"
- GPUS=1 eval/run_dialect_eval.sh $RUN full_md_bal > logs/mdeval_full_md_bal.log 2>&1
- for D in cadquery openscad glsl blender; do echo "[sched] full md_bal $D: $(cat eval/out/md_full_md_bal_$D/summary.json | tr -d '\n ' | cut -c1-160)"; done
- echo "[sched] FULL_DONE" ) &
-until grep -q "\[md md_bal\] DONE" logs/exp_md_bal.log 2>/dev/null; do sleep 60; done
-until grep -q "GEO_PAIRS_READY" logs/geo_dpo_build.log 2>/dev/null; do sleep 60; done
-echo "[sched] $(date) geometry-feedback DPO on GPU 0"
-GPUS=0 scripts/lf_train.sh configs/lf/dpo_geo_md_xl.yaml gradient_accumulation_steps=8 cutoff_len=4096 > logs/train_dpo_geo_md_xl.log 2>&1
-RUN=runs/lf_qwen35_9b_dpo_geo_md_xl; [ -f $RUN/train_results.json ] || { echo "[sched] GEO DPO TRAIN FAILED"; grep -E "Error" logs/train_dpo_geo_md_xl.log | grep -v errors | tail -2 | cut -c1-200; }
-if [ -f $RUN/train_results.json ]; then
- echo "[sched] $(date) geo dpo train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-200)"
- BASE=runs/lf_qwen35_9b_lora_md_xl/merged_geo
- sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_dpo_geo_md_xl.yaml
- scripts/lf_export.sh configs/lf/export_dpo_geo_md_xl.yaml > logs/export_dpo_geo_md_xl.log 2>&1
- GPUS=0 eval/run_eval_vllm.sh $RUN/merged eval/out/qwen35_9b_dpo_geo_md_xl --no_think --max_new_tokens 6144 > logs/eval_dpo_geo_md_xl.log 2>&1
- echo "[sched] geo dpo 3DCodeBench: $(python3 -c "import json; s=json.load(open('eval/out/qwen35_9b_dpo_geo_md_xl/summary.json')); print(s['exec_ok'], round(s['[email protected]_mean_all(fail=0)'],3), 'scored', round(s['[email protected]_mean_scored'],3))")"
- GPUS=0 eval/run_dialect_eval.sh $RUN/merged dpo_geo_md_xl blender cadquery > logs/mdeval_dpo_geo_md_xl.log 2>&1
- for D in blender cadquery; do echo "[sched] geo dpo $D: $(cat eval/out/md_dpo_geo_md_xl_$D/summary.json | tr -d '\n ' | cut -c1-200)"; done
- GPUS=0 eval/best_of_n.sh $RUN/merged dpo_geo_md_xl_T07 4 0.7 2>&1 | grep -E "pass@" | tail -1 | sed 's/^/[sched] geo dpo /'
-fi
-echo "[sched] GEO_DONE"
-wait; echo "[sched] ALL DONE"
diff --git a/finetune/scripts/archive/run_full_ft2.sh b/finetune/scripts/archive/run_full_ft2.sh
deleted file mode 100755
index 6ee08257..00000000
--- a/finetune/scripts/archive/run_full_ft2.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-# Full-parameter SFT (ZeRO-3) on GPUs 0,1,2 after all LoRA queues finish, then eval.
-cd /wekafs/ict/hx_624/llm-ft
-until grep -q "QUEUE_DONE gpu=0" logs/queue_gpu0.log 2>/dev/null && grep -q "QUEUE_DONE gpu=1" logs/queue_gpu1.log 2>/dev/null && grep -q "QUEUE_DONE gpu=2" logs/exp_v3_bio_retry.log 2>/dev/null; do sleep 60; done
-until [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i 0,1,2 | sort -n | tail -1)" -lt 10000 ]; do sleep 30; done
-RUN=/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_full_v1
-echo "[full] $(date) start full FT on GPUs 0,1,2"
-GPUS=0,1,2 scripts/lf_train.sh configs/lf/qwen35_9b_full_sft.yaml > logs/train_full_v1.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[full] TRAIN FAILED"; exit 1; }
-echo "[full] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-if [ -f eval/.vllm_ok ]; then GPUS=0 eval/run_eval_vllm.sh $RUN eval/out/qwen35_9b_full_v1 --no_think --max_new_tokens 6144 > logs/eval_full_v1.log 2>&1
-else GPUS=0,1,2 eval/run_eval.sh $RUN eval/out/qwen35_9b_full_v1 --no_think --batch_size 48 --max_new_tokens 6144 > logs/eval_full_v1.log 2>&1; fi
-echo "[full] $(date) eval done"; cat eval/out/qwen35_9b_full_v1/summary.json; echo FULL_FT_DONE
diff --git a/finetune/scripts/archive/run_full_ft3.sh b/finetune/scripts/archive/run_full_ft3.sh
deleted file mode 100755
index b9fc1a6d..00000000
--- a/finetune/scripts/archive/run_full_ft3.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-# Full-parameter SFT (ZeRO-3) on GPUs 0,1,2 after all LoRA queues finish, then eval.
-cd /wekafs/ict/hx_624/llm-ft
-until grep -q "QUEUE_DONE gpu=0" logs/queue_gpu0.log 2>/dev/null && grep -q "QUEUE_DONE gpu=1" logs/queue_gpu1.log 2>/dev/null && grep -q "QUEUE_DONE gpu=2" logs/exp_v3_bio_retry.log 2>/dev/null && grep -q "CKPT_SWEEP_DONE v7_ep4" logs/ckpt_sweep_main.log 2>/dev/null; do sleep 60; done
-until [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i 0,1,2 | sort -n | tail -1)" -lt 10000 ]; do sleep 30; done
-RUN=/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_full_v1
-echo "[full] $(date) start full FT on GPUs 0,1,2"
-GPUS=0,1,2 scripts/lf_train.sh configs/lf/qwen35_9b_full_sft.yaml > logs/train_full_v1.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[full] TRAIN FAILED"; exit 1; }
-echo "[full] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-if [ -f eval/.vllm_ok ]; then GPUS=0 eval/run_eval_vllm.sh $RUN eval/out/qwen35_9b_full_v1 --no_think --max_new_tokens 6144 > logs/eval_full_v1.log 2>&1
-else GPUS=0,1,2 eval/run_eval.sh $RUN eval/out/qwen35_9b_full_v1 --no_think --batch_size 48 --max_new_tokens 6144 > logs/eval_full_v1.log 2>&1; fi
-echo "[full] $(date) eval done"; cat eval/out/qwen35_9b_full_v1/summary.json; echo FULL_FT_DONE
diff --git a/finetune/scripts/archive/run_full_ft4.sh b/finetune/scripts/archive/run_full_ft4.sh
deleted file mode 100755
index f9c4bcec..00000000
--- a/finetune/scripts/archive/run_full_ft4.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-# Full-parameter SFT after LoRA queues + ckpt sweeps; uses GPUs 0,1,2 (ZeRO-3) if GPU 2 is free, else GPUs 0,1 with ZeRO-3 + CPU offload. Then eval, then the postponed v2b LoRA on GPU 0.
-cd /wekafs/ict/hx_624/llm-ft
-until grep -q "QUEUE_DONE gpu=0" logs/queue_gpu0.log 2>/dev/null && grep -q "QUEUE_DONE gpu=1" logs/queue_gpu1.log 2>/dev/null && grep -q "CKPT_SWEEP_DONE v7_ep4" logs/ckpt_sweep_main.log 2>/dev/null; do sleep 60; done
-until [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i 0,1 | sort -n | tail -1)" -lt 10000 ]; do sleep 30; done
-RUN=/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_full_v1
-if [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i 2)" -lt 10000 ]; then
- echo "[full] $(date) GPU 2 free -> 3 GPUs, ZeRO-3 (no offload), grad_accum=3"
- GPUS=0,1,2 scripts/lf_train.sh configs/lf/qwen35_9b_full_sft.yaml gradient_accumulation_steps=3 > logs/train_full_v1.log 2>&1
-else
- echo "[full] $(date) GPU 2 busy (other user) -> 2 GPUs, ZeRO-3 + CPU optimizer offload, grad_accum=4"
- GPUS=0,1 scripts/lf_train.sh configs/lf/qwen35_9b_full_sft.yaml deepspeed=/wekafs/ict/hx_624/llm-ft/configs/lf/ds_z3_offload.json gradient_accumulation_steps=4 > logs/train_full_v1.log 2>&1
-fi
-[ -f $RUN/train_results.json ] || { echo "[full] TRAIN FAILED"; tail -30 logs/train_full_v1.log | cut -c1-200; exit 1; }
-echo "[full] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-GPUS=0 eval/run_eval_vllm.sh $RUN eval/out/qwen35_9b_full_v1 --no_think --max_new_tokens 6144 > logs/eval_full_v1.log 2>&1
-echo "[full] $(date) eval done"; cat eval/out/qwen35_9b_full_v1/summary.json; echo FULL_FT_DONE
-# postponed ablation
-scripts/run_exp.sh 0 v2b_indist16k 2>&1 | tee -a logs/exp_v2b_indist16k.log
diff --git a/finetune/scripts/archive/run_full_ft5.sh b/finetune/scripts/archive/run_full_ft5.sh
deleted file mode 100755
index e98fa64c..00000000
--- a/finetune/scripts/archive/run_full_ft5.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-# Full-parameter SFT after LoRA queues + ckpt sweeps; uses GPUs 0,1,2 (ZeRO-3) if GPU 2 is free, else GPUs 0,1 with ZeRO-3 + CPU offload. Then eval, then the postponed v2b LoRA on GPU 0.
-cd /wekafs/ict/hx_624/llm-ft
-until grep -q "QUEUE_DONE gpu=0" logs/queue_gpu0.log 2>/dev/null && grep -q "QUEUE_DONE gpu=1" logs/queue_gpu1.log 2>/dev/null && grep -q "CKPT_SWEEP_DONE v7_ep4" logs/ckpt_sweep_main.log 2>/dev/null && grep -q "CKPT_SWEEP_DONE v3_bio" logs/ckpt_sweep_v3.log 2>/dev/null; do sleep 60; done
-until [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i 0,1 | sort -n | tail -1)" -lt 10000 ]; do sleep 30; done
-RUN=/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_full_v1
-if [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i 2)" -lt 10000 ]; then
- echo "[full] $(date) GPU 2 free -> 3 GPUs, ZeRO-3 (no offload), grad_accum=3"
- GPUS=0,1,2 scripts/lf_train.sh configs/lf/qwen35_9b_full_sft.yaml gradient_accumulation_steps=3 > logs/train_full_v1.log 2>&1
-else
- echo "[full] $(date) GPU 2 busy (other user) -> 2 GPUs, ZeRO-3 + CPU optimizer offload, grad_accum=4"
- GPUS=0,1 scripts/lf_train.sh configs/lf/qwen35_9b_full_sft.yaml deepspeed=/wekafs/ict/hx_624/llm-ft/configs/lf/ds_z3_offload.json gradient_accumulation_steps=4 > logs/train_full_v1.log 2>&1
-fi
-[ -f $RUN/train_results.json ] || { echo "[full] TRAIN FAILED"; tail -30 logs/train_full_v1.log | cut -c1-200; exit 1; }
-echo "[full] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-GPUS=0 eval/run_eval_vllm.sh $RUN eval/out/qwen35_9b_full_v1 --no_think --max_new_tokens 6144 > logs/eval_full_v1.log 2>&1
-echo "[full] $(date) eval done"; cat eval/out/qwen35_9b_full_v1/summary.json; echo FULL_FT_DONE
diff --git a/finetune/scripts/archive/run_full_ft6.sh b/finetune/scripts/archive/run_full_ft6.sh
deleted file mode 100755
index c02a36ea..00000000
--- a/finetune/scripts/archive/run_full_ft6.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-# Full-parameter SFT: start as soon as the GPU-0 queue is done; use whichever of GPUs 0,1,2 are free (3 -> ZeRO-3, 2 -> ZeRO-3 + CPU offload). Then eval.
-cd /wekafs/ict/hx_624/llm-ft
-until grep -q "QUEUE_DONE gpu=0" logs/queue_gpu0.log 2>/dev/null; do sleep 60; done
-while true; do
- FREE=$(for g in 0 1 2; do [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i $g)" -lt 10000 ] && echo -n "$g,"; done | sed 's/,$//')
- N=$(echo $FREE | tr ',' '\n' | grep -c .)
- [ "$N" -ge 2 ] && break; sleep 30
-done
-RUN=/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_full_v1
-if [ "$N" -ge 3 ]; then
- echo "[full] $(date) GPUs $FREE -> ZeRO-3 (no offload), grad_accum=3"
- GPUS=$FREE scripts/lf_train.sh configs/lf/qwen35_9b_full_sft.yaml gradient_accumulation_steps=3 > logs/train_full_v1.log 2>&1
-else
- echo "[full] $(date) GPUs $FREE -> ZeRO-3 + CPU optimizer offload, grad_accum=4"
- GPUS=$FREE scripts/lf_train.sh configs/lf/qwen35_9b_full_sft.yaml deepspeed=/wekafs/ict/hx_624/llm-ft/configs/lf/ds_z3_offload.json gradient_accumulation_steps=4 > logs/train_full_v1.log 2>&1
-fi
-[ -f $RUN/train_results.json ] || { echo "[full] TRAIN FAILED"; grep -E "Error|error" logs/train_full_v1.log | tail -5 | cut -c1-200; exit 1; }
-echo "[full] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-G1=$(echo $FREE | cut -d, -f1)
-GPUS=$G1 eval/run_eval_vllm.sh $RUN eval/out/qwen35_9b_full_v1 --no_think --max_new_tokens 6144 > logs/eval_full_v1.log 2>&1
-echo "[full] $(date) eval done"; cat eval/out/qwen35_9b_full_v1/summary.json; echo FULL_FT_DONE
diff --git a/finetune/scripts/archive/run_full_ft7.sh b/finetune/scripts/archive/run_full_ft7.sh
deleted file mode 100755
index 0e9ca0bf..00000000
--- a/finetune/scripts/archive/run_full_ft7.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-# Full-parameter SFT: start as soon as the GPU-0 queue is done; use whichever of GPUs 0,1,2 are free (3 -> ZeRO-3, 2 -> ZeRO-3 + CPU offload). Then eval.
-cd /wekafs/ict/hx_624/llm-ft
-until grep -q "\[exp v2b_indist16k\] .*gen done" logs/exp_v2b_indist16k.log 2>/dev/null && grep -q "\[exp v8_r16\] .*gen done" logs/exp_v8_r16.log 2>/dev/null; do sleep 30; done; sleep 30
-while true; do
- FREE=$(for g in 0 1 2; do [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i $g)" -lt 10000 ] && echo -n "$g,"; done | sed 's/,$//')
- N=$(echo $FREE | tr ',' '\n' | grep -c .)
- [ "$N" -ge 2 ] && break; sleep 30
-done
-RUN=/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_full_v1
-if [ "$N" -ge 3 ]; then
- echo "[full] $(date) GPUs $FREE -> ZeRO-3 (no offload), grad_accum=3"
- GPUS=$FREE scripts/lf_train.sh configs/lf/qwen35_9b_full_sft.yaml gradient_accumulation_steps=3 > logs/train_full_v1.log 2>&1
-else
- echo "[full] $(date) GPUs $FREE -> ZeRO-3 + CPU optimizer offload, grad_accum=4"
- GPUS=$FREE scripts/lf_train.sh configs/lf/qwen35_9b_full_sft.yaml deepspeed=/wekafs/ict/hx_624/llm-ft/configs/lf/ds_z3_offload.json gradient_accumulation_steps=4 > logs/train_full_v1.log 2>&1
-fi
-[ -f $RUN/train_results.json ] || { echo "[full] TRAIN FAILED"; grep -E "Error|error" logs/train_full_v1.log | tail -5 | cut -c1-200; exit 1; }
-echo "[full] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-G1=$(echo $FREE | cut -d, -f1)
-GPUS=$G1 eval/run_eval_vllm.sh $RUN eval/out/qwen35_9b_full_v1 --no_think --max_new_tokens 6144 > logs/eval_full_v1.log 2>&1
-echo "[full] $(date) eval done"; cat eval/out/qwen35_9b_full_v1/summary.json; echo FULL_FT_DONE
diff --git a/finetune/scripts/archive/supervisor.sh b/finetune/scripts/archive/supervisor.sh
deleted file mode 100755
index 3cbcd8d5..00000000
--- a/finetune/scripts/archive/supervisor.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-# Keeps GPUs 0-3 busy: runs the pending jobs in scripts/queue.txt one at a time, restarts nothing that succeeded,
-# and reports every state change to logs/supervisor.log. One line per job: "<label>|<command>".
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-Q=scripts/queue.txt; STATE=logs/.supervisor_done
-touch $STATE
-while true; do
- PENDING=""
- while IFS='|' read -r label cmd; do
- [ -z "${label:-}" ] && continue
- case "$label" in \#*) continue;; esac
- grep -qx "$label" $STATE || { PENDING="$label|$cmd"; break; }
- done < $Q
- if [ -z "$PENDING" ]; then
- echo "[sup] $(date) queue empty — idling (add a line to $Q to continue)"
- IDLE_MIN=0
- while [ -z "$PENDING" ]; do
- sleep 300; IDLE_MIN=$((IDLE_MIN+5))
- [ $((IDLE_MIN % 30)) -eq 0 ] && echo "[sup] WARNING $(date) idle ${IDLE_MIN}m with GPUs [$(scripts/free_gpus.sh)] free"
- while IFS='|' read -r label cmd; do
- [ -z "${label:-}" ] && continue; case "$label" in \#*) continue;; esac
- grep -qx "$label" $STATE || { PENDING="$label|$cmd"; break; }
- done < $Q
- done
- fi
- label="${PENDING%%|*}"; cmd="${PENDING#*|}"
- # wait until no training/inference of mine is running and the GPUs are idle (3 confirmations)
- STABLE=0
- while [ $STABLE -lt 3 ]; do
- # count only REAL trainer/inference processes (python/torchrun): a plain `pgrep -f` also matches
- # monitoring shells whose own command line contains these strings, which deadlocks the queue
- MINE=0
- for pid in $(pgrep -u $USER -f "llamafactory-cli train|generate_multi.py|generate_vllm.py" 2>/dev/null); do
- case "$(ps -o comm= -p $pid 2>/dev/null)" in python*|torchrun*|pt_main*) MINE=$((MINE+1));; esac
- done
- F=$(scripts/free_gpus.sh); N=$(echo "$F" | awk -F, 'NF&&$1!=""{print NF}')
- if [ "$MINE" -eq 0 ] && [ "${N:-0}" -ge 2 ]; then STABLE=$((STABLE+1)); else STABLE=0; fi
- sleep 30
- done
- echo "[sup] $(date) starting: $label"
- bash -c "$cmd" >> logs/sup_$label.log 2>&1
- RC=$?
- if [ $RC -eq 0 ]; then echo "[sup] $(date) OK: $label"; else echo "[sup] $(date) FAILED (rc=$RC): $label — see logs/sup_$label.log"; fi
- echo "$label" >> $STATE
-done
diff --git a/finetune/scripts/audit_pairs.py b/finetune/scripts/audit_pairs.py
index 3297f383..176d3401 100644
--- a/finetune/scripts/audit_pairs.py
+++ b/finetune/scripts/audit_pairs.py
@@ -52,13 +52,13 @@ def main():
if not str(r.get("system") or "").strip():
bad["empty_system"] += 1
if kind == "text":
- if "<image>" in conv[0]["value"]:
+ if any("<image>" in t["value"] for t in conv):
bad["placeholder_in_text_pair"] += 1
continue
# `or []` on a numpy array raises rather than defaulting; the same numpy-vs-list confusion as above
raw = r.get("images")
imgs = [str(x) for x in raw] if raw is not None else []
- if conv[0]["value"].count("<image>") != len(imgs):
+ if sum(t["value"].count("<image>") for t in conv) != len(imgs):
bad["placeholder_mismatch"] += 1
for x in imgs:
tot += 1
diff --git a/finetune/scripts/bon8_v1.sh b/finetune/scripts/bon8_v1.sh
deleted file mode 100755
index 2d58f997..00000000
--- a/finetune/scripts/bon8_v1.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-# best-of-8 for LoRA-v1: 8 sampled generations (T=0.7) on 4 GPUs now; Blender exec deferred until round-2 exec finishes (CPU contention); then pass@n
-cd /wekafs/ict/hx_624/llm-ft; PFX=qwen35_9b_lora_v1_T07
-scripts/lf_export.sh configs/lf/export_v1.yaml > logs/export_v1_bon8.log 2>&1 || { echo "[bon8] EXPORT FAILED"; exit 1; }
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING
-for round in 0 1; do
- for g in 0 1 2 3; do i=$((round*4+g+1)); [ $i -le 4 ] && continue # samples 1-4 already exist
- OUT=eval/out/${PFX}_s$i; mkdir -p $OUT
- CUDA_VISIBLE_DEVICES=$g python eval/generate_vllm.py --model runs/lf_qwen35_9b_lora_v1/merged --prompts data/sft_v1/bench_prompts.jsonl --out $OUT --tp 1 --no_think --max_new_tokens 6144 --temperature 0.7 --seed $i > $OUT/gen.log 2>&1 &
- done; wait
-done
-for i in 5 6 7 8; do cp eval/out/${PFX}_s$i/gens_shard0.jsonl eval/out/${PFX}_s$i/gens.jsonl; grep gen-vllm eval/out/${PFX}_s$i/gen.log | tail -1; done
-rm -rf runs/lf_qwen35_9b_lora_v1/merged; echo "[bon8] $(date) gens done (s5-s8)"
-until grep -q "\[r2\] .*exec done" logs/self_train_round2.log 2>/dev/null; do sleep 60; done
-conda activate llmft
-for i in 5 6 7 8; do OUT=eval/out/${PFX}_s$i; python eval/run_bench.py --gen_dir $OUT --workers 32 --timeout 300 > $OUT/exec.log 2>&1; python eval/metrics.py --gen_dir $OUT > $OUT/metrics.log 2>&1; grep "status counts" $OUT/exec.log; done
-python eval/pass_at_n.py $PFX 8; python eval/pass_at_n.py $PFX 4; echo "[bon8] DONE"
diff --git a/finetune/scripts/build_boot_data.py b/finetune/scripts/build_boot_data.py
deleted file mode 100644
index 75e81a34..00000000
--- a/finetune/scripts/build_boot_data.py
+++ /dev/null
@@ -1,37 +0,0 @@
-"""Build bootstrapped SFT sets from execution-verified generations (proper python file; the earlier bash-heredoc version mangled the ```python fence via backtick substitution).
-usage: build_boot_data.py <round_dir> <out_name> [--base data/sft_v1]"""
-import argparse, glob, hashlib, json, os, random, shutil
-ap = argparse.ArgumentParser(); ap.add_argument("round_dir"); ap.add_argument("out_name"); ap.add_argument("--base", default="data/sft_v1"); ap.add_argument("--max_per_prompt", type=int, default=2)
-a = ap.parse_args(); random.seed(0)
-W = a.round_dir
-prompts = {}
-for f in glob.glob(f"{W}/prompts*.jsonl"):
- for l in open(f):
- r = json.loads(l); prompts[r["task"]] = r
-base = [json.loads(l) for l in open(f"{a.base}/train.jsonl")]
-def h_of(code): return hashlib.sha1(("```python\n" + code + "\n```").encode()).hexdigest()
-base_hashes = {hashlib.sha1(r["messages"][-1]["content"].encode()).hexdigest() for r in base}
-seen = set(base_hashes); new = []; n_ok = 0; dup_base = 0; dup_self = 0; per_prompt = {}
-for d in sorted(glob.glob(f"{W}/gen_s*/")) + sorted(glob.glob(f"{W}/gen_s*_g*/")):
- if not os.path.exists(os.path.join(d, "exec_results.jsonl")): continue
- for l in open(os.path.join(d, "exec_results.jsonl")):
- r = json.loads(l)
- if r["status"] != "OK": continue
- n_ok += 1
- code = open(os.path.join(d, r["task"], "code.py")).read().strip()
- if code.count("\n") < 4: continue
- h = h_of(code)
- if h in base_hashes: dup_base += 1; continue
- if h in seen: dup_self += 1; continue
- if per_prompt.get(r["task"], 0) >= a.max_per_prompt: continue
- seen.add(h); per_prompt[r["task"]] = per_prompt.get(r["task"], 0) + 1
- p = prompts[r["task"]]
- new.append({"messages": p["messages"][:2] + [{"role": "assistant", "content": "```python\n" + code + "\n```"}],
- "source": "boot_" + str(p.get("src", p.get("source", "train"))), "id": r["task"], "prompt_kind": "boot"})
-out = f"data/{a.out_name}"; os.makedirs(out, exist_ok=True)
-allrows = base + new; random.shuffle(allrows)
-with open(f"{out}/train.jsonl", "w") as f:
- for r in allrows: f.write(json.dumps(r, ensure_ascii=False) + "\n")
-shutil.copy(f"{a.base}/val.jsonl", f"{out}/val.jsonl")
-stats = {"n_train": len(allrows), "n_base": len(base), "n_new": len(new), "n_ok_generations": n_ok, "dup_of_training_code": dup_base, "dup_within_generations": dup_self, "prompts_with_new": len(per_prompt)}
-json.dump(stats, open(f"{out}/stats.json", "w"), indent=1); print(json.dumps(stats))
diff --git a/finetune/scripts/build_exp_log.py b/finetune/scripts/build_exp_log.py
deleted file mode 100644
index 2120c40c..00000000
--- a/finetune/scripts/build_exp_log.py
+++ /dev/null
@@ -1,155 +0,0 @@
-"""Generate llm_finetune_exps.md — the full experiment log, built from what is actually on disk.
-
-Reads every training run (runs/*/train_results.json + its LLaMA-Factory config) and every evaluation
-(eval/out/*/summary.json + extract_stats.json), joins them by the naming conventions used in this project,
-and writes one markdown file with: the run inventory, 3DCodeBench results, per-dialect results, and the
-zero-shot baselines. Curated commentary lives in docs/REPORT.md; this file is the raw log.
-
-usage: python scripts/build_exp_log.py > llm_finetune_exps_generated.md
-"""
-import glob
-import json
-import os
-import re
-
-ROOT = "/wekafs/ict/hx_624/llm-ft"
-CFG = f"{ROOT}/configs/lf"
-
-
-def jload(p, default=None):
- try:
- return json.load(open(p))
- except Exception:
- return default
-
-
-def yload(p):
- try:
- import yaml
- return yaml.safe_load(open(p))
- except Exception:
- return {}
-
-
-def hhmm(sec):
- if not sec:
- return "–"
- h, m = divmod(int(sec) // 60, 60)
- return f"{h}h{m:02d}m" if h else f"{m}m"
-
-
-def run_rows():
- rows = []
- for d in sorted(glob.glob(f"{ROOT}/runs/*/")):
- name = os.path.basename(d.rstrip("/"))
- if name.startswith("_smoke"):
- continue
- tr = jload(os.path.join(d, "train_results.json")) or jload(os.path.join(d, "all_results.json"))
- if not tr:
- continue
- # find the config that produced it
- cfg = {}
- for c in glob.glob(f"{CFG}/*.yaml"):
- y = yload(c)
- if isinstance(y, dict) and str(y.get("output_dir", "")).rstrip("/").endswith(name):
- cfg = y
- cfg["_file"] = os.path.basename(c)
- break
- rows.append({
- "run": name,
- "base": os.path.basename(str(cfg.get("model_name_or_path", "")).rstrip("/")) or "–",
- "stage": cfg.get("stage", "–"),
- "type": ("full" if cfg.get("finetuning_type") == "full" else f"lora r{cfg.get('lora_rank', '?')}") if cfg else "–",
- "data": cfg.get("dataset", "–"),
- "cutoff": cfg.get("cutoff_len", "–"),
- "epochs": tr.get("epoch", cfg.get("num_train_epochs", "–")),
- "lr": cfg.get("learning_rate", "–"),
- "ds": "zero3" if cfg.get("deepspeed") else "ddp",
- "loss": round(tr["train_loss"], 3) if tr.get("train_loss") is not None else "–",
- "eval_loss": round(tr["eval_loss"], 3) if tr.get("eval_loss") is not None else "–",
- "runtime": hhmm(tr.get("train_runtime")),
- "cfg": cfg.get("_file", "–"),
- })
- return rows
-
-
-def bench_rows():
- rows = []
- for p in sorted(glob.glob(f"{ROOT}/eval/out/*/summary.json")):
- s = jload(p, {})
- if "exec_ok_rate" not in s:
- continue
- name = p.split("/")[-2]
- x = jload(os.path.join(os.path.dirname(p), "extract_stats.json"), {}) or {}
- rows.append({
- "eval": name,
- "n": s.get("n_tasks"),
- "exec": s.get("exec_ok"),
- "rate": round(100 * s["exec_ok_rate"], 1),
- "f05_all": s.get("[email protected]_mean_all(fail=0)"),
- "f05_ok": s.get("[email protected]_mean_scored"),
- "f01_ok": s.get("[email protected]_mean_scored"),
- "chamfer": s.get("chamfer_mean_scored"),
- "tok": x.get("mean_new_tokens"),
- })
- return sorted(rows, key=lambda r: -r["rate"])
-
-
-def dialect_rows():
- rows = []
- for p in sorted(glob.glob(f"{ROOT}/eval/out/*/summary.json")):
- s = jload(p, {})
- if "dialect" not in s:
- continue
- name = p.split("/")[-2]
- rate = s.get("gen_exec_rate", s.get("exec_rate"))
- rows.append({
- "eval": name,
- "dialect": s["dialect"],
- "n": s.get("n"),
- "ok": s.get("gen_exec_ok", s.get("exec_ok")),
- "rate": round(100 * rate, 1) if rate is not None else None,
- "ref_ok": s.get("ref_exec_ok"),
- "f05_all": s.get("[email protected]_mean_all"),
- "f05_ok": s.get("[email protected]_mean_scored"),
- "chamfer": s.get("chamfer_mean_scored"),
- })
- return rows
-
-
-def fmt(v, nd=3):
- if v is None:
- return "–"
- if isinstance(v, float):
- return f"{v:.{nd}f}"
- return str(v)
-
-
-def main():
- print("## A. Training runs (from `runs/*/train_results.json` + the config that produced each)\n")
- print("| run | base | stage | method | data | cutoff | ep | lr | par | train loss | eval loss | wall | config |")
- print("|---|---|---|---|---|---|---|---|---|---|---|---|---|")
- for r in run_rows():
- print(f"| `{r['run']}` | {r['base']} | {r['stage']} | {r['type']} | `{r['data']}` | {r['cutoff']} | {fmt(r['epochs'],1)} | {r['lr']} | {r['ds']} | {r['loss']} | {r['eval_loss']} | {r['runtime']} | `{r['cfg']}` |")
-
- print("\n## B. 3DCodeBench (212 tasks: generate → run in Blender → export GLB → Chamfer/F vs GT)\n")
- print("| eval run | exec | rate | [email protected] (all, fail=0) | [email protected] (ok) | [email protected] (ok) | Chamfer (ok) | mean out tok |")
- print("|---|---|---|---|---|---|---|---|")
- for r in bench_rows():
- print(f"| `{r['eval']}` | {r['exec']}/{r['n']} | {r['rate']}% | {fmt(r['f05_all'])} | {fmt(r['f05_ok'])} | {fmt(r['f01_ok'])} | {fmt(r['chamfer'])} | {fmt(r['tok'],0)} |")
-
- print("\n## C. Held-out dialect sets (per-dialect executors; reference code is executed the same way)\n")
- for dia in ["blender_heldout", "cadquery", "openscad", "glsl", "threejs"]:
- rs = [r for r in dialect_rows() if r["dialect"] == dia]
- if not rs:
- continue
- rs.sort(key=lambda r: -(r["rate"] or 0))
- print(f"\n### {dia} (n={rs[0]['n']}, reference exec OK={rs[0]['ref_ok'] if rs[0]['ref_ok'] else '–'})\n")
- print("| eval run | exec | rate | [email protected] (all) | [email protected] (ok) | Chamfer (ok) |")
- print("|---|---|---|---|---|---|")
- for r in rs:
- print(f"| `{r['eval']}` | {r['ok']}/{r['n']} | {r['rate']}% | {fmt(r['f05_all'])} | {fmt(r['f05_ok'])} | {fmt(r['chamfer'])} |")
-
-
-if __name__ == "__main__":
- main()
diff --git a/finetune/scripts/build_hf_dataset.py b/finetune/scripts/build_hf_dataset.py
deleted file mode 100644
index f5a08d6f..00000000
--- a/finetune/scripts/build_hf_dataset.py
+++ /dev/null
@@ -1,231 +0,0 @@
-"""Package the finetuning data as a HuggingFace dataset in LLaMA-Factory (ShareGPT) format.
-
-Design: publish the *corpus* + the *recipes* + the *derived* sets, not the 15 near-duplicate training mixes
-(they are all samples of the same corpus and would multiply the size for nothing — `scripts/sample_mix.py`
-regenerates any of them from a one-line budget spec).
-
- sft/<dialect>/train-*.parquet the md_max corpus (768k prompt→code pairs), sharded by dialect
- sft/blender_bootstrapped/ 15.7k execution-verified Blender samples generated by the flywheel
- dpo/<name>.parquet execution-feedback and geometry-feedback preference pairs
- test/<dialect>.parquet the held-out evaluation sets (never trained on)
- dataset_info.json drop-in LLaMA-Factory registry for everything above
- mixes.json the exact budget spec of every mix used in the report
- README.md dataset card
-
-usage: python scripts/build_hf_dataset.py [--out /wekafs/ict/hx_624/hf_ds] [--push ilabai/3dcodeverse-llamafactory] [--private]
-"""
-import argparse
-import collections
-import glob
-import json
-import os
-
-import pandas as pd
-
-ROOT = "/wekafs/ict/hx_624/llm-ft"
-SHARD_ROWS = 50000
-
-MIXES = {
- "md_xl": {"desc": "9B best SFT mix (3DCodeBench 90.1%)", "budget": "blender=all,openscad=all(x4),threejs=all,cadquery=all,glsl=all", "captions_per_sample": 1,
- "extra": "+15.7k bootstrapped blender", "pairs": 270173, "tokens": "293M"},
- "md_big": {"desc": "half-size predecessor of md_xl (84.9%)", "budget": "cadquery=40k rows,glsl=40k rows,openscad=all(x4),blender=all", "captions_per_sample": 1,
- "extra": "+15.7k bootstrapped blender", "pairs": 101851, "tokens": "107M"},
- "md_27b_v2s": {"desc": "27B best mix (3DCodeBench 93.4%) — blender-heavy", "budget": "blender=all(x2)+bootstrapped, cadquery=25M tok, glsl=25M tok, openscad=all(x4), threejs=all, web=all",
- "captions_per_sample": 2, "extra": "filtered to <=3400 tokens", "pairs": 103770, "tokens": "75M"},
- "md_27b_v3": {"desc": "27B rebalanced (cadquery restored)", "budget": "cadquery=45M tok, glsl=20M tok, blender=all+bootstrapped, openscad/threejs/web=all",
- "captions_per_sample": 1, "extra": "filtered to <=3400 tokens", "pairs": 107366, "tokens": "73M"},
- "md_max_9b": {"desc": "caption-augmentation ablation — NEGATIVE result (3DCodeBench 34.4%)", "budget": "cadquery=140M tok, glsl=140M tok, rest=all",
- "captions_per_sample": 3, "extra": "no bootstrapped data", "pairs": 363708, "tokens": "304M"},
- "md_v3": {"desc": "control for the above (86.8%)", "budget": "cadquery=140M tok, glsl=140M tok, rest=all", "captions_per_sample": 1,
- "extra": "+15.7k bootstrapped blender", "pairs": 272802, "tokens": "236M"},
-}
-
-DPO_SETS = {
- "exec_feedback_blender_r1": ("data/lf/dpo_exec_pairs.json", "2,590 (runs, fails) pairs from LoRA-v1 samples executed in Blender → 75%→93.9% on 3DCodeBench"),
- "exec_feedback_blender_r2": ("data/lf/dpo_exec_pairs_r2.json", "second round on the round-1 model → 96.2%"),
- "exec_feedback_multidialect_md_mixed": ("data/lf/dpo_md_pairs.json", "581 pairs across 4 dialects (md_mixed policy)"),
- "exec_feedback_multidialect_md_big": ("data/lf/dpo_md_big_pairs.json", "1,052 pairs (md_big policy)"),
- "exec_feedback_multidialect_md_xl": ("data/lf/dpo_md_xl_pairs.json", "909 pairs (md_xl policy)"),
- "exec_feedback_27b": ("data/lf/dpo_27b_pairs.json", "756 pairs from the tuned Qwen3.8-27B (three.js 92.5%→100%)"),
- "geometry_feedback": ("data/lf/dpo_geo_pairs.json", "2,357 pairs ranked by [email protected] against the reference mesh — the only signal that moved geometric fidelity"),
-}
-
-
-def write_parquet(rows, path_prefix, cols=None):
- os.makedirs(os.path.dirname(path_prefix), exist_ok=True)
- n = 0
- for i in range(0, len(rows), SHARD_ROWS):
- chunk = rows[i: i + SHARD_ROWS]
- df = pd.DataFrame(chunk, columns=cols) if cols else pd.DataFrame(chunk)
- suffix = f"-{i // SHARD_ROWS:05d}" if len(rows) > SHARD_ROWS else ""
- df.to_parquet(f"{path_prefix}{suffix}.parquet", index=False, compression="zstd")
- n += 1
- return n
-
-
-def main():
- ap = argparse.ArgumentParser()
- ap.add_argument("--out", default="/wekafs/ict/hx_624/hf_ds")
- ap.add_argument("--push", default=None, help="repo id, e.g. ilabai/3dcodeverse-llamafactory")
- ap.add_argument("--private", action="store_true")
- a = ap.parse_args()
- os.makedirs(a.out, exist_ok=True)
- info, stats = {}, {}
-
- # ---- 1. the corpus, sharded by dialect (ShareGPT: conversations + system) ----
- by = collections.defaultdict(list)
- for split in ("train", "val"):
- for l in open(f"{ROOT}/data/md_max/{split}.jsonl"):
- r = json.loads(l)
- msgs = r["messages"]
- by[r["dialect"]].append({
- "id": r["id"], "subset": r["subset"], "caption_type": r["caption"], "split": split,
- "system": msgs[0]["content"],
- "conversations": [{"from": "human", "value": msgs[1]["content"]},
- {"from": "gpt", "value": msgs[2]["content"]}],
- })
- for dia, rows in by.items():
- nsh = write_parquet(rows, f"{a.out}/sft/{dia}/train")
- info[f"3dcv_{dia}"] = {"file_name": f"sft/{dia}", "formatting": "sharegpt", "columns": {"messages": "conversations", "system": "system"}}
- stats[f"sft/{dia}"] = {"rows": len(rows), "shards": nsh}
- print(f"[hf] sft/{dia}: {len(rows)} rows, {nsh} shard(s)")
-
- # ---- 2. the bootstrapped Blender set (execution-verified, generated by our own flywheel) ----
- boot = []
- for l in open(f"{ROOT}/data/sft_v13_boot/train.jsonl"):
- if '"source": "boot_' not in l:
- continue
- m = json.loads(l)["messages"]
- boot.append({"system": m[0]["content"],
- "conversations": [{"from": "human", "value": m[1]["content"]}, {"from": "gpt", "value": m[2]["content"]}]})
- write_parquet(boot, f"{a.out}/sft/blender_bootstrapped/train")
- info["3dcv_blender_bootstrapped"] = {"file_name": "sft/blender_bootstrapped", "formatting": "sharegpt", "columns": {"messages": "conversations", "system": "system"}}
- stats["sft/blender_bootstrapped"] = {"rows": len(boot), "shards": 1}
- print(f"[hf] sft/blender_bootstrapped: {len(boot)} rows")
-
- # ---- 3. preference sets ----
- for name, (path, desc) in DPO_SETS.items():
- p = os.path.join(ROOT, path)
- if not os.path.exists(p):
- print(f"[hf] skip {name} (missing)")
- continue
- rows = json.load(open(p))
- write_parquet(rows, f"{a.out}/dpo/{name}")
- info[f"3dcv_dpo_{name}"] = {"file_name": f"dpo/{name}.parquet", "ranking": True, "formatting": "sharegpt",
- "columns": {"messages": "conversations", "system": "system", "chosen": "chosen", "rejected": "rejected"}}
- stats[f"dpo/{name}"] = {"rows": len(rows), "desc": desc}
- print(f"[hf] dpo/{name}: {len(rows)} pairs")
-
- # ---- 4. held-out test sets ----
- for f in sorted(glob.glob(f"{ROOT}/data/multidialect/*/test.jsonl")):
- dia = f.split("/")[-2]
- rows = []
- for l in open(f):
- r = json.loads(l)
- m = r["messages"]
- rows.append({"id": r["id"], "system": m[0]["content"], "prompt": m[1]["content"], "reference_code": m[2]["content"]})
- write_parquet(rows, f"{a.out}/test/{dia}")
- stats[f"test/{dia}"] = {"rows": len(rows)}
- print(f"[hf] test/{dia}: {len(rows)} rows")
-
- json.dump(info, open(f"{a.out}/dataset_info.json", "w"), indent=2, ensure_ascii=False)
- json.dump({"mixes": MIXES, "contents": stats}, open(f"{a.out}/mixes.json", "w"), indent=2, ensure_ascii=False)
-
- total = sum(v.get("rows", 0) for k, v in stats.items() if k.startswith("sft/"))
- card = f"""---
-license: cc-by-nc-sa-4.0
-task_categories:
- - text-generation
-language:
- - en
-tags:
- - 3d
- - code-generation
- - blender
- - cadquery
- - openscad
- - glsl
- - threejs
- - llama-factory
- - sft
- - dpo
-size_categories:
- - 100K<n<1M
----
-
-# 3DCodeVerse — LLaMA-Factory edition
-
-Text→3D-code training data in **LLaMA-Factory ShareGPT format**, derived from
-[`ilabai/3dcodeverse`](https://huggingface.co/datasets/ilabai/3dcodeverse). Same license and non-commercial
-research terms as the parent dataset; the per-source licenses (Infinigen/BSD-3, Bioinspired3D/MIT, Shadertoy/CC BY-NC-SA,
-Thingiverse, DeepCAD/MIT) still apply.
-
-Training and evaluation code: <https://github.com/gaoypeng/3dcodeverse/tree/main/finetune>.
-Full experiment log: [`llm_finetune_exps.md`](https://github.com/gaoypeng/3dcodeverse/blob/main/finetune/llm_finetune_exps.md).
-
-## Contents
-
-| path | what | rows |
-|---|---|---|
-| `sft/blender/` | Blender-Python (bioinspired3d, 3dcodebench factories, blender_distill) | {stats.get('sft/blender', {}).get('rows', 0):,} |
-| `sft/cadquery/` | CadQuery (deepcad, articraft) | {stats.get('sft/cadquery', {}).get('rows', 0):,} |
-| `sft/glsl/` | GLSL fragment shaders (shadertoy) | {stats.get('sft/glsl', {}).get('rows', 0):,} |
-| `sft/openscad/` | OpenSCAD (thingiverse) | {stats.get('sft/openscad', {}).get('rows', 0):,} |
-| `sft/threejs/` | single-file three.js pages | {stats.get('sft/threejs', {}).get('rows', 0):,} |
-| `sft/web/` | animated web pages (animation2code) | {stats.get('sft/web', {}).get('rows', 0):,} |
-| `sft/blender_bootstrapped/` | **execution-verified** Blender samples generated by a finetuned model on novel prompts and kept only if they ran | {stats.get('sft/blender_bootstrapped', {}).get('rows', 0):,} |
-| `dpo/*.parquet` | execution-feedback and geometry-feedback preference pairs (see below) | 8k pairs total |
-| `test/*.parquet` | held-out evaluation sets, never trained on | 593 |
-
-Total SFT pairs: **{total:,}** (one row per prompt variant; each source sample has up to 3 caption styles —
-`caption_type` is `instruction` / `detailed` / `factory`).
-
-## How to use with LLaMA-Factory
-
-```bash
-huggingface-cli download ilabai/3dcodeverse-llamafactory --repo-type dataset --local-dir data/3dcv
-cp data/3dcv/dataset_info.json data/3dcv/ # already there; point dataset_dir at data/3dcv
-llamafactory-cli train your_config.yaml # with: dataset_dir: data/3dcv, dataset: 3dcv_blender,3dcv_cadquery,...
-```
-
-`dataset_info.json` registers every subset (`3dcv_<dialect>`, `3dcv_blender_bootstrapped`, `3dcv_dpo_<name>`).
-
-## Reproducing the mixes from the report
-
-The report's training mixes are *samples* of this corpus, so they are described by a budget rather than shipped
-as duplicated files (`mixes.json` has the exact specs; `scripts/sample_mix.py` in the repo applies them):
-
-| mix | pairs | tokens | captions/sample | result |
-|---|---|---|---|---|
-{chr(10).join(f"| `{k}` | {v['pairs']:,} | {v['tokens']} | {v['captions_per_sample']} | {v['desc']} |" for k, v in MIXES.items())}
-
-## Two findings that matter when using this data
-
-1. **Do not use all three caption variants of the same code sample.** At a fixed token budget, 3 captions per sample
- scored 34.4% on 3DCodeBench versus 90.1% for one caption per sample plus the bootstrapped set — what generalises
- is the number of *distinct runnable programs*, not the number of prompts.
-2. **`sft/blender_bootstrapped/` is the highest-value subset per token.** Adding it (and raising the Blender share to
- ~40%) took a 27B model from 57.6% to 93.4% on 3DCodeBench.
-
-## Evaluation
-
-Execution-based: every generated program is run (Blender 5.0.1 headless / CadQuery / OpenSCAD / glslangValidator /
-headless Chromium) and the resulting mesh compared to the reference with Chamfer distance and F-score. Scripts:
-`finetune/eval/` in the GitHub repo. Note: Blender's bundled Python needs `scipy` — 15 of the 212 3DCodeBench
-reference scripts import it.
-"""
- open(f"{a.out}/README.md", "w").write(card)
- print(f"[hf] wrote {a.out} ({sum(os.path.getsize(p) for p in glob.glob(a.out + '/**/*', recursive=True) if os.path.isfile(p))/1e9:.2f} GB)")
-
- if a.push:
- from huggingface_hub import HfApi
- tok = os.environ.get("HF_TOKEN")
- api = HfApi(token=tok)
- api.create_repo(a.push, repo_type="dataset", private=a.private, exist_ok=True)
- api.upload_folder(folder_path=a.out, repo_id=a.push, repo_type="dataset",
- commit_message="3DCodeVerse in LLaMA-Factory format: SFT corpus by dialect, bootstrapped Blender set, DPO preference sets, held-out tests")
- print(f"[hf] pushed to https://huggingface.co/datasets/{a.push}")
-
-
-if __name__ == "__main__":
- main()
diff --git a/finetune/scripts/build_image_dataset.py b/finetune/scripts/build_image_dataset.py
deleted file mode 100644
index f92b014b..00000000
--- a/finetune/scripts/build_image_dataset.py
+++ /dev/null
@@ -1,163 +0,0 @@
-"""Build an image-conditioned (render → code) dataset in LLaMA-Factory multimodal format.
-
-The `qwen3_5` template already registers a multimodal plugin (`qwen3_vl`, image token `<|image_pad|>`), so an
-`images` column plus an `<image>` placeholder in the user turn is all that is needed — the only change to a normal
-run is `freeze_vision_tower: false` if you want the tower to adapt.
-
-Why this matters for this project: the report shows execution rate responds to more data, but *geometric fidelity*
-(F-score / Chamfer) barely moved across every text-only SFT variant. A reference render carries exactly the signal
-the caption lacks.
-
-Sources (all already on disk):
- bioinspired3d tars 4 views + code per sample, Blender-Python — the dialect 3DCodeBench measures
- blender_distill 4 views per sample
- threejs_distill 4 views per sample
- animation2code 4 views per sample
-
-usage: python scripts/build_image_dataset.py [--out data/img_code] [--views 1] [--max_per_source 20000]
-"""
-import argparse
-import collections
-import glob
-import json
-import os
-import tarfile
-
-IMG_ROOT = "/wekafs/ict/hx_624/data/images"
-SYS = {
- "blender": "You are an expert in procedural 3D modeling with Blender Python (bpy). Given reference renders of an object, write a complete, standalone Blender 5 Python script that reproduces it (clear the default scene first). Output ONLY the code in one ```python block.",
- "threejs": "You are an expert three.js developer. Given reference renders, write a complete, standalone HTML page that reproduces the scene with three.js. Output ONLY the code in one ```html block.",
- "web": "You are an expert creative web developer. Given reference frames of an animation, write a complete, standalone HTML page (inline CSS/JS) that reproduces it. Output ONLY the code in one ```html block.",
-}
-ASK = {
- "blender": "Reproduce this 3D object with Blender Python code.",
- "threejs": "Reproduce this scene as a single-file three.js page.",
- "web": "Reproduce this animation as a single-file animated web page.",
-}
-FENCE = {"blender": "python", "threejs": "html", "web": "html"}
-
-
-def from_tars(pattern, dialect, out_rows, views, cap, caption_too=True):
- n = 0
- for t in sorted(glob.glob(pattern)):
- sub = os.path.basename(os.path.dirname(t))
- try:
- tf = tarfile.open(t)
- except Exception:
- continue
- members = collections.defaultdict(dict)
- for m in tf.getmembers():
- if not m.isfile():
- continue
- parts = m.name.split("/")
- if len(parts) < 2:
- continue
- key = parts[0]
- if m.name.endswith("code.py"):
- members[key]["code"] = m
- elif m.name.endswith("captions.json"):
- members[key]["caps"] = m
- elif "/renders/view_" in m.name and m.name.endswith(".png"):
- members[key].setdefault("imgs", []).append(m)
- for key, d in members.items():
- if "code" not in d or "imgs" not in d:
- continue
- try:
- code = tf.extractfile(d["code"]).read().decode("utf-8", "replace")
- except Exception:
- continue
- if len(code.strip()) < 40:
- continue
- caps = {}
- if caption_too and "caps" in d:
- try:
- caps = json.load(tf.extractfile(d["caps"]))
- except Exception:
- caps = {}
- imgs = sorted(d["imgs"], key=lambda m: m.name)[:views]
- paths = []
- for i, m in enumerate(imgs):
- dst = os.path.join(IMG_ROOT, sub, key, os.path.basename(m.name))
- if not os.path.exists(dst):
- os.makedirs(os.path.dirname(dst), exist_ok=True)
- with open(dst, "wb") as f:
- f.write(tf.extractfile(m).read())
- paths.append(dst)
- if not paths:
- continue
- hint = (caps.get("instruction") or caps.get("detailed") or "").strip()
- ask = ASK[dialect] + (f"\nHint: {hint}" if hint and len(hint) < 400 else "")
- out_rows.append({"id": f"{sub}/{key}", "dialect": dialect, "images": paths,
- "system": SYS[dialect],
- "conversations": [{"from": "human", "value": "<image>" * len(paths) + "\n" + ask},
- {"from": "gpt", "value": f"```{FENCE[dialect]}\n{code.strip()}\n```"}]})
- n += 1
- if n >= cap:
- tf.close()
- return n
- tf.close()
- return n
-
-
-def from_tree(root, dialect, out_rows, views, cap, code_name):
- n = 0
- for cp in sorted(glob.glob(f"/wekafs/ict/hx_624/data/3dcodeverse_files/{root}/*/*/{code_name}")):
- d = os.path.dirname(cp)
- imgs = sorted(glob.glob(os.path.join(d, "renders", "*.png")))[:views]
- if not imgs:
- continue
- code = open(cp, encoding="utf-8", errors="replace").read()
- if len(code.strip()) < 40:
- continue
- caps = {}
- cj = os.path.join(d, "captions.json")
- if os.path.exists(cj):
- try:
- caps = json.load(open(cj))
- except Exception:
- pass
- hint = (caps.get("user_instruction") or caps.get("instruction") or caps.get("brief") or "").strip()
- ask = ASK[dialect] + (f"\nHint: {hint}" if hint and len(hint) < 400 else "")
- out_rows.append({"id": os.path.relpath(d, "/wekafs/ict/hx_624/data/3dcodeverse_files"),
- "dialect": dialect, "images": imgs, "system": SYS[dialect],
- "conversations": [{"from": "human", "value": "<image>" * len(imgs) + "\n" + ask},
- {"from": "gpt", "value": f"```{FENCE[dialect]}\n{code.strip()}\n```"}]})
- n += 1
- if n >= cap:
- return n
- return n
-
-
-def main():
- ap = argparse.ArgumentParser()
- ap.add_argument("--out", default="/wekafs/ict/hx_624/llm-ft/data/img_code")
- ap.add_argument("--views", type=int, default=1)
- ap.add_argument("--max_per_source", type=int, default=20000)
- a = ap.parse_args()
- os.makedirs(IMG_ROOT, exist_ok=True)
- rows = []
- got = {}
- got["bioinspired3d"] = from_tars("/wekafs/ict/hx_624/data/3dcodeverse_tars/bioinspired3d/*/*.tar",
- "blender", rows, a.views, a.max_per_source)
- got["blender_distill"] = from_tree("blender_distill", "blender", rows, a.views, a.max_per_source, "code.py")
- got["threejs_distill"] = from_tree("threejs_distill", "threejs", rows, a.views, a.max_per_source, "code.html")
- got["animation2code"] = from_tree("animation2code", "web", rows, a.views, a.max_per_source, "index.html")
- os.makedirs(a.out, exist_ok=True)
- import random
- random.seed(3)
- random.shuffle(rows)
- val, train = rows[:200], rows[200:]
- for name, part in (("train", train), ("val", val)):
- with open(os.path.join(a.out, f"{name}.json"), "w") as f:
- json.dump(part, f, ensure_ascii=False)
- json.dump({"img_code_train": {"file_name": "train.json", "formatting": "sharegpt",
- "columns": {"messages": "conversations", "system": "system", "images": "images"}},
- "img_code_val": {"file_name": "val.json", "formatting": "sharegpt",
- "columns": {"messages": "conversations", "system": "system", "images": "images"}}},
- open(os.path.join(a.out, "dataset_info.json"), "w"), indent=2)
- print(f"[img] {len(rows)} samples ({dict(got)}), {a.views} view(s) each -> {a.out}")
- print("[img] dialects:", dict(collections.Counter(r["dialect"] for r in rows)))
-
-
-if __name__ == "__main__":
- main()
diff --git a/finetune/scripts/build_md_27b.py b/finetune/scripts/build_md_27b.py
deleted file mode 100644
index 40f0f4e2..00000000
--- a/finetune/scripts/build_md_27b.py
+++ /dev/null
@@ -1,35 +0,0 @@
-"""md_27b: 5-dialect mix sized for a 27B LoRA run (~50M tok/epoch): CadQuery 15k, GLSL 12k, Blender all + boot 8k, OpenSCAD x4, three.js."""
-import json, random, os, sys
-sys.path.insert(0, "/wekafs/ict/hx_624/llm-ft/scripts"); from ntok_cache import load_ntok
-from transformers import AutoTokenizer
-random.seed(14); tok = AutoTokenizer.from_pretrained("/wekafs/ict/hx_624/models/Qwen3.5-9B")
-MD = "/wekafs/ict/hx_624/llm-ft/data/multidialect"; CAP = {"cadquery": 15000, "glsl": 12000, "openscad": 10**9, "blender": 10**9, "threejs": 10**9}; REP = {"openscad": 4}; BOOT_REP = 1; BOOT_CAP = 8000
-def ntok(r): return len(tok(tok.apply_chat_template(r["messages"], tokenize=False)).input_ids)
-out_rows = []; stats = {}
-for d, cap in CAP.items():
- rows = [json.loads(l) for l in open(f"{MD}/{d}/train.jsonl")]; NT = load_ntok(f"{MD}/{d}/train.jsonl", tok)
- for r, n_ in zip(rows, NT): r["_ntok"] = n_
- random.shuffle(rows); keep = []; toks = 0
- for r in rows:
- if len(keep) >= cap: break
- n = r.pop("_ntok")
- if n <= 8192: keep.append(r); toks += n
- rep = REP.get(d, 1); stats[d] = (len(keep) * rep, toks * rep); out_rows += keep * rep
-BOOT = "/wekafs/ict/hx_624/llm-ft/data/sft_v13_boot/train.jsonl"; bl = open(BOOT).read().splitlines(); bn = load_ntok(BOOT, tok)
-boot = [(json.loads(l), n) for l, n in zip(bl, bn) if '"source": "boot_' in l]
-bt = 0; kb = []
-for r, n in boot:
- if n <= 8192: kb.append({"messages": r["messages"], "dialect": "blender", "subset": "boot"}); bt += n
-import random as _r; _r.shuffle(kb); kb = kb[:BOOT_CAP]; bt = sum(n for _, n in kb_ntok[:BOOT_CAP]) if False else int(bt * BOOT_CAP / max(1, len(boot)))
-stats["blender_boot"] = (len(kb), bt); out_rows += kb
-# LLaMA-Factory's qwen3_5 (multimodal) template treats literal <image>/<video>/<audio> in text as media placeholders -> escape them
-def _san(t): return t.replace("<image>", "<image >").replace("<video>", "<video >").replace("<audio>", "<audio >")
-for r in out_rows:
- for m in r["messages"]: m["content"] = _san(m["content"])
-random.shuffle(out_rows)
-out = "/wekafs/ict/hx_624/llm-ft/data/md_27b"; os.makedirs(out, exist_ok=True)
-with open(f"{out}/train.jsonl", "w") as f:
- for r in out_rows: f.write(json.dumps(r, ensure_ascii=False) + "\n")
-os.system(f"cp /wekafs/ict/hx_624/llm-ft/data/md_mixed/val.jsonl {out}/val.jsonl")
-tot = sum(v[1] for v in stats.values())
-print({k: (v[0], round(v[1]/1e6, 1)) for k, v in stats.items()}, "| total samples", len(out_rows), "| tokens/epoch %.1fM" % (tot/1e6))
diff --git a/finetune/scripts/build_md_bal.py b/finetune/scripts/build_md_bal.py
deleted file mode 100644
index 3153d04d..00000000
--- a/finetune/scripts/build_md_bal.py
+++ /dev/null
@@ -1,34 +0,0 @@
-"""md_bal: re-balanced mix (~110M tok like md_big) with a much larger Blender share: bio x4, boot x2, CadQuery 35k, GLSL 25k, OpenSCAD x4, three.js."""
-import json, random, os, sys
-sys.path.insert(0, "/wekafs/ict/hx_624/llm-ft/scripts"); from ntok_cache import load_ntok
-from transformers import AutoTokenizer
-random.seed(13); tok = AutoTokenizer.from_pretrained("/wekafs/ict/hx_624/models/Qwen3.5-9B")
-MD = "/wekafs/ict/hx_624/llm-ft/data/multidialect"; CAP = {"cadquery": 35000, "glsl": 25000, "openscad": 10**9, "blender": 10**9, "threejs": 10**9}; REP = {"openscad": 4, "blender": 4}; BOOT_REP = 2
-def ntok(r): return len(tok(tok.apply_chat_template(r["messages"], tokenize=False)).input_ids)
-out_rows = []; stats = {}
-for d, cap in CAP.items():
- rows = [json.loads(l) for l in open(f"{MD}/{d}/train.jsonl")]; NT = load_ntok(f"{MD}/{d}/train.jsonl", tok)
- for r, n_ in zip(rows, NT): r["_ntok"] = n_
- random.shuffle(rows); keep = []; toks = 0
- for r in rows:
- if len(keep) >= cap: break
- n = r.pop("_ntok")
- if n <= 8192: keep.append(r); toks += n
- rep = REP.get(d, 1); stats[d] = (len(keep) * rep, toks * rep); out_rows += keep * rep
-BOOT = "/wekafs/ict/hx_624/llm-ft/data/sft_v13_boot/train.jsonl"; bl = open(BOOT).read().splitlines(); bn = load_ntok(BOOT, tok)
-boot = [(json.loads(l), n) for l, n in zip(bl, bn) if '"source": "boot_' in l]
-bt = 0; kb = []
-for r, n in boot:
- if n <= 8192: kb.append({"messages": r["messages"], "dialect": "blender", "subset": "boot"}); bt += n
-stats["blender_boot"] = (len(kb) * BOOT_REP, bt * BOOT_REP); out_rows += kb * BOOT_REP
-# LLaMA-Factory's qwen3_5 (multimodal) template treats literal <image>/<video>/<audio> in text as media placeholders -> escape them
-def _san(t): return t.replace("<image>", "<image >").replace("<video>", "<video >").replace("<audio>", "<audio >")
-for r in out_rows:
- for m in r["messages"]: m["content"] = _san(m["content"])
-random.shuffle(out_rows)
-out = "/wekafs/ict/hx_624/llm-ft/data/md_bal"; os.makedirs(out, exist_ok=True)
-with open(f"{out}/train.jsonl", "w") as f:
- for r in out_rows: f.write(json.dumps(r, ensure_ascii=False) + "\n")
-os.system(f"cp /wekafs/ict/hx_624/llm-ft/data/md_mixed/val.jsonl {out}/val.jsonl")
-tot = sum(v[1] for v in stats.values())
-print({k: (v[0], round(v[1]/1e6, 1)) for k, v in stats.items()}, "| total samples", len(out_rows), "| tokens/epoch %.1fM" % (tot/1e6))
diff --git a/finetune/scripts/build_md_big.py b/finetune/scripts/build_md_big.py
deleted file mode 100644
index 57821a86..00000000
--- a/finetune/scripts/build_md_big.py
+++ /dev/null
@@ -1,31 +0,0 @@
-"""md_big: larger multi-dialect SFT set (token-filtered <=8192): blender (multidialect train + v13 bootstrapped), cadquery 40k, glsl 40k, openscad all."""
-import json, random, os, sys
-sys.path.insert(0, "/wekafs/ict/hx_624/llm-ft/scripts"); from ntok_cache import load_ntok
-from transformers import AutoTokenizer
-random.seed(11); tok = AutoTokenizer.from_pretrained("/wekafs/ict/hx_624/models/Qwen3.5-9B")
-MD = "/wekafs/ict/hx_624/llm-ft/data/multidialect"; CAP = {"cadquery": 40000, "glsl": 40000, "openscad": 5000, "blender": 10000}
-def ntok(r): return len(tok(tok.apply_chat_template(r["messages"], tokenize=False)).input_ids)
-out_rows = []; stats = {}
-for d, cap in CAP.items():
- rows = [json.loads(l) for l in open(f"{MD}/{d}/train.jsonl")]; NT = load_ntok(f"{MD}/{d}/train.jsonl", tok)
- for r, n_ in zip(rows, NT): r["_ntok"] = n_
- random.shuffle(rows); keep = []; toks = 0
- for r in rows:
- if len(keep) >= cap: break
- n = r.pop("_ntok")
- if n <= 8192: keep.append(r); toks += n
- stats[d] = (len(keep), toks); out_rows += keep
-# bootstrapped blender samples (execution-verified, novel prompts)
-BOOT = "/wekafs/ict/hx_624/llm-ft/data/sft_v13_boot/train.jsonl"; bl = open(BOOT).read().splitlines(); bn = load_ntok(BOOT, tok)
-boot = [(json.loads(l), n) for l, n in zip(bl, bn) if '"source": "boot_' in l]
-bt = 0; kb = []
-for r, n in boot:
- if n <= 8192: kb.append({"messages": r["messages"], "dialect": "blender", "subset": "boot"}); bt += n
-stats["blender_boot"] = (len(kb), bt); out_rows += kb
-random.shuffle(out_rows)
-out = "/wekafs/ict/hx_624/llm-ft/data/md_big"; os.makedirs(out, exist_ok=True)
-with open(f"{out}/train.jsonl", "w") as f:
- for r in out_rows: f.write(json.dumps(r, ensure_ascii=False) + "\n")
-os.system(f"cp /wekafs/ict/hx_624/llm-ft/data/md_mixed/val.jsonl {out}/val.jsonl")
-tot = sum(v[1] for v in stats.values())
-print({k: (v[0], round(v[1]/1e6, 1)) for k, v in stats.items()}, "| total samples", len(out_rows), "| tokens/epoch %.1fM" % (tot/1e6))
diff --git a/finetune/scripts/build_md_max.py b/finetune/scripts/build_md_max.py
deleted file mode 100644
index 409192f2..00000000
--- a/finetune/scripts/build_md_max.py
+++ /dev/null
@@ -1,246 +0,0 @@
-"""md_max: use EVERY usable 3DCodeVerse sample, with multi-caption prompt expansion (~0.5M prompt→code pairs).
-
-Sources (all parquet metadata + the distilled file trees):
- blender bioinspired3d geo+tex, 3dcodebench factories (test factories removed), blender_distill (*.py)
- cadquery deepcad v1..v1_4, articraft cadquery_single_tex*
- openscad thingiverse/openscad
- glsl shadertoy (112 shards)
- threejs threejs_distill (*.html)
- web animation2code (*.html) — new: animated web/3D pages
-
-Deliberately excluded and why:
- 3dcodebench/instances_* (3904) 100% of them are re-seeded instances of the 212 benchmark factories → test leakage
- articraft/urdf_* (6146) `code` column is empty in the metadata (URDF lives inside the 51 GB tars) and we have no URDF executor
- threejs_repos multi-file projects, not single-file prompt→code
- every id in data/multidialect/*/test.jsonl and the 212 3DCodeBench task names
-
-Each sample yields up to 3 training pairs (captions: instruction / detailed / factory), deduped by (prompt, code).
-Token length is estimated as tokens(code) + tokens(prompt) + template overhead, tokenizing each unique code/prompt once.
-
-usage: python scripts/build_md_max.py [--max_tokens 8192] [--captions 3] [--out data/md_max]
-"""
-import argparse
-import glob
-import hashlib
-import json
-import os
-import random
-import re
-import sys
-import unicodedata
-from concurrent.futures import ProcessPoolExecutor
-
-import pandas as pd
-
-sys.path.insert(0, "/wekafs/ict/hx_624/llm-ft/scripts")
-META = "/wekafs/ict/hx_624/data/3dcodeverse_meta"
-FILES = "/wekafs/ict/hx_624/data/3dcodeverse_files"
-MD = "/wekafs/ict/hx_624/llm-ft/data/multidialect"
-BENCH_DIR = "/wekafs/ict/hx_624/data/3dcodebench/data"
-
-SYS = {
- "blender": "You are an expert in procedural 3D modeling with Blender Python (bpy). Given a description of an object, write a complete, standalone Blender 5 Python script that builds it from scratch (clear the default scene first). Output ONLY the code in one ```python block.",
- "cadquery": "You are an expert CAD programmer. Given a description of a part, write a complete, standalone CadQuery (Python) script that builds it and leaves the final solid in a variable named `result`. Output ONLY the code in one ```python block.",
- "openscad": "You are an expert OpenSCAD programmer. Given a request, write a complete, standalone OpenSCAD (.scad) program that produces the described model. Output ONLY the code in one ```openscad block.",
- "glsl": "You are an expert shader programmer. Given a description, write a complete Shadertoy-style GLSL ES 3.00 fragment shader defining `void mainImage(out vec4 fragColor, in vec2 fragCoord)`. Output ONLY the code in one ```glsl block.",
- "threejs": "You are an expert three.js developer. Given a description, write a complete, standalone HTML page that renders the described 3D scene with three.js (import three from a CDN-style module URL, create a renderer/camera/lights, and animate). Output ONLY the code in one ```html block.",
- "web": "You are an expert creative web developer. Given a description of an animation, write a complete, standalone HTML page (inline CSS/JS, no local assets) that reproduces it. Output ONLY the code in one ```html block.",
-}
-FENCE = {"blender": "python", "cadquery": "python", "openscad": "openscad", "glsl": "glsl", "threejs": "html", "web": "html"}
-LEAD = { # how to phrase a bare description as a request, per dialect
- "blender": "Create the 3D object described below using Python Blender code: ",
- "cadquery": "Write a CadQuery (Python) script that builds the following CAD model: ",
- "openscad": "Write an OpenSCAD program for the following: ",
- "glsl": "Write a GLSL fragment shader for Shadertoy that renders: ",
- "threejs": "Write a standalone three.js page that renders: ",
- "web": "Write a standalone animated web page that reproduces: ",
-}
-IMPERATIVE = ("write", "create", "implement", "make", "build", "generate", "design", "produce")
-
-
-def bad_chars(s):
- return sum(1 for ch in s if unicodedata.category(ch) == "Cc" and ch not in "\n\t\r") + s.count("�")
-
-
-def phrase(dialect, kind, text):
- t = (text or "").strip()
- if not t:
- return None
- if kind == "instruction" and t.lower().startswith(IMPERATIVE):
- return t
- return LEAD[dialect] + t
-
-
-def load_parquet_rows(dialect, sub, drop_names=frozenset()):
- p = f"{META}/{sub}/metadata.parquet"
- if not os.path.exists(p):
- return []
- df = pd.read_parquet(p)
- out = []
- for r in df.itertuples():
- name = str(getattr(r, "name", "") or "")
- norm = name.replace("Factory", "").replace("_geo", "").replace("_tex", "")
- if name in drop_names or name.rsplit("_", 1)[0] in drop_names or norm in drop_names:
- continue
- code = getattr(r, "code", None) or ""
- if not isinstance(code, str) or len(code.strip()) < 40:
- continue
- caps = r.captions if isinstance(r.captions, dict) else (json.loads(r.captions) if isinstance(r.captions, str) else {})
- out.append({"dialect": dialect, "subset": sub, "id": str(r.id), "name": name, "code": code, "caps": dict(caps)})
- return out
-
-
-def load_tree_rows(dialect, root, code_glob):
- """distill / animation2code trees: <sample>/{code.py|code.html|index.html} + captions.json"""
- rows = []
- for cp in glob.glob(f"{FILES}/{root}/{code_glob}", recursive=True):
- d = os.path.dirname(cp)
- capp = os.path.join(d, "captions.json")
- try:
- code = open(cp, encoding="utf-8", errors="replace").read()
- caps = json.load(open(capp)) if os.path.exists(capp) else {}
- except Exception:
- continue
- if len(code.strip()) < 40:
- continue
- rid = f"{root}/{os.path.relpath(d, f'{FILES}/{root}')}"
- caps = {k: v for k, v in caps.items() if isinstance(v, str) and v.strip()}
- # tree sources use their own caption keys -> map onto instruction/detailed
- norm = {}
- if caps.get("user_instruction"): norm["instruction"] = caps["user_instruction"] # imperative request
- if caps.get("instruction"): norm["detailed"] = caps["instruction"] # description
- if caps.get("brief"): # animation2code
- extra = caps.get("function", "")
- norm["instruction"] = (caps["brief"] + ((" — " + extra) if extra and extra not in caps["brief"] else "")).strip()
- if caps.get("source_title") and "detailed" not in norm: norm["detailed"] = caps["source_title"]
- if caps.get("style") and norm.get("detailed"): norm["detailed"] += f" (style: {caps['style']})"
- rows.append({"dialect": dialect, "subset": root, "id": rid, "name": os.path.basename(d), "code": code, "caps": norm or caps})
- return rows
-
-
-_TOK = None
-
-
-def _init_tok():
- global _TOK
- from transformers import AutoTokenizer
- _TOK = AutoTokenizer.from_pretrained("/wekafs/ict/hx_624/models/Qwen3.5-9B")
-
-
-def _ntok(s):
- return len(_TOK(s).input_ids)
-
-
-def main():
- ap = argparse.ArgumentParser()
- ap.add_argument("--max_tokens", type=int, default=8192)
- ap.add_argument("--captions", type=int, default=3, help="max prompt variants per sample")
- ap.add_argument("--out", default="/wekafs/ict/hx_624/llm-ft/data/md_max")
- ap.add_argument("--workers", type=int, default=16)
- a = ap.parse_args()
- random.seed(17)
-
- bench_factories = {os.path.basename(p).replace("_seed0", "") for p in glob.glob(f"{BENCH_DIR}/*_seed0")}
- held_out = set()
- for f in glob.glob(f"{MD}/*/test.jsonl"):
- for l in open(f):
- held_out.add(json.loads(l)["id"])
- print(f"[md_max] excluding {len(bench_factories)} benchmark factories and {len(held_out)} held-out test ids", flush=True)
-
- samples = []
- for sub in ["bioinspired3d/bpy_structures_geo", "bioinspired3d/bpy_structures_tex", "3dcodebench/factories_geo", "3dcodebench/factories_tex"]:
- samples += load_parquet_rows("blender", sub, bench_factories)
- for sub in sorted(glob.glob(f"{META}/deepcad/*/metadata.parquet")) + sorted(glob.glob(f"{META}/articraft/cadquery_single_tex*/metadata.parquet")):
- samples += load_parquet_rows("cadquery", "/".join(sub.split("/")[-3:-1]))
- samples += load_parquet_rows("openscad", "thingiverse/openscad")
- for sub in sorted(glob.glob(f"{META}/shadertoy/*/metadata.parquet")):
- samples += load_parquet_rows("glsl", "/".join(sub.split("/")[-3:-1]))
- samples += load_tree_rows("blender", "blender_distill", "*/*/code.py")
- samples += load_tree_rows("threejs", "threejs_distill", "*/*/code.html")
- samples += load_tree_rows("web", "animation2code", "*/*/index.html")
- samples = [s for s in samples if s["id"] not in held_out]
- print(f"[md_max] samples after source load: {len(samples)}", flush=True)
-
- # build (prompt, code) pairs from up to N caption variants
- pairs, seen = [], set()
- for s in samples:
- code = s["code"]
- if bad_chars(code) > 5:
- continue
- used = 0
- for kind in ("instruction", "detailed", "factory"):
- if used >= a.captions:
- break
- p = phrase(s["dialect"], kind, s["caps"].get(kind))
- if not p or len(p) < 20:
- continue
- h = hashlib.md5((p[:400] + "|" + code[:400]).encode()).hexdigest()
- if h in seen:
- continue
- seen.add(h)
- pairs.append({"dialect": s["dialect"], "subset": s["subset"], "id": s["id"], "caption": kind, "prompt": p, "code": code})
- used += 1
- print(f"[md_max] prompt-code pairs before length filter: {len(pairs)}", flush=True)
-
- # length: tokenize each unique code and prompt once
- ucode = {}
- uprompt = {}
- for p in pairs:
- ucode.setdefault(p["code"], None)
- uprompt.setdefault(p["prompt"], None)
- cache_path = "/wekafs/ict/hx_624/llm-ft/data/md_max/.ntok_cache.json"
- cache = {}
- if os.path.exists(cache_path):
- try: cache = json.load(open(cache_path))
- except Exception: cache = {}
- def _key(x): return hashlib.md5(x.encode()).hexdigest()
- for store in (ucode, uprompt):
- for k in list(store):
- v = cache.get(_key(k))
- if v is not None: store[k] = v
- codes = [k for k, v in ucode.items() if v is None]; prompts = [k for k, v in uprompt.items() if v is None]
- print(f"[md_max] tokenizing {len(codes)} unique codes + {len(prompts)} unique prompts on {a.workers} procs", flush=True)
- with ProcessPoolExecutor(a.workers, initializer=_init_tok) as ex:
- for k, n in zip(codes, ex.map(_ntok, codes, chunksize=64)):
- ucode[k] = n
- for k, n in zip(prompts, ex.map(_ntok, prompts, chunksize=256)):
- uprompt[k] = n
- os.makedirs(os.path.dirname(cache_path), exist_ok=True)
- json.dump({_key(k): v for store in (ucode, uprompt) for k, v in store.items()}, open(cache_path, "w"))
-
- OVERHEAD = 60 # chat template + system prompt + fence
- keep, stats = [], {}
- for p in pairs:
- n = ucode[p["code"]] + uprompt[p["prompt"]] + OVERHEAD
- if n > a.max_tokens:
- continue
- p["ntok"] = n
- keep.append(p)
- d = stats.setdefault(p["dialect"], {"n": 0, "tok": 0, "by_caption": {}})
- d["n"] += 1
- d["tok"] += n
- d["by_caption"][p["caption"]] = d["by_caption"].get(p["caption"], 0) + 1
- def _san(t): return t.replace("<image>", "<image >").replace("<video>", "<video >").replace("<audio>", "<audio >")
- for p_ in keep:
- p_["code"] = _san(p_["code"]); p_["prompt"] = _san(p_["prompt"])
- random.shuffle(keep)
-
- os.makedirs(a.out, exist_ok=True)
- val = keep[:600]
- train = keep[600:]
- for split, rows in (("train", train), ("val", val)):
- with open(f"{a.out}/{split}.jsonl", "w") as f:
- for p in rows:
- msgs = [{"role": "system", "content": SYS[p["dialect"]]},
- {"role": "user", "content": p["prompt"]},
- {"role": "assistant", "content": f"```{FENCE[p['dialect']]}\n{p['code'].strip()}\n```"}]
- f.write(json.dumps({"id": p["id"], "dialect": p["dialect"], "subset": p["subset"], "caption": p["caption"], "messages": msgs}, ensure_ascii=False) + "\n")
- tot_tok = sum(v["tok"] for v in stats.values())
- report = {"pairs_kept": len(keep), "tokens": tot_tok, "by_dialect": {k: {"n": v["n"], "Mtok": round(v["tok"] / 1e6, 1), "by_caption": v["by_caption"]} for k, v in sorted(stats.items(), key=lambda x: -x[1]["n"])}}
- json.dump(report, open(f"{a.out}/report.json", "w"), indent=2)
- print(json.dumps(report["by_dialect"], indent=1))
- print(f"[md_max] total samples {len(keep)} | tokens/epoch {tot_tok/1e6:.1f}M | train {len(train)} val {len(val)}", flush=True)
-
-
-if __name__ == "__main__":
- main()
diff --git a/finetune/scripts/build_md_xl.py b/finetune/scripts/build_md_xl.py
deleted file mode 100644
index 02d15af2..00000000
--- a/finetune/scripts/build_md_xl.py
+++ /dev/null
@@ -1,34 +0,0 @@
-"""md_xl: scale-up of md_big — ALL cadquery (deepcad+articraft) + ALL glsl + all blender (+15.7k bootstrapped) + openscad x4 upsampled + threejs, token-filtered <=8192."""
-import json, random, os, sys
-sys.path.insert(0, "/wekafs/ict/hx_624/llm-ft/scripts"); from ntok_cache import load_ntok
-from transformers import AutoTokenizer
-random.seed(12); tok = AutoTokenizer.from_pretrained("/wekafs/ict/hx_624/models/Qwen3.5-9B")
-MD = "/wekafs/ict/hx_624/llm-ft/data/multidialect"; CAP = {"cadquery": 10**9, "glsl": 10**9, "openscad": 10**9, "blender": 10**9, "threejs": 10**9}; REP = {"openscad": 4}
-def ntok(r): return len(tok(tok.apply_chat_template(r["messages"], tokenize=False)).input_ids)
-out_rows = []; stats = {}
-for d, cap in CAP.items():
- rows = [json.loads(l) for l in open(f"{MD}/{d}/train.jsonl")]; NT = load_ntok(f"{MD}/{d}/train.jsonl", tok)
- for r, n_ in zip(rows, NT): r["_ntok"] = n_
- random.shuffle(rows); keep = []; toks = 0
- for r in rows:
- if len(keep) >= cap: break
- n = r.pop("_ntok")
- if n <= 8192: keep.append(r); toks += n
- rep = REP.get(d, 1); stats[d] = (len(keep) * rep, toks * rep); out_rows += keep * rep
-BOOT = "/wekafs/ict/hx_624/llm-ft/data/sft_v13_boot/train.jsonl"; bl = open(BOOT).read().splitlines(); bn = load_ntok(BOOT, tok)
-boot = [(json.loads(l), n) for l, n in zip(bl, bn) if '"source": "boot_' in l]
-bt = 0; kb = []
-for r, n in boot:
- if n <= 8192: kb.append({"messages": r["messages"], "dialect": "blender", "subset": "boot"}); bt += n
-stats["blender_boot"] = (len(kb), bt); out_rows += kb
-# LLaMA-Factory's qwen3_5 (multimodal) template treats literal <image>/<video>/<audio> in text as media placeholders -> escape them
-def _san(t): return t.replace("<image>", "<image >").replace("<video>", "<video >").replace("<audio>", "<audio >")
-for r in out_rows:
- for m in r["messages"]: m["content"] = _san(m["content"])
-random.shuffle(out_rows)
-out = "/wekafs/ict/hx_624/llm-ft/data/md_xl"; os.makedirs(out, exist_ok=True)
-with open(f"{out}/train.jsonl", "w") as f:
- for r in out_rows: f.write(json.dumps(r, ensure_ascii=False) + "\n")
-os.system(f"cp /wekafs/ict/hx_624/llm-ft/data/md_mixed/val.jsonl {out}/val.jsonl")
-tot = sum(v[1] for v in stats.values())
-print({k: (v[0], round(v[1]/1e6, 1)) for k, v in stats.items()}, "| total samples", len(out_rows), "| tokens/epoch %.1fM" % (tot/1e6))
diff --git a/finetune/scripts/build_mm_dataset.py b/finetune/scripts/build_mm_dataset.py
deleted file mode 100644
index 806cf266..00000000
--- a/finetune/scripts/build_mm_dataset.py
+++ /dev/null
@@ -1,205 +0,0 @@
-"""Build the multimodal (render + instruction → code) datasets in standard LLaMA-Factory ShareGPT format.
-
-Three variants are emitted from the SAME samples, registered as separate datasets so they can be mixed or ablated
-against each other without rebuilding anything:
-
- 3dcv_mm_img image(s) only "<image>… Write the Blender Python code that builds this object."
- 3dcv_mm_img_text image(s) + instruction the realistic setting: a reference render AND what the user asked for
- 3dcv_mm_text instruction only the control, identical samples and split, no images
-
-Format notes (checked against LLaMA-Factory's loader):
- * `images` is a list of absolute paths; the number of `<image>` placeholders in the user turn must equal
- len(images) — `mm_plugin._validate_input` raises otherwise.
- * `conversations` is [human, gpt]; `system` is a plain string column.
- * multimodal rows cannot be packed (`packing: false`), because image tokens must stay aligned with their sample.
-
-Sources: bioinspired3d (tars, 4 views), 3dcodebench factories (tars, 4 views, benchmark factories excluded),
-blender_distill / threejs_distill / animation2code (file trees, 4 views).
-
-usage: python scripts/build_mm_dataset.py [--views 4] [--out data/mm]
-"""
-import argparse
-import collections
-import glob
-import json
-import os
-import random
-import tarfile
-
-IMG_ROOT = "/wekafs/ict/hx_624/data/images"
-BENCH = {os.path.basename(p).replace("_seed0", "") for p in glob.glob("/wekafs/ict/hx_624/data/3dcodebench/data/*_seed0")}
-
-SYS = {
- "blender": "You are an expert in procedural 3D modeling with Blender Python (bpy). Write a complete, standalone Blender 5 Python script that builds the requested object from scratch (clear the default scene first). Output ONLY the code in one ```python block.",
- "threejs": "You are an expert three.js developer. Write a complete, standalone HTML page that renders the requested scene with three.js. Output ONLY the code in one ```html block.",
- "web": "You are an expert creative web developer. Write a complete, standalone HTML page (inline CSS/JS, no local assets) that reproduces the requested animation. Output ONLY the code in one ```html block.",
-}
-ASK_IMG = {
- "blender": "These are reference renders of one object. Write the Blender Python code that builds it.",
- "threejs": "These are reference renders of one scene. Write the single-file three.js page that renders it.",
- "web": "These are frames of one animation. Write the single-file animated web page that reproduces it.",
-}
-ASK_TEXT = {
- "blender": "Write the Blender Python code that builds this object: ",
- "threejs": "Write a single-file three.js page that renders: ",
- "web": "Write a single-file animated web page that reproduces: ",
-}
-ASK_BOTH = {
- "blender": "These are reference renders of one object. Write the Blender Python code that builds it.\n\nThe object: ",
- "threejs": "These are reference renders of one scene. Write the single-file three.js page that renders it.\n\nThe scene: ",
- "web": "These are frames of one animation. Write the single-file animated web page that reproduces it.\n\nThe animation: ",
-}
-FENCE = {"blender": "python", "threejs": "html", "web": "html"}
-IMPERATIVE = ("write", "create", "implement", "make", "build", "generate", "design", "produce")
-
-
-def caption_of(caps):
- """the best available human description, normalised to a noun phrase (the ASK_* strings supply the verb)"""
- for k in ("user_instruction", "instruction", "detailed", "brief", "factory"):
- v = (caps.get(k) or "").strip()
- if not v or len(v) < 15:
- continue
- low = v.lower()
- if low.startswith(IMPERATIVE): # "Write a Blender script that builds a X" -> "a X"
- for sep in (" that builds ", " that renders ", " that reproduces ", " of ", " for "):
- if sep in low:
- v = v[low.index(sep) + len(sep):].strip()
- break
- else:
- continue
- return v[:1200]
- return None
-
-
-def add(rows, sample_id, dialect, imgs, caption, code):
- base = {"id": sample_id, "dialect": dialect, "system": SYS[dialect]}
- gpt = {"from": "gpt", "value": f"```{FENCE[dialect]}\n{code.strip()}\n```"}
- ph = "<image>" * len(imgs)
- out = {}
- out["img"] = dict(base, images=list(imgs),
- conversations=[{"from": "human", "value": ph + "\n" + ASK_IMG[dialect]}, gpt])
- if caption:
- out["img_text"] = dict(base, images=list(imgs),
- conversations=[{"from": "human", "value": ph + "\n" + ASK_BOTH[dialect] + caption}, gpt])
- out["text"] = dict(base, conversations=[{"from": "human", "value": ASK_TEXT[dialect] + caption}, gpt])
- for k, v in out.items():
- rows[k].append(v)
-
-
-def from_tars(pattern, dialect, rows, views, drop_bench=False):
- n = 0
- for t in sorted(glob.glob(pattern)):
- sub = os.path.basename(os.path.dirname(t))
- try:
- tf = tarfile.open(t)
- except Exception:
- continue
- members = collections.defaultdict(dict)
- for m in tf.getmembers():
- if not m.isfile():
- continue
- key = m.name.split("/")[0]
- if m.name.endswith("code.py"):
- members[key]["code"] = m
- elif m.name.endswith("captions.json"):
- members[key]["caps"] = m
- elif "/renders/view_" in m.name and m.name.endswith(".png"):
- members[key].setdefault("imgs", []).append(m)
- for key, d in members.items():
- if "code" not in d or "imgs" not in d:
- continue
- if drop_bench and key.replace("Factory", "").replace("_geo", "").replace("_tex", "") in BENCH:
- continue
- try:
- code = tf.extractfile(d["code"]).read().decode("utf-8", "replace")
- except Exception:
- continue
- if len(code.strip()) < 40:
- continue
- caps = {}
- if "caps" in d:
- try:
- caps = json.load(tf.extractfile(d["caps"]))
- except Exception:
- pass
- paths = []
- for m in sorted(d["imgs"], key=lambda m: m.name)[:views]:
- dst = os.path.join(IMG_ROOT, sub, key, os.path.basename(m.name))
- if not os.path.exists(dst):
- os.makedirs(os.path.dirname(dst), exist_ok=True)
- with open(dst, "wb") as f:
- f.write(tf.extractfile(m).read())
- paths.append(dst)
- if paths:
- add(rows, f"{sub}/{key}", dialect, paths, caption_of(caps), code)
- n += 1
- tf.close()
- return n
-
-
-def from_tree(root, dialect, rows, views, code_name):
- n = 0
- for cp in sorted(glob.glob(f"/wekafs/ict/hx_624/data/3dcodeverse_files/{root}/*/*/{code_name}")):
- d = os.path.dirname(cp)
- imgs = sorted(glob.glob(os.path.join(d, "renders", "*.png")))[:views]
- if not imgs:
- continue
- code = open(cp, encoding="utf-8", errors="replace").read()
- if len(code.strip()) < 40:
- continue
- caps = {}
- cj = os.path.join(d, "captions.json")
- if os.path.exists(cj):
- try:
- caps = json.load(open(cj))
- except Exception:
- pass
- add(rows, os.path.relpath(d, "/wekafs/ict/hx_624/data/3dcodeverse_files"), dialect, imgs, caption_of(caps), code)
- n += 1
- return n
-
-
-def main():
- ap = argparse.ArgumentParser()
- ap.add_argument("--out", default="/wekafs/ict/hx_624/llm-ft/data/mm")
- ap.add_argument("--views", type=int, default=4)
- a = ap.parse_args()
- os.makedirs(IMG_ROOT, exist_ok=True)
- rows = collections.defaultdict(list)
- got = {
- "bioinspired3d": from_tars("/wekafs/ict/hx_624/data/3dcodeverse_tars/bioinspired3d/*/*.tar", "blender", rows, a.views),
- "3dcodebench_factories": from_tars("/wekafs/ict/hx_624/data/3dcodeverse_tars/3dcodebench/factories_*/*.tar", "blender", rows, a.views, drop_bench=True),
- "blender_distill": from_tree("blender_distill", "blender", rows, a.views, "code.py"),
- "threejs_distill": from_tree("threejs_distill", "threejs", rows, a.views, "code.html"),
- "animation2code": from_tree("animation2code", "web", rows, a.views, "index.html"),
- }
- # one split shared by all three variants, so a comparison is never confounded by different val sets
- ids = sorted({r["id"] for r in rows["img"]})
- random.seed(7)
- random.shuffle(ids)
- val_ids = set(ids[:200])
- os.makedirs(a.out, exist_ok=True)
- info = {}
- for variant in ("img", "img_text", "text"):
- tr = [r for r in rows[variant] if r["id"] not in val_ids]
- va = [r for r in rows[variant] if r["id"] in val_ids]
- for split, part in (("train", tr), ("val", va)):
- name = f"mm_{variant}_{split}"
- json.dump(part, open(os.path.join(a.out, f"{name}.json"), "w"), ensure_ascii=False)
- cols = {"messages": "conversations", "system": "system"}
- if variant != "text":
- cols["images"] = "images"
- info[f"3dcv_{name}"] = {"file_name": f"{name}.json", "formatting": "sharegpt", "columns": cols}
- print(f"[mm] {variant:9s} train={len(tr):6,} val={len(va):4,}")
- json.dump(info, open(os.path.join(a.out, "dataset_info.json"), "w"), indent=2)
- # a sanity check on the invariant LLaMA-Factory enforces
- bad = [r for v in ("img", "img_text") for r in rows[v]
- if r["conversations"][0]["value"].count("<image>") != len(r.get("images", []))]
- print(f"[mm] sources: {got}")
- print(f"[mm] placeholder/image-count mismatches: {len(bad)} (must be 0)")
- print(f"[mm] dialects: {dict(collections.Counter(r['dialect'] for r in rows['img']))}")
- print(f"[mm] views per sample: {a.views} | shared val split: {len(val_ids)} ids -> {a.out}")
-
-
-if __name__ == "__main__":
- main()
diff --git a/finetune/scripts/build_multidialect.py b/finetune/scripts/build_multidialect.py
deleted file mode 100644
index 4cdb033f..00000000
--- a/finetune/scripts/build_multidialect.py
+++ /dev/null
@@ -1,77 +0,0 @@
-"""Build per-dialect SFT sets from ALL 3DCodeVerse metadata parquets + data-quality report.
-Dialects: blender (bioinspired3d+factories non-test), cadquery_deepcad, cadquery_articraft, openscad (thingiverse), glsl (shadertoy).
-Outputs data/multidialect/<dialect>/{train,test}.jsonl (+ all.jsonl) and data/multidialect/report.json"""
-import glob, hashlib, json, os, random, re, sys, unicodedata
-import pandas as pd, numpy as np
-random.seed(7)
-META = "/wekafs/ict/hx_624/data/3dcodeverse_meta"; OUT = "/wekafs/ict/hx_624/llm-ft/data/multidialect"; os.makedirs(OUT, exist_ok=True)
-SYS = {
- "blender": "You are an expert in procedural 3D modeling with Blender Python (bpy). Given a description of an object, write a complete, standalone Blender 5 Python script that builds it from scratch (clear the default scene first). Output ONLY the code in one ```python block.",
- "cadquery": "You are an expert CAD programmer. Given a description of a part, write a complete, standalone CadQuery (Python) script that builds it and leaves the final solid in a variable named `result`. Output ONLY the code in one ```python block.",
- "openscad": "You are an expert OpenSCAD programmer. Given a request, write a complete, standalone OpenSCAD (.scad) program that produces the described model. Output ONLY the code in one ```openscad block.",
- "glsl": "You are an expert shader programmer. Given a description, write a complete Shadertoy-style GLSL ES 3.00 fragment shader defining `void mainImage(out vec4 fragColor, in vec2 fragCoord)`. Output ONLY the code in one ```glsl block.",
-}
-FENCE = {"blender": "python", "cadquery": "python", "openscad": "openscad", "glsl": "glsl"}
-def bad_chars(s):
- return sum(1 for ch in s if unicodedata.category(ch) in ("Cc",) and ch not in "\n\t\r") + s.count("�")
-def wrap(dialect, caps, name):
- ins = (caps or {}).get("instruction") or ""; det = (caps or {}).get("detailed") or ""
- if dialect == "cadquery":
- return "Write a CadQuery (Python) script that builds the following CAD model: " + (ins or det)
- if dialect == "glsl":
- return ins if ins.lower().startswith(("write", "create", "implement", "make")) else "Write a GLSL fragment shader for Shadertoy that renders: " + (ins or det)
- if dialect == "openscad":
- return det or ins # thingiverse captions are already long OpenSCAD requests
- return ins or ("Create the 3D object described below using Python Blender code: " + det)
-sets = {}
-def add(dialect, sub, df, code_col="code"):
- rows = sets.setdefault(dialect, [])
- for r in df.itertuples():
- code = getattr(r, code_col) or ""; caps = dict(r.captions) if isinstance(r.captions, dict) else {}
- rows.append(dict(dialect=dialect, subset=sub, id=r.id, code=code, prompt=wrap(dialect, caps, getattr(r, "name", None)), caps=caps))
-# --- sources
-test_names = {d.replace("_seed0", "") for d in os.listdir("/wekafs/ict/hx_624/data/3dcodebench/data")}
-for f in glob.glob(f"{META}/bioinspired3d/*/metadata.parquet"): add("blender", "bioinspired3d", pd.read_parquet(f))
-for f in glob.glob(f"{META}/3dcodebench/*/metadata.parquet"):
- df = pd.read_parquet(f); df = df[~df["name"].str.replace("Factory", "", regex=False).isin(test_names)]; add("blender", "factories_nontest", df)
-for f in glob.glob(f"{META}/deepcad/*/metadata.parquet"): add("cadquery", "deepcad", pd.read_parquet(f))
-for f in glob.glob(f"{META}/articraft/cadquery_single_tex*/metadata.parquet"): add("cadquery", "articraft", pd.read_parquet(f))
-add("openscad", "thingiverse", pd.read_parquet(f"{META}/thingiverse/openscad/metadata.parquet"))
-for f in glob.glob(f"{META}/shadertoy/*/metadata.parquet"): add("glsl", "shadertoy", pd.read_parquet(f))
-# --- QC + build
-from transformers import AutoTokenizer
-tok = AutoTokenizer.from_pretrained("/wekafs/ict/hx_624/models/Qwen3.5-9B")
-report = {}
-for dialect, rows in sets.items():
- n0 = len(rows); issues = dict(empty_code=0, short_code=0, bad_chars=0, no_prompt=0, dup_code=0, too_long=0)
- seen = set(); keep = []
- for s in rows:
- code = s["code"].strip()
- if not code: issues["empty_code"] += 1; continue
- if code.count("\n") < 3: issues["short_code"] += 1; continue
- if bad_chars(code) > 0: issues["bad_chars"] += 1; continue
- if len(s["prompt"]) < 20: issues["no_prompt"] += 1; continue
- h = hashlib.sha1(code.encode()).hexdigest()
- if h in seen: issues["dup_code"] += 1; continue
- seen.add(h); s["code"] = code; keep.append(s)
- # token lengths on a sample
- samp = random.sample(keep, min(500, len(keep)))
- lens = [len(tok(s["prompt"] + "\n" + s["code"]).input_ids) for s in samp]
- p50, p90, p99 = np.percentile(lens, [50, 90, 99]); frac_gt8k = float(np.mean([l > 8192 for l in lens])); frac_gt16k = float(np.mean([l > 16384 for l in lens]))
- random.shuffle(keep)
- n_test = min(200, max(50, len(keep) // 50))
- test, train = keep[:n_test], keep[n_test:]
- d = f"{OUT}/{dialect}"; os.makedirs(d, exist_ok=True)
- for split, rs in [("train", train), ("test", test)]:
- with open(f"{d}/{split}.jsonl", "w") as f:
- for s in rs:
- f.write(json.dumps({"messages": [{"role": "system", "content": SYS[dialect]}, {"role": "user", "content": s["prompt"]},
- {"role": "assistant", "content": f"```{FENCE[dialect]}\n{s['code']}\n```"}],
- "dialect": dialect, "subset": s["subset"], "id": s["id"]}, ensure_ascii=False) + "\n")
- by_sub = {}
- for s in keep: by_sub[s["subset"]] = by_sub.get(s["subset"], 0) + 1
- report[dialect] = dict(raw=n0, kept=len(keep), train=len(train), test=len(test), issues=issues, by_subset=by_sub,
- tok_p50=int(p50), tok_p90=int(p90), tok_p99=int(p99), frac_gt8k=round(frac_gt8k, 3), frac_gt16k=round(frac_gt16k, 3),
- est_train_tokens_M=round(float(np.mean(lens)) * len(train) / 1e6, 1))
- print(dialect, json.dumps(report[dialect]))
-json.dump(report, open(f"{OUT}/report.json", "w"), indent=1)
diff --git a/finetune/scripts/build_multidialect_train.py b/finetune/scripts/build_multidialect_train.py
deleted file mode 100644
index cf6d2e9a..00000000
--- a/finetune/scripts/build_multidialect_train.py
+++ /dev/null
@@ -1,27 +0,0 @@
-"""Subsample per-dialect train sets (token-filtered ≤ 8192), build LF datasets md_<dialect> and md_mixed."""
-import json, random, os, subprocess
-from transformers import AutoTokenizer
-random.seed(3); tok = AutoTokenizer.from_pretrained("/wekafs/ict/hx_624/models/Qwen3.5-9B")
-MD = "/wekafs/ict/hx_624/llm-ft/data/multidialect"; CAP = {"blender": 6000, "cadquery": 10000, "openscad": 2000, "glsl": 10000}
-mixed = []
-for d, cap in CAP.items():
- rows = [json.loads(l) for l in open(f"{MD}/{d}/train.jsonl")]; random.shuffle(rows)
- keep = []
- for r in rows:
- if len(keep) >= cap: break
- n = len(tok(tok.apply_chat_template(r["messages"], tokenize=False)).input_ids)
- if n <= 8192: keep.append(r)
- out = f"/wekafs/ict/hx_624/llm-ft/data/md_{d}"; os.makedirs(out, exist_ok=True)
- nv = max(20, len(keep) // 50); val, train = keep[:nv], keep[nv:]
- for split, rs in [("train", train), ("val", val)]:
- with open(f"{out}/{split}.jsonl", "w") as f:
- for r in rs: f.write(json.dumps(r, ensure_ascii=False) + "\n")
- print(d, "train", len(train), "val", len(val)); mixed += train
-random.shuffle(mixed); out = "/wekafs/ict/hx_624/llm-ft/data/md_mixed"; os.makedirs(out, exist_ok=True)
-with open(f"{out}/train.jsonl", "w") as f:
- for r in mixed: f.write(json.dumps(r, ensure_ascii=False) + "\n")
-# mixed val = concat of per-dialect vals
-with open(f"{out}/val.jsonl", "w") as f:
- for d in CAP:
- for l in open(f"/wekafs/ict/hx_624/llm-ft/data/md_{d}/val.jsonl"): f.write(l)
-print("mixed train", len(mixed))
diff --git a/finetune/scripts/build_report_html.py b/finetune/scripts/build_report_html.py
deleted file mode 100644
index 514d441d..00000000
--- a/finetune/scripts/build_report_html.py
+++ /dev/null
@@ -1,62 +0,0 @@
-"""Render REPORT.md into a self-contained, themed HTML page (for publishing as an Artifact)."""
-import markdown, re, datetime, sys
-SRC = "/wekafs/ict/hx_624/llm-ft/REPORT.md"; DST = "/wekafs/ict/hx_624/llm-ft/REPORT.html"
-md = open(SRC).read()
-body = markdown.markdown(md, extensions=["tables", "fenced_code", "toc"], extension_configs={"toc": {"toc_depth": "2-3"}})
-toc = re.search(r'<div class="toc">(.*?)</div>', body, re.S)
-toc_html = toc.group(1) if toc else ""
-body = body.replace(toc.group(0), "") if toc else body
-css = """
-:root{--bg:#f6f4ef;--paper:#fffdf8;--ink:#1f2a2e;--muted:#5b6a70;--line:#d9d4c7;--accent:#0e7c7b;--accent-2:#b5541c;--code:#eef2f1;--head:#13343b}
-@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){--bg:#15191b;--paper:#1c2124;--ink:#e6e2d8;--muted:#a3ada9;--line:#2f373a;--accent:#5ec8c5;--accent-2:#e59a62;--code:#242b2e;--head:#dfe9e7}}
-:root[data-theme="dark"]{--bg:#15191b;--paper:#1c2124;--ink:#e6e2d8;--muted:#a3ada9;--line:#2f373a;--accent:#5ec8c5;--accent-2:#e59a62;--code:#242b2e;--head:#dfe9e7}
-*{box-sizing:border-box}
-body{margin:0;background:var(--bg);color:var(--ink);font-family:"IBM Plex Sans","Noto Sans SC","PingFang SC","Microsoft YaHei",system-ui,sans-serif;font-size:16px;line-height:1.7}
-.wrap{display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:40px;max-width:1180px;margin:0 auto;padding:40px 28px 80px}
-@media (max-width:900px){.wrap{grid-template-columns:1fr}.toc{display:none}}
-main{min-width:0;background:var(--paper);border:1px solid var(--line);border-radius:6px;padding:40px 44px}
-@media (max-width:600px){main{padding:22px 18px}}
-header.hero{margin-bottom:28px;border-bottom:2px solid var(--accent);padding-bottom:18px}
-header.hero .eyebrow{font-family:"IBM Plex Mono",ui-monospace,monospace;font-size:12px;letter-spacing:.12em;text-transform:uppercase;color:var(--accent-2)}
-h1,h2,h3,h4{color:var(--head);text-wrap:balance;line-height:1.25;font-family:"IBM Plex Sans","Noto Sans SC","PingFang SC",sans-serif}
-h1{font-size:30px;margin:6px 0 8px;font-weight:600}
-h2{font-size:22px;margin:44px 0 12px;padding-top:14px;border-top:1px solid var(--line);font-weight:600}
-h3{font-size:17px;margin:28px 0 8px;font-weight:600}
-p,li{max-width:78ch}
-blockquote{margin:14px 0;padding:10px 16px;border-left:3px solid var(--accent);background:var(--code);color:var(--muted);border-radius:0 4px 4px 0}
-code,pre{font-family:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.88em}
-code{background:var(--code);padding:1px 5px;border-radius:3px}
-pre{background:var(--code);padding:12px 14px;border-radius:4px;overflow-x:auto}
-pre code{background:none;padding:0}
-.tbl{overflow-x:auto;margin:14px 0}
-table{border-collapse:collapse;width:100%;font-size:14px;font-variant-numeric:tabular-nums}
-th,td{border-bottom:1px solid var(--line);padding:7px 10px;text-align:left;vertical-align:top}
-th{color:var(--muted);font-weight:600;font-size:12.5px;letter-spacing:.04em;text-transform:uppercase;background:var(--code)}
-tr:hover td{background:color-mix(in srgb,var(--accent) 6%,transparent)}
-strong{color:var(--head)}
-a{color:var(--accent)}
-.toc{position:sticky;top:24px;align-self:start;font-size:13.5px;line-height:1.5}
-.toc ul{list-style:none;padding-left:0;margin:0}
-.toc ul ul{padding-left:12px;margin-top:2px}
-.toc li{margin:4px 0}
-.toc a{color:var(--muted);text-decoration:none}
-.toc a:hover{color:var(--accent)}
-.toc .label{font-family:"IBM Plex Mono",monospace;font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--accent-2);margin-bottom:8px}
-footer{margin-top:40px;color:var(--muted);font-size:13px}
-"""
-body = re.sub(r"<table>", '<div class="tbl"><table>', body); body = re.sub(r"</table>", "</table></div>", body)
-body = re.sub(r"<h1[^>]*>.*?</h1>", "", body, count=1)
-html = f"""<title>3D-code LLM Finetune Lab Notes</title>
-<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&family=Noto+Sans+SC:wght@400;500;700&display=swap">
-<style>{css}</style>
-<div class="wrap">
-<main>
-<header class="hero"><div class="eyebrow">dgx03 · 4×H100 · {datetime.date.today().isoformat()}</div>
-<h1>3D-code LLM finetune 调研报告</h1>
-<p style="color:var(--muted);margin:0">Qwen3.5-9B × LLaMA-Factory × 3DCodeVerse → 3DCodeBench(Blender 5.0 执行评测)。工程目录 <code>/wekafs/ict/hx_624/llm-ft</code>。</p></header>
-{body}
-<footer>Generated from <code>llm-ft/REPORT.md</code> · all numbers reproducible via <code>eval/compare.py</code> / <code>eval/results_table.py</code>.</footer>
-</main>
-<nav class="toc"><div class="label">Contents</div>{toc_html}</nav>
-</div>"""
-open(DST, "w").write(html); print("wrote", DST, len(html), "bytes")
diff --git a/finetune/scripts/build_variants.sh b/finetune/scripts/build_variants.sh
deleted file mode 100755
index bcebf979..00000000
--- a/finetune/scripts/build_variants.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-set -x
-source /wekafs/ict/hx_624/llm-ft/env.sh; cd /wekafs/ict/hx_624/llm-ft
-python scripts/prep_data.py --out data/sft_v2_indist --include_test_factories > logs/prep_v2.log 2>&1 && python scripts/to_llamafactory.py --data_dir data/sft_v2_indist --name v2_indist
-python scripts/prep_data.py --out data/sft_v3_bio --sources bio3d > logs/prep_v3.log 2>&1 && python scripts/to_llamafactory.py --data_dir data/sft_v3_bio --name v3_bio
-python scripts/prep_data.py --out data/sft_v4_cq --sources bio3d,fac,distill,thingi50,deepcad --deepcad_n 6000 > logs/prep_v4.log 2>&1 && python scripts/to_llamafactory.py --data_dir data/sft_v4_cq --name v4_cq
-python scripts/prep_data.py --out data/sft_v5_instr --prompt_fields instruction:1 > logs/prep_v5.log 2>&1 && python scripts/to_llamafactory.py --data_dir data/sft_v5_instr --name v5_instr
-python scripts/prep_data.py --out data/sft_v6_detail --prompt_fields detailed:1 > logs/prep_v6.log 2>&1 && python scripts/to_llamafactory.py --data_dir data/sft_v6_detail --name v6_detail
-for v in v2_indist v3_bio v4_cq v5_instr v6_detail; do python scripts/make_lora_cfg.py $v $v; done
-for v in v2_indist v3_bio v4_cq v5_instr v6_detail; do echo "== $v"; grep -E '"n_train"|"n_val"' data/sft_$v/stats.json | tr -d '\n'; echo; done
-echo BUILD_VARIANTS_DONE
diff --git a/finetune/scripts/cache_ntok.py b/finetune/scripts/cache_ntok.py
deleted file mode 100644
index f944764f..00000000
--- a/finetune/scripts/cache_ntok.py
+++ /dev/null
@@ -1,20 +0,0 @@
-"""One-off: cache per-sample token counts (Qwen3.5 chat template) for every multidialect train/test file and the bootstrapped set.
-Writes <file>.ntok (one int per line, same order). Build scripts read this instead of re-tokenizing."""
-import json, os, sys, glob
-from multiprocessing import Pool
-FILES = sorted(glob.glob("/wekafs/ict/hx_624/llm-ft/data/multidialect/*/train.jsonl") + glob.glob("/wekafs/ict/hx_624/llm-ft/data/multidialect/*/test.jsonl")) + ["/wekafs/ict/hx_624/llm-ft/data/sft_v13_boot/train.jsonl"]
-tok = None
-def init():
- global tok
- from transformers import AutoTokenizer
- tok = AutoTokenizer.from_pretrained("/wekafs/ict/hx_624/models/Qwen3.5-9B")
-def count(line):
- r = json.loads(line); return len(tok(tok.apply_chat_template(r["messages"], tokenize=False)).input_ids)
-if __name__ == "__main__":
- with Pool(12, initializer=init) as pool:
- for f in FILES:
- out = f + ".ntok"
- if os.path.exists(out) and sum(1 for _ in open(out)) == sum(1 for _ in open(f)): print("cached", f); continue
- lines = open(f).read().splitlines()
- ns = pool.map(count, lines, chunksize=256)
- open(out, "w").write("\n".join(map(str, ns)) + "\n"); print(f, len(ns), "done", flush=True)
diff --git a/finetune/scripts/ckpt_sweep.sh b/finetune/scripts/ckpt_sweep.sh
deleted file mode 100755
index 55a3cb6f..00000000
--- a/finetune/scripts/ckpt_sweep.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-# ckpt_sweep.sh <GPU> <RUN_DIR> <NAME> <ckpt_step> [<ckpt_step> ...]: merge each intermediate adapter checkpoint, vLLM-generate, exec in background
-GPU=$1; RUN=$(readlink -f "$2"); NAME=$3; shift 3
-cd /wekafs/ict/hx_624/llm-ft
-for STEP in "$@"; do
- CK=$RUN/checkpoint-$STEP; [ -d $CK ] || { echo "[ckpt $NAME-$STEP] missing"; continue; }
- OUT=eval/out/qwen35_9b_lora_${NAME}_ckpt$STEP
- sed -e "s|adapter_name_or_path:.*|adapter_name_or_path: $CK|" -e "s|export_dir:.*|export_dir: $CK/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_${NAME}_ckpt$STEP.yaml
- scripts/lf_export.sh configs/lf/export_${NAME}_ckpt$STEP.yaml > logs/export_${NAME}_ckpt$STEP.log 2>&1 || { echo "[ckpt $NAME-$STEP] EXPORT FAILED"; continue; }
- ( source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm; export HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$GPU
- mkdir -p $OUT; python eval/generate_vllm.py --model $CK/merged --prompts data/sft_v1/bench_prompts.jsonl --out $OUT --tp 1 --no_think --max_new_tokens 6144 2>&1 | grep -E "gen-vllm|Error|Traceback" | tail -3 ) > logs/eval_${NAME}_ckpt$STEP.log 2>&1
- cp $OUT/gens_shard0.jsonl $OUT/gens.jsonl; rm -rf $CK/merged
- echo "[ckpt $NAME-$STEP] gen done: $(grep gen-vllm logs/eval_${NAME}_ckpt$STEP.log | tail -1)"
- nohup bash -c "source /wekafs/ict/hx_624/llm-ft/env.sh; cd /wekafs/ict/hx_624/llm-ft; python eval/run_bench.py --gen_dir $OUT --workers 24 --timeout 300 > $OUT/exec.log 2>&1; python eval/metrics.py --gen_dir $OUT > $OUT/metrics.log 2>&1; echo \"[ckpt $NAME-$STEP] eval done\"; cat $OUT/summary.json" >> logs/ckpt_sweep_$NAME.log 2>&1 &
-done
-echo "CKPT_SWEEP_DONE $NAME"
diff --git a/finetune/scripts/contact_sheet_3dcodebench.py b/finetune/scripts/contact_sheet_3dcodebench.py
deleted file mode 100644
index 4886f710..00000000
--- a/finetune/scripts/contact_sheet_3dcodebench.py
+++ /dev/null
@@ -1,33 +0,0 @@
-"""Render generated vs GT for a spread of 3DCodeBench tasks and compose a labelled contact sheet.
-usage: python scripts/contact_sheet_3dcodebench.py <eval_out_dir> <out_png> [n_per_bucket]"""
-import json, os, sys, subprocess, random
-from concurrent.futures import ThreadPoolExecutor
-from PIL import Image, ImageDraw, ImageFont
-BL = "/wekafs/ict/hx_624/tools/blender-5.0.1-linux-x64/blender"; R = os.path.abspath("eval/render_glb.py"); GT = "/wekafs/ict/hx_624/data/3dcodebench/data"
-gen_dir, out_png = sys.argv[1], sys.argv[2]; k = int(sys.argv[3]) if len(sys.argv) > 3 else 4
-m = [json.loads(l) for l in open(f"{gen_dir}/metrics.jsonl")]; ok = sorted([r for r in m if r["exec"] == "OK" and r.get("[email protected]") is not None], key=lambda r: -r["[email protected]"])
-random.seed(3); n = len(ok)
-sel = [("best", r) for r in ok[:k]] + [("median", r) for r in ok[n//2 - k//2: n//2 - k//2 + k]] + [("worst", r) for r in ok[-k:]] + [("random", r) for r in random.sample(ok[k:-k], k)]
-work = os.path.abspath(f"{gen_dir}/_renders"); os.makedirs(work, exist_ok=True)
-def render(glb, png):
- if os.path.exists(png): return
- subprocess.run([BL, "-b", "--factory-startup", "-noaudio", "--python", R, "--", "--glb", glb, "--out", png], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=300, env={**os.environ, "HOME": "/tmp"})
-jobs = []
-for tag, r in sel:
- t = r["task"]; jobs.append((os.path.abspath(f"{gen_dir}/{t}/out.glb"), f"{work}/{t}_gen.png")); jobs.append((f"{GT}/{t}/glb/{t}.glb", f"{work}/{t}_gt.png"))
-with ThreadPoolExecutor(8) as ex: list(ex.map(lambda j: render(*j), jobs))
-S = 200; cols = k; rows = 4
-sheet = Image.new("RGB", (cols * (2 * S + 16) + 40, rows * (S + 52) + 10), "white"); d = ImageDraw.Draw(sheet)
-try: font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 13); fb = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 13)
-except Exception: font = fb = ImageFont.load_default()
-for i, (tag, r) in enumerate(sel):
- row, col = i // cols, i % cols; x0 = 40 + col * (2 * S + 16); y0 = 10 + row * (S + 52); t = r["task"]
- for j, kind in enumerate(("gen", "gt")):
- p = f"{work}/{t}_{kind}.png"
- try: im = Image.open(p).convert("RGB").resize((S, S))
- except Exception: im = Image.new("RGB", (S, S), (230, 230, 230))
- sheet.paste(im, (x0 + j * S, y0 + 20))
- d.text((x0, y0 + 2), f"{t.replace('_seed0','')} [email protected]={r['[email protected]']:.2f}", fill="black", font=fb)
- d.text((x0, y0 + S + 24), "generated (md_xl)", fill=(60, 60, 60), font=font); d.text((x0 + S, y0 + S + 24), "ground truth", fill=(60, 60, 60), font=font)
- if col == 0: d.text((4, y0 + S // 2), tag, fill=(120, 0, 0), font=fb)
-sheet.save(out_png); print("wrote", out_png, sheet.size, "| tasks:", [r["task"] for _, r in sel])
diff --git a/finetune/scripts/contact_sheet_compare.py b/finetune/scripts/contact_sheet_compare.py
deleted file mode 100644
index 750836b2..00000000
--- a/finetune/scripts/contact_sheet_compare.py
+++ /dev/null
@@ -1,32 +0,0 @@
-"""3-column contact sheet on the SAME tasks: model A vs model B vs GT (tasks = the selection used by contact_sheet_3dcodebench.py for model A)."""
-import json, os, sys, subprocess, random
-from concurrent.futures import ThreadPoolExecutor
-from PIL import Image, ImageDraw, ImageFont
-BL = "/wekafs/ict/hx_624/tools/blender-5.0.1-linux-x64/blender"; R = os.path.abspath("eval/render_glb.py"); GT = "/wekafs/ict/hx_624/data/3dcodebench/data"
-dirA, nameA, dirB, nameB, out_png = sys.argv[1:6]; k = 4
-mA = {r["task"]: r for r in map(json.loads, open(f"{dirA}/metrics.jsonl"))}; mB = {r["task"]: r for r in map(json.loads, open(f"{dirB}/metrics.jsonl"))}
-ok = sorted([r for r in mA.values() if r["exec"] == "OK" and r.get("[email protected]") is not None], key=lambda r: -r["[email protected]"]); random.seed(3); n = len(ok)
-sel = [("best", r) for r in ok[:k]] + [("median", r) for r in ok[n//2 - k//2: n//2 - k//2 + k]] + [("worst", r) for r in ok[-k:]] + [("random", r) for r in random.sample(ok[k:-k], k)]
-def render(glb, png):
- if os.path.exists(png) or not os.path.exists(glb): return
- subprocess.run([BL, "-b", "--factory-startup", "-noaudio", "--python", R, "--", "--glb", glb, "--out", png], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=300, env={**os.environ, "HOME": "/tmp"})
-wA = os.path.abspath(f"{dirA}/_renders"); wB = os.path.abspath(f"{dirB}/_renders"); os.makedirs(wA, exist_ok=True); os.makedirs(wB, exist_ok=True)
-jobs = []
-for tag, r in sel:
- t = r["task"]; jobs += [(os.path.abspath(f"{dirA}/{t}/out.glb"), f"{wA}/{t}_gen.png"), (os.path.abspath(f"{dirB}/{t}/out.glb"), f"{wB}/{t}_gen.png"), (f"{GT}/{t}/glb/{t}.glb", f"{wA}/{t}_gt.png")]
-with ThreadPoolExecutor(8) as ex: list(ex.map(lambda j: render(*j), jobs))
-S = 180; cols = k; rows = 4
-sheet = Image.new("RGB", (cols * (3 * S + 16) + 40, rows * (S + 52) + 10), "white"); d = ImageDraw.Draw(sheet)
-try: font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 12); fb = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 12)
-except Exception: font = fb = ImageFont.load_default()
-for i, (tag, r) in enumerate(sel):
- row, col = i // cols, i % cols; x0 = 40 + col * (3 * S + 16); y0 = 10 + row * (S + 52); t = r["task"]
- for j, p in enumerate((f"{wA}/{t}_gen.png", f"{wB}/{t}_gen.png", f"{wA}/{t}_gt.png")):
- try: im = Image.open(p).convert("RGB").resize((S, S))
- except Exception: im = Image.new("RGB", (S, S), (230, 230, 230))
- sheet.paste(im, (x0 + j * S, y0 + 20))
- fa = r["[email protected]"]; fbv = mB.get(t, {}).get("[email protected]"); sb = f"{fbv:.2f}" if fbv is not None else mB.get(t, {}).get("exec", "?")
- d.text((x0, y0 + 2), f"{t.replace('_seed0','')} [email protected] {nameA}={fa:.2f} | {nameB}={sb}", fill="black", font=fb)
- d.text((x0, y0 + S + 24), nameA, fill=(60, 60, 60), font=font); d.text((x0 + S, y0 + S + 24), nameB, fill=(60, 60, 60), font=font); d.text((x0 + 2 * S, y0 + S + 24), "ground truth", fill=(60, 60, 60), font=font)
- if col == 0: d.text((4, y0 + S // 2), tag, fill=(120, 0, 0), font=fb)
-sheet.save(out_png); print("wrote", out_png, sheet.size)
diff --git a/finetune/scripts/desc_prompt_eval.sh b/finetune/scripts/desc_prompt_eval.sh
deleted file mode 100755
index 873be1f1..00000000
--- a/finetune/scripts/desc_prompt_eval.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-# Cross prompt-style eval: 3DCodeBench prompt_description.txt (appearance descriptions) instead of prompt_instruction.txt, for base / v1 / v6_detail
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft; export PROMPTS=/wekafs/ict/hx_624/llm-ft/data/sft_v1/bench_prompts_desc.jsonl
-until grep -q "\[dpo\] DONE\|FAILED" logs/exp_dpo_exec_v1.log 2>/dev/null; do sleep 30; done
-until [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i 2,3 | sort -n | tail -1)" -lt 10000 ]; do sleep 20; done
-echo "[desc] $(date) start"
-[ -d runs/lf_qwen35_9b_lora_v1/merged ] || scripts/lf_export.sh configs/lf/export_v1.yaml > logs/export_v1_desc.log 2>&1
-GPUS=2 eval/run_eval_vllm.sh runs/lf_qwen35_9b_lora_v1/merged eval/out/desc_qwen35_9b_lora_v1 --no_think --max_new_tokens 6144 > logs/eval_desc_v1.log 2>&1 &
-GPUS=3 eval/run_eval_vllm.sh /wekafs/ict/hx_624/models/Qwen3.5-9B eval/out/desc_qwen35_9b_base --no_think --max_new_tokens 6144 > logs/eval_desc_base.log 2>&1 &
-wait; echo "[desc] v1/base done"; cat eval/out/desc_qwen35_9b_lora_v1/summary.json | tr -d '\n'; echo; cat eval/out/desc_qwen35_9b_base/summary.json | tr -d '\n'; echo
-scripts/lf_export.sh configs/lf/export_v6_detail.yaml > logs/export_v6_desc.log 2>&1 && GPUS=2 eval/run_eval_vllm.sh runs/lf_qwen35_9b_lora_v6_detail/merged eval/out/desc_qwen35_9b_lora_v6_detail --no_think --max_new_tokens 6144 > logs/eval_desc_v6.log 2>&1; echo "[desc] v6 done"; cat eval/out/desc_qwen35_9b_lora_v6_detail/summary.json | tr -d '\n'; echo
-rm -rf runs/lf_qwen35_9b_lora_v6_detail/merged runs/lf_qwen35_9b_lora_v1/merged; echo "[desc] DONE"
diff --git a/finetune/scripts/dgx01_smoke.sh b/finetune/scripts/dgx01_smoke.sh
deleted file mode 100755
index e1813c77..00000000
--- a/finetune/scripts/dgx01_smoke.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-# 4-step smoke test of the 27B LoRA recipe on another node (the project dir is on shared wekafs, so
-# scripts/env/models/data are all identical — only the GPUs differ).
-cd /wekafs/ict/hx_624/llm-ft || exit 1
-GPUS=${GPUS:-0,1,2,3} scripts/lf_train.sh configs/lf/lora_27b_v2.yaml max_steps=4 save_steps=100000 eval_steps=100000 \
- output_dir=/wekafs/ict/hx_624/llm-ft/runs/_smoke_$(hostname) > logs/smoke_$(hostname).log 2>&1
-grep -oE "'train_runtime': [0-9.]+|out of memory|[0-9]/4 \[[0-9:]+<[0-9:]+, *[0-9.]+s/it" logs/smoke_$(hostname).log | tail -2
-rm -rf runs/_smoke_$(hostname)
diff --git a/finetune/scripts/dpo_round2.sh b/finetune/scripts/dpo_round2.sh
deleted file mode 100755
index 356ef164..00000000
--- a/finetune/scripts/dpo_round2.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-# Iterative DPO round 2: DPO_v1 model samples K=2 on the 9.9k novel prompts -> Blender filter -> new (OK, FAIL) pairs -> DPO on top of DPO_v1 -> eval
-set -uo pipefail; GPU=${GPUS:-1}; cd /wekafs/ict/hx_624/llm-ft; W=data/dpo_round2; mkdir -p $W
-echo "[dpo2] $(date) start"
-[ -d runs/lf_qwen35_9b_lora_v1/merged ] || scripts/lf_export.sh configs/lf/export_v1.yaml > logs/export_v1_dpo2.log 2>&1
-BASE=runs/lf_qwen35_9b_dpo_exec_v1/merged_r2
-sed -e "s|export_dir:.*|export_dir: $(readlink -f runs/lf_qwen35_9b_dpo_exec_v1)/merged_r2|" configs/lf/export_dpo_exec_v1.yaml > configs/lf/export_dpo_exec_v1_r2.yaml
-[ -d $BASE ] || scripts/lf_export.sh configs/lf/export_dpo_exec_v1_r2.yaml > logs/export_dpo_r2.log 2>&1 || { echo "[dpo2] EXPORT FAILED"; exit 1; }
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$GPU
-for i in 1 2; do python eval/generate_vllm.py --model $BASE --prompts data/selftrain_round2/prompts.jsonl --out $W/gen_s$i --tp 1 --no_think --max_new_tokens 4096 --temperature 0.8 --seed $((300+i)) 2>&1 | grep -E "gen-vllm|Error" | tail -1; done
-echo "[dpo2] $(date) sampling done"
-conda activate llmft
-for i in 1 2; do python eval/run_bench.py --gen_dir $W/gen_s$i --workers 56 --timeout 120 > $W/gen_s$i/exec.log 2>&1; grep "status counts" $W/gen_s$i/exec.log; done
-python - <<'PY'
-import json, glob, os, random
-random.seed(1); W="data/dpo_round2"
-prompts={}
-for l in open("data/selftrain_round2/prompts.jsonl"): r=json.loads(l); prompts[r["task"]]=r
-by={}
-for d in sorted(glob.glob(f"{W}/gen_s*/")):
- for l in open(d+"exec_results.jsonl"):
- r=json.loads(l); code=open(f"{d}/{r['task']}/code.py").read().strip()
- if code.count("\n")<3: continue
- by.setdefault(r["task"],{"ok":[],"bad":[]})["ok" if r["status"]=="OK" else "bad"].append(code)
-pairs=[]
-for t,v in by.items():
- if v["ok"] and v["bad"]:
- ok=random.choice(v["ok"]); bad=random.choice(v["bad"])
- if ok==bad: continue
- p=prompts[t]; pairs.append({"conversations":[{"from":"human","value":p["messages"][1]["content"]}],"system":p["messages"][0]["content"],"chosen":{"from":"gpt","value":"```python\n"+ok+"\n```"},"rejected":{"from":"gpt","value":"```python\n"+bad+"\n```"}})
-random.shuffle(pairs); json.dump(pairs, open("data/lf/dpo_exec_pairs_r2.json","w"), ensure_ascii=False)
-info=json.load(open("data/lf/dataset_info.json")); info["dpo_exec_pairs_r2"]={"file_name":"dpo_exec_pairs_r2.json","ranking":True,"formatting":"sharegpt","columns":{"messages":"conversations","system":"system","chosen":"chosen","rejected":"rejected"}}
-json.dump(info, open("data/lf/dataset_info.json","w"), indent=2); print("round2 pairs:", len(pairs), "prompts with any OK:", sum(1 for v in by.values() if v["ok"]), "/", len(by))
-PY
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" -e "s|dataset: dpo_exec_pairs|dataset: dpo_exec_pairs_r2|" -e "s|output_dir:.*|output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_exec_v2|" configs/lf/dpo_exec_v1.yaml > configs/lf/dpo_exec_v2.yaml
-echo "[dpo2] $(date) train"; GPUS=$GPU scripts/lf_train.sh configs/lf/dpo_exec_v2.yaml gradient_accumulation_steps=16 > logs/train_dpo_exec_v2.log 2>&1
-RUN=runs/lf_qwen35_9b_dpo_exec_v2; [ -f $RUN/train_results.json ] || { echo "[dpo2] TRAIN FAILED"; exit 1; }
-echo "[dpo2] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_dpo_exec_v2.yaml
-scripts/lf_export.sh configs/lf/export_dpo_exec_v2.yaml > logs/export_dpo_exec_v2.log 2>&1 || { echo "[dpo2] EXPORT2 FAILED"; exit 1; }
-GPUS=$GPU eval/run_eval_vllm.sh $RUN/merged eval/out/qwen35_9b_dpo_exec_v2 --no_think --max_new_tokens 6144 > logs/eval_dpo_exec_v2.log 2>&1
-echo "[dpo2] $(date) eval done"; cat eval/out/qwen35_9b_dpo_exec_v2/summary.json; rm -rf $RUN/merged $BASE; echo "[dpo2] DONE"
diff --git a/finetune/scripts/eval_9b_img.sh b/finetune/scripts/eval_9b_img.sh
deleted file mode 100755
index f175c037..00000000
--- a/finetune/scripts/eval_9b_img.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-# Evaluate the image-conditioned model on 3DCodeBench by feeding each task's own reference render instead of the
-# text prompt. Same executor and geometry metrics, so the score is directly comparable to the text-only runs.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-G=$(scripts/free_gpus.sh | cut -d, -f1)
-RUN=runs/lf_qwen35_9b_img4; OUT=eval/out/q9b_img_bench; mkdir -p $OUT
-python - <<'PY'
-import json, glob, os
-rows=[]
-for d in sorted(glob.glob("/wekafs/ict/hx_624/data/3dcodebench/data/*_seed0")):
- imgs=sorted(glob.glob(os.path.join(d,"images","*.png")))[:1]
- if not imgs: continue
- rows.append({"task": os.path.basename(d), "images": imgs,
- "messages":[{"role":"system","content":"You are an expert in procedural 3D modeling with Blender Python (bpy). Given reference renders of an object, write a complete, standalone Blender 5 Python script that reproduces it (clear the default scene first). Output ONLY the code in one ```python block."},
- {"role":"user","content":"<image>\nReproduce this 3D object with Blender Python code."}]})
-open("eval/out/_img_bench_prompts.jsonl","w").write("\n".join(json.dumps(r) for r in rows))
-print("image prompts:", len(rows))
-PY
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$G
-python eval/generate_vllm_img.py --model $RUN/merged --prompts eval/out/_img_bench_prompts.jsonl --out $OUT --max_new_tokens 6144 2>&1 | tail -2
-conda activate llmft
-python eval/run_bench.py --gen_dir $OUT --workers 24 --timeout 300 2>&1 | grep "status counts" | tail -1
-python eval/metrics.py --gen_dir $OUT 2>&1 | tail -1
-echo "[imgeval] DONE"
diff --git a/finetune/scripts/eval_9b_noleak.sh b/finetune/scripts/eval_9b_noleak.sh
deleted file mode 100755
index 7b6ed604..00000000
--- a/finetune/scripts/eval_9b_noleak.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-RUN=runs/lf_qwen35_9b_noleak; G=$(scripts/free_gpus.sh)
-[ -f $RUN/merged/config.json ] || {
- sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_9b_noleak.yaml
- scripts/lf_export.sh configs/lf/export_9b_noleak.yaml > logs/export_9b_noleak.log 2>&1 || { echo "[noleak] EXPORT FAILED"; exit 1; }; }
-echo "[noleak] $(date) eval (leakage probe: same mix minus the 164 benchmark-factory rows)"
-GPUS=$(echo $G|cut -d, -f1) TP=1 eval/eval_all_run2.sh $RUN/merged q9b_noleak --max_new 8192 --suites bench blender cadquery 2>&1 | grep -E "status counts|dialect|DONE" | tail -6
-echo "[noleak] ALL DONE"
diff --git a/finetune/scripts/eval_img4_views.sh b/finetune/scripts/eval_img4_views.sh
deleted file mode 100755
index e777da86..00000000
--- a/finetune/scripts/eval_img4_views.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-# Does giving the model all four reference views beat a single view? Same tasks, same executor.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-RUN=runs/lf_qwen35_9b_img4; G=$(scripts/free_gpus.sh | cut -d, -f1)
-python - <<'PY'
-import json, glob, os
-rows=[]
-SYS="You are an expert in procedural 3D modeling with Blender Python (bpy). Given reference renders of an object, write a complete, standalone Blender 5 Python script that reproduces it (clear the default scene first). Output ONLY the code in one ```python block."
-for d in sorted(glob.glob("/wekafs/ict/hx_624/data/3dcodebench/data/*_seed0")):
- imgs=sorted(glob.glob(os.path.join(d,"images","*.png")))[:4]
- if not imgs: continue
- rows.append({"task": os.path.basename(d), "images": imgs,
- "messages":[{"role":"system","content":SYS},
- {"role":"user","content":"<image>"*len(imgs)+"\nReproduce this 3D object with Blender Python code."}]})
-open("eval/out/_img4_bench_prompts.jsonl","w").write("\n".join(json.dumps(r) for r in rows))
-print("4-view prompts:", len(rows), "| views per task:", len(rows[0]["images"]))
-PY
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$G
-OUT=eval/out/q9b_img4_bench; mkdir -p $OUT
-python eval/generate_vllm_img.py --model $RUN/merged --prompts eval/out/_img4_bench_prompts.jsonl --out $OUT --max_new_tokens 6144 2>&1 | tail -1
-conda activate llmft
-python eval/run_bench.py --gen_dir $OUT --workers 24 --timeout 300 2>&1 | grep "status counts" | tail -1
-python eval/metrics.py --gen_dir $OUT 2>&1 | tail -1
-echo "[img4eval] ALL DONE"
diff --git a/finetune/scripts/eval_img_budget.sh b/finetune/scripts/eval_img_budget.sh
deleted file mode 100755
index 0345f85c..00000000
--- a/finetune/scripts/eval_img_budget.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-# Re-run the image-conditioned evaluations with the model's real limit instead of an arbitrary cap.
-# Both models support 262,144 tokens of context and the prompts are ~300 tokens, so nothing but vLLM's KV-cache
-# budget limits the output. Probe downward from the model maximum and use the largest length that initialises;
-# report the truncation count, which must be 0 for the score to mean anything.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-G=${GPUS:-$(scripts/free_gpus.sh 40000 | cut -d, -f1)} # an eval needs room for a 9B, not a trainer's 60 GB
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$G
-
-RUN=runs/lf_qwen35_9b_img4
-LEN=0
-for L in 262144 131072 65536 32768; do
- echo "[imgbudget] probing max_model_len=$L"
- if timeout 1200 python eval/generate_vllm_img.py --model $RUN/merged --prompts eval/out/_img4_bench_prompts.jsonl \
- --out /tmp/hx_budget_probe --max_model_len $L --max_new_tokens $((L-2048)) --limit 2 > logs/probe_len_$L.log 2>&1; then
- LEN=$L; echo "[imgbudget] max_model_len=$L works"; break
- fi
- echo "[imgbudget] $L failed: $(grep -oE 'ValueError[^\"]{0,120}|out of memory|KV cache[^\"]{0,80}' logs/probe_len_$L.log | tail -1)"
-done
-[ "$LEN" -eq 0 ] && { echo "[imgbudget] no context length initialised"; exit 1; }
-NEW=$((LEN-2048))
-echo "[imgbudget] running the suites with max_model_len=$LEN max_new_tokens=$NEW"
-for SPEC in "_img4_bench_prompts q9b_img4_full" "_img_bench_prompts q9b_img1_full"; do
- set -- $SPEC; OUT=eval/out/$2; mkdir -p $OUT
- python eval/generate_vllm_img.py --model $RUN/merged --prompts eval/out/$1.jsonl --out $OUT \
- --max_model_len $LEN --max_new_tokens $NEW 2>&1 | tail -1
-done
-conda activate llmft
-for O in q9b_img4_full q9b_img1_full; do
- echo "== $O"
- python3 -c "
-import json,statistics as st
-g=[json.loads(l) for l in open('eval/out/$O/gens_shard0.jsonl')]
-print(' mean out tok %.0f | truncated %d/%d' % (st.mean(r['n_new_tokens'] for r in g), sum(1 for r in g if not r['finished']), len(g)))"
- python eval/run_bench.py --gen_dir eval/out/$O --workers 24 --timeout 300 2>&1 | grep "status counts" | tail -1
- python eval/metrics.py --gen_dir eval/out/$O 2>&1 | tail -1
-done
-echo "[imgbudget] ALL DONE"
diff --git a/finetune/scripts/eval_imgmix.sh b/finetune/scripts/eval_imgmix.sh
deleted file mode 100755
index cfb9417f..00000000
--- a/finetune/scripts/eval_imgmix.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-# The image+text model must be checked on BOTH paths: does adding vision cost anything on plain text prompts,
-# and does joint training beat the image-only model when given a render?
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-RUN=runs/lf_qwen35_9b_imgmix; G=$(scripts/free_gpus.sh)
-[ -f $RUN/merged/config.json ] || { echo "[imgmix] merged model missing"; exit 1; }
-echo "[imgmixeval] $(date) text path"
-GPUS=$(echo $G|cut -d, -f1) TP=1 eval/eval_all_run2.sh $RUN/merged q9b_imgmix --max_new 8192 --suites bench blender cadquery 2>&1 | grep -E "status counts|dialect|DONE" | tail -6
-echo "[imgmixeval] $(date) image path"
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$(echo $G|cut -d, -f1)
-OUT=eval/out/q9b_imgmix_img_bench; mkdir -p $OUT
-python eval/generate_vllm_img.py --model $RUN/merged --prompts eval/out/_img_bench_prompts.jsonl --out $OUT --max_new_tokens 6144 2>&1 | tail -1
-conda activate llmft
-python eval/run_bench.py --gen_dir $OUT --workers 24 --timeout 300 2>&1 | grep "status counts" | tail -1
-python eval/metrics.py --gen_dir $OUT 2>&1 | tail -1
-echo "[imgmixeval] ALL DONE"
diff --git a/finetune/scripts/explore_sched2.sh b/finetune/scripts/explore_sched2.sh
deleted file mode 100755
index 055bf300..00000000
--- a/finetune/scripts/explore_sched2.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-# revised 8h scheduler (GPUs 0,2,3 idle now, GPU 1 busy with the md_xl sweep):
-# (1) now: md_bal LoRA on GPUs 0,2,3 (train+merge+evals) (2) after sweep: geometry-feedback DPO on GPU 1 (train+export+evals)
-# (3) after both: full FT md_bal on GPUs 0,1,2,3 (ZeRO-3) + evals
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-echo "[sched] $(date) md_bal LoRA on GPUs 0,2,3"
-scripts/run_md_exp.sh 0,2,3 md_bal > logs/exp_md_bal.log 2>&1 &
-( until grep -q "\[bigsweep\] DONE" logs/md_xl_ckpt_sweep.log 2>/dev/null; do sleep 60; done
- echo "[sched] $(date) geometry-feedback DPO on GPU 1"
- GPUS=1 scripts/lf_train.sh configs/lf/dpo_geo_md_xl.yaml gradient_accumulation_steps=8 cutoff_len=4096 > logs/train_dpo_geo_md_xl.log 2>&1
- RUN=runs/lf_qwen35_9b_dpo_geo_md_xl
- if [ ! -f $RUN/train_results.json ]; then echo "[sched] GEO DPO TRAIN FAILED"; grep -E "Error" logs/train_dpo_geo_md_xl.log | grep -v errors | tail -2 | cut -c1-200; echo "[sched] GEO_DONE"; exit 0; fi
- echo "[sched] $(date) geo dpo train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-200)"
- BASE=runs/lf_qwen35_9b_lora_md_xl/merged_geo
- sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_dpo_geo_md_xl.yaml
- scripts/lf_export.sh configs/lf/export_dpo_geo_md_xl.yaml > logs/export_dpo_geo_md_xl.log 2>&1
- GPUS=1 eval/run_eval_vllm.sh $RUN/merged eval/out/qwen35_9b_dpo_geo_md_xl --no_think --max_new_tokens 6144 > logs/eval_dpo_geo_md_xl.log 2>&1
- echo "[sched] geo dpo 3DCodeBench: $(python3 -c "import json; s=json.load(open('eval/out/qwen35_9b_dpo_geo_md_xl/summary.json')); print(s['exec_ok'], round(s['[email protected]_mean_all(fail=0)'],3), 'scored', round(s['[email protected]_mean_scored'],3), '[email protected] scored', round(s['[email protected]_mean_scored'],3))")"
- GPUS=1 eval/run_dialect_eval.sh $RUN/merged dpo_geo_md_xl blender cadquery > logs/mdeval_dpo_geo_md_xl.log 2>&1
- for D in blender cadquery; do echo "[sched] geo dpo $D: $(cat eval/out/md_dpo_geo_md_xl_$D/summary.json | tr -d '\n ' | cut -c1-200)"; done
- GPUS=1 eval/best_of_n.sh $RUN/merged dpo_geo_md_xl_T07 4 0.7 2>&1 | grep -E "pass@" | tail -1 | sed 's/^/[sched] geo dpo /'
- echo "[sched] GEO_DONE" ) &
-until grep -qE "\[md md_bal\] (DONE|TRAIN FAILED|EXPORT FAILED)" logs/exp_md_bal.log 2>/dev/null; do sleep 60; done
-until grep -q "GEO_DONE" logs/explore_sched2.log 2>/dev/null; do sleep 60; done
-echo "[sched] $(date) full FT md_bal on GPUs 0,1,2,3 (ZeRO-3, accum 2)"
-GPUS=0,1,2,3 scripts/lf_train.sh configs/lf/full_md_bal.yaml gradient_accumulation_steps=2 > logs/train_full_md_bal.log 2>&1
-RUN=runs/lf_qwen35_9b_full_md_bal
-if [ -f $RUN/train_results.json ]; then
- echo "[sched] $(date) full md_bal train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-200)"
- GPUS=0 eval/run_eval_vllm.sh $RUN eval/out/qwen35_9b_full_md_bal --no_think --max_new_tokens 6144 > logs/eval_full_md_bal.log 2>&1 &
- GPUS=1 eval/run_dialect_eval.sh $RUN full_md_bal > logs/mdeval_full_md_bal.log 2>&1 &
- wait
- echo "[sched] full md_bal 3DCodeBench: $(python3 -c "import json; s=json.load(open('eval/out/qwen35_9b_full_md_bal/summary.json')); print(s['exec_ok'], round(s['[email protected]_mean_all(fail=0)'],3))")"
- for D in cadquery openscad glsl blender; do echo "[sched] full md_bal $D: $(cat eval/out/md_full_md_bal_$D/summary.json | tr -d '\n ' | cut -c1-160)"; done
-else echo "[sched] FULL TRAIN FAILED"; grep -E "Error" logs/train_full_md_bal.log | grep -v errors | tail -2 | cut -c1-200; fi
-echo "[sched] FULL_DONE"; echo "[sched] ALL DONE"
diff --git a/finetune/scripts/export_lora.sh b/finetune/scripts/export_lora.sh
new file mode 100755
index 00000000..f6632e67
--- /dev/null
+++ b/finetune/scripts/export_lora.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+# Merge a LoRA run into <run_dir>/merged. Replaces the 17 per-run export_*.yaml files that used to differ
+# only in three paths.
+# scripts/export_lora.sh <run_dir> [base_model]
+set -euo pipefail; cd /wekafs/ict/hx_624/llm-ft
+RUN=$(readlink -f "$1"); BASE=${2:-/wekafs/ict/hx_624/models/Qwen3.5-9B}
+CFG=$(mktemp /tmp/export_XXXX.yaml)
+sed -e "s|^model_name_or_path:.*|model_name_or_path: $BASE|" \
+ -e "s|^adapter_name_or_path:.*|adapter_name_or_path: $RUN|" \
+ -e "s|^export_dir:.*|export_dir: $RUN/merged|" configs/lf/export_lora_template.yaml > "$CFG"
+scripts/lf_export.sh "$CFG"; rm -f "$CFG"
+echo "[export] $RUN/merged"
diff --git a/finetune/scripts/fetch_hf_files.py b/finetune/scripts/fetch_hf_files.py
deleted file mode 100644
index a370f5b3..00000000
--- a/finetune/scripts/fetch_hf_files.py
+++ /dev/null
@@ -1,30 +0,0 @@
-"""Download only files matching a regex from an HF dataset repo (handles tree pagination, no file locks).
-usage: python fetch_hf_files.py REPO OUTDIR REGEX [--subdir SUB] [--workers 32]"""
-import argparse, os, re, sys, requests
-from concurrent.futures import ThreadPoolExecutor
-from huggingface_hub import HfApi
-ap = argparse.ArgumentParser(); ap.add_argument("repo"); ap.add_argument("out"); ap.add_argument("regex")
-ap.add_argument("--subdir", default=None); ap.add_argument("--workers", type=int, default=32)
-a = ap.parse_args()
-tok = os.environ["HF_TOKEN"]; api = HfApi(token=tok); pat = re.compile(a.regex)
-files = [f.path for f in api.list_repo_tree(a.repo, repo_type="dataset", path_in_repo=a.subdir, recursive=True) if getattr(f, "size", None) is not None and pat.search(f.path)]
-print(f"[fetch] {len(files)} files match", flush=True)
-sess = requests.Session(); sess.headers["Authorization"] = f"Bearer {tok}"
-def get(p):
- dst = os.path.join(a.out, p)
- if os.path.exists(dst) and os.path.getsize(dst) > 0: return 0
- os.makedirs(os.path.dirname(dst), exist_ok=True)
- for attempt in range(3):
- try:
- r = sess.get(f"https://huggingface.co/datasets/{a.repo}/resolve/main/{p}", timeout=60)
- if r.status_code == 200:
- open(dst, "wb").write(r.content); return 1
- except Exception as e:
- pass
- print("FAIL", p, flush=True); return -1
-n = 0
-with ThreadPoolExecutor(a.workers) as ex:
- for i, r in enumerate(ex.map(get, files)):
- n += (r == 1)
- if (i + 1) % 500 == 0: print(f"[fetch] {i+1}/{len(files)}", flush=True)
-print(f"[fetch] done: {n} downloaded, {len(files)} total", flush=True)
diff --git a/finetune/scripts/fetch_textfiles.sh b/finetune/scripts/fetch_textfiles.sh
deleted file mode 100755
index e5caf550..00000000
--- a/finetune/scripts/fetch_textfiles.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-# Fetch only small text files (code/captions/meta/reports) of per-sample HF dataset folders with parallel curl.
-# usage: fetch_textfiles.sh <repo_id> <subpath-or-empty> <outdir> <regex-of-files-to-keep>
-REPO=$1; SUB=$2; OUT=$3; PAT=$4
-mkdir -p "$OUT"; cd "$OUT" || exit 1
-curl -s -H "Authorization: Bearer $HF_TOKEN" "https://huggingface.co/api/datasets/$REPO/tree/main/$SUB?recursive=true" \
- | python3 -c "import sys,json,re; pat=re.compile(sys.argv[1]); [print(x['path']) for x in json.load(sys.stdin) if x['type']=='file' and pat.search(x['path'])]" "$PAT" > .filelist
-echo "files to fetch: $(wc -l < .filelist)"
-cat .filelist | xargs -P 32 -I{} bash -c 'f="{}"; mkdir -p "$(dirname "$f")"; [ -s "$f" ] || curl -sS -L -H "Authorization: Bearer $HF_TOKEN" -o "$f" "https://huggingface.co/datasets/'$REPO'/resolve/main/$f" || echo "FAIL $f"'
-echo "FETCH_DONE $(find . -type f ! -name .filelist | wc -l) files"
diff --git a/finetune/scripts/finalize_glsl.py b/finetune/scripts/finalize_glsl.py
deleted file mode 100644
index bbc883c1..00000000
--- a/finetune/scripts/finalize_glsl.py
+++ /dev/null
@@ -1,85 +0,0 @@
-"""Final consolidation for the flattened Shadertoy corpus.
-
-Order of preference, so the data stays as close to the author's source as possible:
- 1. the ORIGINAL merged program, if the (now correct) validator compiles it -> untouched
- 2. the agent-repaired program from glsl_repair/<cat>_fixed/, if it compiles -> repaired
- 3. otherwise -> kept, marked compiles=False
-Writes the `compiles` / `repair` columns back into every shadertoy *_llamafactory_flat parquet.
-"""
-import collections, glob, hashlib, json, os, re, sys
-from concurrent.futures import ProcessPoolExecutor
-import pandas as pd
-sys.path.insert(0, "/wekafs/ict/hx_624/llm-ft/scripts")
-from qc_repair import code_of, glsl_compile
-
-REPAIR = "/wekafs/ict/hx_624/glsl_repair"
-
-def load_fixed():
- out = {}
- for cat in ("overload", "undeclared", "const_init", "syntax", "redefinition", "type", "other"):
- d = f"{REPAIR}/{cat}_fixed"
- idx = f"{REPAIR}/{cat}/index.json"
- if not (os.path.isdir(d) and os.path.exists(idx)):
- continue
- meta = json.load(open(idx))
- for f in glob.glob(f"{d}/*.glsl"):
- stem = os.path.basename(f)[:-5]
- h = (meta.get(stem) or {}).get("hash")
- if h:
- out[h] = (cat, open(f).read())
- return out
-
-def job(args):
- h, body, fixed = args
- ok, _ = glsl_compile(body)
- if ok:
- return h, True, "original", None
- if fixed:
- cat, code = fixed
- ok2, _ = glsl_compile(code)
- if ok2:
- return h, True, f"repaired:{cat}", code
- return h, False, "unfixable", None
-
-def main():
- fixed = load_fixed()
- print(f"[fin] agent repairs available: {len(fixed)}", flush=True)
- dirs = sorted(glob.glob("/wekafs/ict/hx_624/hf_subdirs/shadertoy/*_llamafactory_flat"))
- uniq, where = {}, collections.defaultdict(list)
- for d in dirs:
- df = pd.read_parquet(os.path.join(d, "train.parquet"))
- for i, row in enumerate(df.itertuples()):
- b = code_of(row.conversations[1]["value"]); h = hashlib.md5(b.encode()).hexdigest()
- uniq.setdefault(h, b); where[h].append(d)
- items = [(h, b, fixed.get(h)) for h, b in uniq.items()]
- print(f"[fin] validating {len(items)} unique programs", flush=True)
- res = {}
- with ProcessPoolExecutor(28) as ex:
- for n, (h, ok, how, code) in enumerate(ex.map(job, items, chunksize=8)):
- res[h] = (ok, how, code)
- if (n+1) % 10000 == 0:
- g = sum(1 for v in res.values() if v[0])
- print(f"[fin] {n+1}/{len(items)} ok={g} ({100*g/(n+1):.1f}%)", flush=True)
- stats = collections.Counter(v[1] for v in res.values())
- for d in dirs:
- p = os.path.join(d, "train.parquet"); df = pd.read_parquet(p)
- conv = df["conversations"].tolist(); okc, howc = [], []
- for c in conv:
- b = code_of(c[1]["value"]); h = hashlib.md5(b.encode()).hexdigest()
- ok, how, code = res.get(h, (False, "unknown", None))
- if code:
- c[1]["value"] = "```glsl\n" + code.strip() + "\n```"
- okc.append(ok); howc.append(how)
- df["conversations"] = conv; df["compiles"] = okc; df["repair"] = howc
- df.to_parquet(p, index=False, compression="zstd")
- json.dump({"rows": len(df), "compiles": int(sum(okc)),
- "repaired": int(sum(1 for x in howc if x.startswith("repaired")))},
- open(os.path.join(d, "qc.json"), "w"), indent=2)
- good = sum(1 for v in res.values() if v[0])
- json.dump({"unique_programs": len(items), "compile_ok": good,
- "compile_rate": round(good/len(items), 4), "how": dict(stats)},
- open("/wekafs/ict/hx_624/hf_subdirs/glsl_final_report.json", "w"), indent=2)
- print(f"[fin] FINAL {good}/{len(items)} = {100*good/len(items):.1f}% | {dict(stats)}", flush=True)
-
-if __name__ == "__main__":
- main()
diff --git a/finetune/scripts/flatten_multifile.py b/finetune/scripts/flatten_multifile.py
deleted file mode 100644
index 23e9af06..00000000
--- a/finetune/scripts/flatten_multifile.py
+++ /dev/null
@@ -1,181 +0,0 @@
-"""Flatten every multi-file sample into ONE self-contained file, so the whole corpus is single-file SFT data.
-
-Two sources are multi-file in the original dataset and both can be flattened exactly:
-
- shadertoy `shader_json.renderpass` holds the source of every tab. Shadertoy itself compiles
- `Common + <pass>`, so we emit that concatenation verbatim:
- * the Image pass with Common prepended → the sample's main program
- * each Buffer pass with Common prepended → an extra sample (it is a complete shader too)
- A shader whose passes read `iChannel` as a *buffer* is still emitted, with a one-line comment
- stating which channels are buffers, because the code itself is complete.
- articraft `code` is empty in the metadata; the real `code.urdf` lives inside the subdir tars, which are
- downloaded separately and extracted by `--urdf_tars`.
-
-Everything is then re-emitted in LLaMA-Factory ShareGPT format next to the other converted subdirs.
-
-usage:
- python scripts/flatten_multifile.py --shadertoy [--out /wekafs/ict/hx_624/hf_subdirs]
- python scripts/flatten_multifile.py --urdf_tars /wekafs/ict/hx_624/data/3dcodeverse_tars
-"""
-import argparse
-import collections
-import glob
-import io
-import json
-import os
-import re
-import tarfile
-
-import pandas as pd
-
-META = "/wekafs/ict/hx_624/data/3dcodeverse_meta"
-SYS_GLSL = ("You are an expert shader programmer. Given a description, write a complete Shadertoy-style GLSL ES 3.00 "
- "fragment shader defining `void mainImage(out vec4 fragColor, in vec2 fragCoord)`. Output ONLY the code in one ```glsl block.")
-SYS_URDF = ("You are an expert in articulated 3D assets. Given a description, write a complete, self-contained URDF "
- "file (links, joints, inertial and visual geometry) for it. Output ONLY the code in one ```xml block.")
-IMPERATIVE = ("write", "create", "implement", "make", "build", "generate", "design", "produce")
-
-
-def phrase(kind, text, lead):
- t = (text or "").strip()
- if not t:
- return None
- if kind == "instruction" and t.lower().startswith(IMPERATIVE):
- return t
- return lead + t
-
-
-def flatten_shadertoy(out_root):
- subs = sorted(glob.glob(f"{META}/shadertoy/*/metadata.parquet"))
- stats = collections.Counter()
- for p in subs:
- sub = "/".join(p.split("/")[-3:-1])
- df = pd.read_parquet(p)
- rows = []
- for r in df.itertuples():
- try:
- sj = json.loads(r.shader_json) if isinstance(r.shader_json, str) else (r.shader_json or {})
- except Exception:
- sj = {}
- passes = (sj.get("Shader", sj) or {}).get("renderpass") or []
- if not passes:
- continue
- common = "\n".join(q.get("code") or "" for q in passes if q.get("type") == "common").strip()
- caps = r.captions if isinstance(r.captions, dict) else (json.loads(r.captions) if isinstance(r.captions, str) else {})
- for q in passes:
- t = q.get("type")
- if t not in ("image", "buffer"):
- continue # sound/cubemap passes are a different program shape
- body = (q.get("code") or "").strip()
- if len(body) < 40:
- continue
- buf_inputs = [i for i in (q.get("inputs") or []) if (i or {}).get("ctype") == "buffer"]
- header = ""
- if common:
- header += "// ---- Common tab ----\n" + common + "\n// ---- " + str(q.get("name")) + " ----\n"
- stats["merged_common"] += 1
- if buf_inputs:
- header = f"// note: iChannel{','.join(str(i.get('channel')) for i in buf_inputs)} read a previous buffer pass\n" + header
- code = header + body
- tag = "" if t == "image" else f"::{str(q.get('name')).replace(' ', '')}"
- lead = "Write a GLSL fragment shader for Shadertoy that renders: "
- if t == "buffer":
- lead = "Write the buffer pass of a Shadertoy shader that computes: "
- used = 0
- for kind in ("instruction", "detailed", "factory"):
- pr = phrase(kind, caps.get(kind), lead)
- if not pr or len(pr) < 20:
- continue
- used += 1
- rows.append({"id": f"{r.id}{tag}", "caption_type": kind, "pass_type": t,
- "has_common": bool(common), "system": SYS_GLSL,
- "conversations": [{"from": "human", "value": pr},
- {"from": "gpt", "value": f"```glsl\n{code}\n```"}]})
- stats["pass_" + t] += 1 if used else 0
- if not rows:
- continue
- d = os.path.join(out_root, sub + "_llamafactory_flat")
- os.makedirs(d, exist_ok=True)
- pd.DataFrame(rows).to_parquet(os.path.join(d, "train.parquet"), index=False, compression="zstd")
- key = "3dcv_" + sub.replace("/", "__") + "_flat"
- json.dump({key: {"file_name": "train.parquet", "formatting": "sharegpt",
- "columns": {"messages": "conversations", "system": "system"}}},
- open(os.path.join(d, "dataset_info.json"), "w"), indent=2)
- stats["rows"] += len(rows)
- stats["subdirs"] += 1
- print(f"[flat] shadertoy: {stats['subdirs']} subdirs, {stats['rows']:,} rows "
- f"(image passes {stats['pass_image']:,}, buffer passes {stats['pass_buffer']:,}, "
- f"{stats['merged_common']:,} programs got their Common tab merged in)", flush=True)
- return dict(stats)
-
-
-def extract_urdf(tar_dir, out_root):
- """pull code.urdf out of the articraft tars and re-emit the two subdirs with real code"""
- code_by_key = {}
- for t in sorted(glob.glob(f"{tar_dir}/articraft/urdf_*/*.tar")):
- sub = t.split("/")[-2]
- try:
- with tarfile.open(t) as tf:
- for m in tf:
- if not m.isfile() or not m.name.endswith(".urdf"):
- continue
- key = os.path.basename(os.path.dirname(m.name))
- try:
- code_by_key[(sub, key)] = tf.extractfile(m).read().decode("utf-8", "replace")
- except Exception:
- pass
- except Exception as e:
- print(f"[flat] tar unreadable {t}: {e}", flush=True)
- print(f"[flat] urdf: extracted {len(code_by_key):,} .urdf files from {tar_dir}", flush=True)
- total = 0
- for sub in ("articraft/urdf_geo_only", "articraft/urdf_tex"):
- p = f"{META}/{sub}/metadata.parquet"
- if not os.path.exists(p):
- continue
- df = pd.read_parquet(p)
- rows, miss = [], 0
- for r in df.itertuples():
- key = str(r.key) if hasattr(r, "key") else None
- code = code_by_key.get((sub.split("/")[-1], key)) or code_by_key.get((sub.split("/")[-1], str(r.id).split("/")[-1]))
- if not code or len(code.strip()) < 40:
- miss += 1
- continue
- caps = r.captions if isinstance(r.captions, dict) else (json.loads(r.captions) if isinstance(r.captions, str) else {})
- for kind in ("instruction", "detailed", "factory"):
- pr = phrase(kind, caps.get(kind), "Write a URDF description of: ")
- if not pr or len(pr) < 20:
- continue
- rows.append({"id": str(r.id), "caption_type": kind, "system": SYS_URDF,
- "conversations": [{"from": "human", "value": pr},
- {"from": "gpt", "value": f"```xml\n{code.strip()}\n```"}]})
- if rows:
- d = os.path.join(out_root, sub + "_llamafactory")
- os.makedirs(d, exist_ok=True)
- pd.DataFrame(rows).to_parquet(os.path.join(d, "train.parquet"), index=False, compression="zstd")
- key = "3dcv_" + sub.replace("/", "__")
- json.dump({key: {"file_name": "train.parquet", "formatting": "sharegpt",
- "columns": {"messages": "conversations", "system": "system"}}},
- open(os.path.join(d, "dataset_info.json"), "w"), indent=2)
- json.dump({"subdir": sub, "dialect": "urdf", "source_samples": len(df), "exported_pairs": len(rows),
- "unique_samples_exported": len(df) - miss, "missing_in_tar": miss,
- "note": "code recovered from the subdir tars (the metadata `code` column is empty)"},
- open(os.path.join(d, "qc.json"), "w"), indent=2)
- print(f"[flat] {sub}: {len(rows):,} pairs from {len(df)-miss:,} samples ({miss} not found in the tars)", flush=True)
- total += len(rows)
- return total
-
-
-def main():
- ap = argparse.ArgumentParser()
- ap.add_argument("--out", default="/wekafs/ict/hx_624/hf_subdirs")
- ap.add_argument("--shadertoy", action="store_true")
- ap.add_argument("--urdf_tars", default=None)
- a = ap.parse_args()
- if a.shadertoy:
- flatten_shadertoy(a.out)
- if a.urdf_tars:
- extract_urdf(a.urdf_tars, a.out)
-
-
-if __name__ == "__main__":
- main()
diff --git a/finetune/scripts/geo_dpo_build.sh b/finetune/scripts/geo_dpo_build.sh
deleted file mode 100755
index 12b071b5..00000000
--- a/finetune/scripts/geo_dpo_build.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/bash
-# Geometry-feedback DPO data: sample md_xl (merged_geo) K times on train prompts that have reference code -> execute -> [email protected] vs reference mesh -> (high-F, low-F/FAIL) pairs
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft; G=${GPUS:-0}; W=data/geo_dpo; M=runs/lf_qwen35_9b_lora_md_xl/merged_geo
-until [ -f $M/config.json ] && [ -n "$(ls $M/*.safetensors 2>/dev/null)" ] && [ $(( $(date +%s) - $(stat -c %Y logs/export_md_xl_geo.log) )) -gt 90 ]; do sleep 30; done
-until grep -q "\[xlextra\] DONE" logs/md_xl_extra_eval.log 2>/dev/null; do sleep 30; done
-echo "[geo] $(date) sampling on GPU $G"
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$G
-for i in 1 2 3 4; do python eval/generate_vllm.py --model $M --prompts $W/blender_vllm_prompts.jsonl --out $W/gen_blender_s$i --tp 1 --no_think --max_new_tokens 4096 --temperature 0.8 --seed $((500+i)) 2>&1 | grep -E "gen-vllm|Error" | tail -1; done
-for i in 1 2; do python eval/generate_vllm.py --model $M --prompts $W/cadquery_vllm_prompts.jsonl --out $W/gen_cadquery_s$i --tp 1 --no_think --max_new_tokens 4096 --temperature 0.8 --seed $((600+i)) 2>&1 | grep -E "gen-vllm|Error" | tail -1; done
-echo "[geo] $(date) sampling done; executing + scoring"
-conda activate llmft
-for i in 1 2 3 4; do python eval/blender_dialect_eval.py --test $W/blender_prompts.jsonl --gen_dir $W/gen_blender_s$i --workers 40 2>&1 | tail -1 | cut -c1-200; done
-for i in 1 2; do python eval/dialect_eval.py --dialect cadquery --test $W/cadquery_prompts.jsonl --gen_dir $W/gen_cadquery_s$i --workers 32 2>&1 | tail -1 | cut -c1-200; done
-python - <<'PY'
-import json, os, re, random, glob
-from collections import Counter, defaultdict
-W="data/geo_dpo"; random.seed(7)
-def code_of(d, tid):
- p=f"{d}/{tid}/code.py"; return open(p).read().strip() if os.path.exists(p) else None
-prompts={}
-for dia in ["blender","cadquery"]:
- for l in open(f"{W}/{dia}_prompts.jsonl"):
- r=json.loads(l); prompts[r["id"].replace("/","__")]=(dia, r["messages"][0]["content"], r["messages"][1]["content"])
-by=defaultdict(list) # tid -> [(F or None, status, code)]
-for d in sorted(glob.glob(f"{W}/gen_*_s*")):
- mp=f"{d}/dialect_metrics.jsonl"
- if not os.path.exists(mp): continue
- for l in open(mp):
- r=json.loads(l); tid=r["id"]; code=code_of(d, tid)
- if not code or code.count("\n")<3: continue
- by[tid].append((r.get("[email protected]"), r.get("gen"), code))
-pairs=[]; kinds=Counter(); per=Counter()
-for tid, lst in by.items():
- dia, sys_, user=prompts[tid]; ok=[x for x in lst if x[1]=="OK" and x[0] is not None]; bad=[x for x in lst if x[1]!="OK"]
- if not ok: continue
- best=max(ok, key=lambda x:x[0]); worst=min(ok, key=lambda x:x[0])
- def mk(ch, rj, kind):
- if ch==rj: return
- pairs.append({"conversations":[{"from":"human","value":user}],"system":sys_,"chosen":{"from":"gpt","value":ch if ch.startswith("```") else "```\n"+ch+"\n```"},"rejected":{"from":"gpt","value":rj if rj.startswith("```") else "```\n"+rj+"\n```"}}); kinds[kind]+=1; per[dia]+=1
- if best[0]>=0.25 and len(ok)>=2 and best[0]-worst[0]>=0.15: mk(best[2], worst[2], "geo")
- if best[0]>=0.25 and bad: mk(best[2], random.choice(bad)[2], "exec")
-random.shuffle(pairs); json.dump(pairs, open("data/lf/dpo_geo_pairs.json","w"), ensure_ascii=False)
-info=json.load(open("data/lf/dataset_info.json")); info["dpo_geo_pairs"]={"file_name":"dpo_geo_pairs.json","ranking":True,"formatting":"sharegpt","columns":{"messages":"conversations","system":"system","chosen":"chosen","rejected":"rejected"}}
-json.dump(info, open("data/lf/dataset_info.json","w"), indent=2)
-okF=[x[0] for l in by.values() for x in l if x[1]=="OK" and x[0] is not None]
-print("geo pairs:", len(pairs), dict(kinds), dict(per), "| prompts with samples:", len(by), "| mean F of OK samples %.3f" % (sum(okF)/max(1,len(okF))))
-PY
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $M)|" -e "s|dataset: dpo_exec_pairs|dataset: dpo_geo_pairs|" -e "s|output_dir:.*|output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_geo_md_xl|" -e "s|overwrite_output_dir:.*|overwrite_output_dir: true|" configs/lf/dpo_exec_v1.yaml > configs/lf/dpo_geo_md_xl.yaml
-echo "GEO_PAIRS_READY"
diff --git a/finetune/scripts/launch_sft.sh b/finetune/scripts/launch_sft.sh
deleted file mode 100755
index 3b37a0c1..00000000
--- a/finetune/scripts/launch_sft.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-# usage: GPUS=0,1 ./launch_sft.sh <run_name> [extra train_sft.py args...]
-# Runs torchrun on the given GPUs (must be a subset of 0-3 per the user's rule).
-set -euo pipefail
-source /wekafs/ict/hx_624/llm-ft/env.sh
-export CUDA_VISIBLE_DEVICES=${GPUS:-0,1}
-RUN=$1; shift
-NGPU=$(echo $CUDA_VISIBLE_DEVICES | tr ',' '\n' | wc -l)
-OUT=/wekafs/ict/hx_624/llm-ft/runs/$RUN
-mkdir -p $OUT
-PORT=$((29500 + RANDOM % 500))
-echo "[launch] run=$RUN gpus=$CUDA_VISIBLE_DEVICES ngpu=$NGPU port=$PORT out=$OUT"
-cd /wekafs/ict/hx_624/llm-ft
-torchrun --nproc_per_node=$NGPU --master_port=$PORT scripts/train_sft.py --output_dir $OUT "$@" 2>&1 | tee -a $OUT/train.log
diff --git a/finetune/scripts/make_lora_cfg.py b/finetune/scripts/make_lora_cfg.py
deleted file mode 100644
index ed02ec62..00000000
--- a/finetune/scripts/make_lora_cfg.py
+++ /dev/null
@@ -1,12 +0,0 @@
-"""make_lora_cfg.py NAME DATANAME [--epochs 2] [--lr 1e-4] -> configs/lf/lora_<NAME>.yaml (from the v1 LoRA template)"""
-import sys, argparse, yaml
-ap = argparse.ArgumentParser(); ap.add_argument("name"); ap.add_argument("dataname"); ap.add_argument("--epochs", type=float, default=2.0); ap.add_argument("--lr", type=float, default=1e-4)
-ap.add_argument("--rank", type=int, default=64); ap.add_argument("--cutoff", type=int, default=8192)
-a = ap.parse_args()
-cfg = yaml.safe_load(open("/wekafs/ict/hx_624/llm-ft/configs/lf/qwen35_9b_lora_sft.yaml"))
-cfg.update(dataset=f"{a.dataname}_train", eval_dataset=f"{a.dataname}_val",
- tokenized_path=f"/wekafs/ict/hx_624/llm-ft/data/lf/tokenized_{a.dataname}_len{a.cutoff}_packed",
- output_dir=f"/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_{a.name}",
- num_train_epochs=a.epochs, learning_rate=a.lr, lora_rank=a.rank, lora_alpha=2 * a.rank, cutoff_len=a.cutoff)
-out = f"/wekafs/ict/hx_624/llm-ft/configs/lf/lora_{a.name}.yaml"
-yaml.safe_dump(cfg, open(out, "w"), sort_keys=False); print(out)
diff --git a/finetune/scripts/md_big_ckpt_sweep.sh b/finetune/scripts/md_big_ckpt_sweep.sh
deleted file mode 100755
index a012b5df..00000000
--- a/finetune/scripts/md_big_ckpt_sweep.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-# After md_big training: evaluate intermediate checkpoints (training-amount curve) on 3DCodeBench (greedy) + dialect tests (greedy blender; T=0.7 cq/scad/glsl)
-set -uo pipefail; GPU=${GPUS:-1}; cd /wekafs/ict/hx_624/llm-ft; RUN=/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_big
-until grep -q "\[md md_big\] .*train done" logs/exp_md_big.log 2>/dev/null; do sleep 60; done
-CKS=$(ls -d $RUN/checkpoint-* 2>/dev/null | sed 's/.*checkpoint-//' | sort -n | tr '\n' ' '); echo "[bigsweep] checkpoints: $CKS"
-for STEP in $CKS; do
- CK=$RUN/checkpoint-$STEP; NAME=md_big_ck$STEP
- sed -e "s|adapter_name_or_path:.*|adapter_name_or_path: $CK|" -e "s|export_dir:.*|export_dir: $CK/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_$NAME.yaml
- scripts/lf_export.sh configs/lf/export_$NAME.yaml > logs/export_$NAME.log 2>&1 || { echo "[bigsweep] EXPORT FAILED $STEP"; continue; }
- GPUS=$GPU eval/run_eval_vllm.sh $CK/merged eval/out/qwen35_9b_lora_$NAME --no_think --max_new_tokens 6144 > logs/eval_$NAME.log 2>&1
- echo "[bigsweep] ck$STEP 3DCodeBench: $(python3 -c "import json; s=json.load(open('eval/out/qwen35_9b_lora_$NAME/summary.json')); print(s['exec_ok'], round(s['[email protected]_mean_all(fail=0)'],3))")"
- GPUS=$GPU eval/run_dialect_eval.sh $CK/merged $NAME blender > logs/mdeval_$NAME.log 2>&1
- source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm; export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$GPU
- for D in glsl openscad cadquery; do OUT=eval/out/md_${NAME}_T07_$D; mkdir -p $OUT; cp eval/out/md_md_mixed_$D/prompts.jsonl $OUT/; python eval/generate_vllm.py --model $CK/merged --prompts $OUT/prompts.jsonl --out $OUT --tp 1 --no_think --max_new_tokens 8192 --temperature 0.7 --seed 1 2>&1 | grep -E "gen-vllm" | tail -1; done
- conda activate llmft
- for D in glsl openscad cadquery; do python eval/dialect_eval.py --dialect $D --test data/multidialect/$D/test.jsonl --gen_dir eval/out/md_${NAME}_T07_$D --workers 32 2>&1 | grep -E "dialect"; done
- echo "[bigsweep] ck$STEP blender: $(cat eval/out/md_${NAME}_blender/summary.json | tr -d '\n ' | cut -c1-140)"
- rm -rf $CK/merged
-done
-echo "[bigsweep] DONE"
diff --git a/finetune/scripts/md_big_dpo_round.sh b/finetune/scripts/md_big_dpo_round.sh
deleted file mode 100755
index 042f8ed2..00000000
--- a/finetune/scripts/md_big_dpo_round.sh
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/bin/bash
-# Multi-dialect execution-feedback DPO on md_big: sample K=2 (T=0.8) on 1500 train prompts per dialect -> execute with each dialect's executor -> (OK, FAIL) pairs -> DPO -> eval (sampling for cq/scad/glsl, greedy for blender & 3DCodeBench)
-set -uo pipefail; GPU=${GPUS:-2,3}; G1=$(echo $GPU | cut -d, -f1); G2=$(echo $GPU | cut -d, -f2); cd /wekafs/ict/hx_624/llm-ft; W=data/md_big_dpo_round; mkdir -p $W
-echo "[bigdpo] $(date) start"
-source /wekafs/ict/hx_624/llm-ft/env.sh
-python - <<'PY'
-import json, random; random.seed(5)
-rows=[]
-for d in ["cadquery","openscad","glsl","blender"]:
- rs=[json.loads(l) for l in open(f"data/md_{d}/train.jsonl")]; random.shuffle(rs)
- for i,r in enumerate(rs[:1500]): rows.append({"task": f"{d}_{i:05d}", "dialect": d, "messages": r["messages"][:2]})
-random.shuffle(rows)
-for g in range(2):
- with open(f"data/md_big_dpo_round/prompts_g{g}.jsonl","w") as f:
- for r in rows[g::2]: f.write(json.dumps(r)+"\n")
-print("prompts", len(rows))
-PY
-BASE=runs/lf_qwen35_9b_lora_md_big/merged
-[ -d $BASE ] || scripts/lf_export.sh configs/lf/export_md_big.yaml > logs/export_md_big_dpo.log 2>&1 || { echo "[bigdpo] EXPORT FAILED"; exit 1; }
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING
-for i in 1 2; do
- CUDA_VISIBLE_DEVICES=$G1 python eval/generate_vllm.py --model $BASE --prompts $W/prompts_g0.jsonl --out $W/gen_s${i}_g0 --tp 1 --no_think --max_new_tokens 6144 --temperature 0.8 --seed $((400+i)) > $W/gen_s${i}_g0.log 2>&1 &
- CUDA_VISIBLE_DEVICES=$G2 python eval/generate_vllm.py --model $BASE --prompts $W/prompts_g1.jsonl --out $W/gen_s${i}_g1 --tp 1 --no_think --max_new_tokens 6144 --temperature 0.8 --seed $((410+i)) > $W/gen_s${i}_g1.log 2>&1 &
- wait; grep -h gen-vllm $W/gen_s${i}_g0.log $W/gen_s${i}_g1.log
-done
-echo "[bigdpo] $(date) sampling done"
-conda activate llmft
-python - <<'PY'
-# execute every generation with its dialect's executor (parallel), then build pairs
-import json, glob, os, sys, random
-from concurrent.futures import ThreadPoolExecutor
-sys.path.insert(0, "eval"); from dialect_runners import RUNNERS
-import subprocess
-BL="/wekafs/ict/hx_624/tools/blender-5.0.1-linux-x64/blender"; RUNNER=os.path.abspath("eval/blender_runner.py")
-def run_blender(code, d):
- d=os.path.abspath(d); os.makedirs(d, exist_ok=True); sp=os.path.join(d,"code.py"); open(sp,"w").write(code)
- try:
- subprocess.run([BL,"-b","--factory-startup","-noaudio","--python",RUNNER,"--","--script",sp,"--out",os.path.join(d,"out.glb"),"--report",os.path.join(d,"exec.json")],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL,timeout=120,env={**os.environ,"HOME":"/tmp"})
- r=json.load(open(os.path.join(d,"exec.json"))) if os.path.exists(os.path.join(d,"exec.json")) else {"status":"CRASH"}
- except subprocess.TimeoutExpired: r={"status":"TIMEOUT"}
- return r
-W="data/md_big_dpo_round"; prompts={}
-for f in glob.glob(f"{W}/prompts_g*.jsonl"):
- for l in open(f): r=json.loads(l); prompts[r["task"]]=r
-jobs=[]
-for d in sorted(glob.glob(f"{W}/gen_s*_g*/")):
- for t in os.listdir(d):
- cp=os.path.join(d,t,"code.py")
- if os.path.isfile(cp): jobs.append((d,t))
-def job(x):
- d,t=x; code=open(os.path.join(d,t,"code.py")).read(); dia=prompts[t]["dialect"]; wd=os.path.join(d,t,"exec")
- r = run_blender(code, wd) if dia=="blender" else RUNNERS[dia](code, wd)
- return (d,t,dia,r.get("status"))
-with ThreadPoolExecutor(48) as ex: res=list(ex.map(job, jobs))
-by={}
-for d,t,dia,st in res:
- code=open(os.path.join(d,t,"code.py")).read().strip()
- if code.count("\n")<3: continue
- by.setdefault(t,{"dia":dia,"ok":[],"bad":[]})["ok" if st=="OK" else "bad"].append(code)
-from collections import Counter
-print("per-dialect pass rate:", {dia: round(sum(1 for d_,t_,di,st in res if di==dia and st=="OK")/max(1,sum(1 for d_,t_,di,st in res if di==dia)),3) for dia in ["cadquery","openscad","glsl","blender"]})
-random.seed(2); pairs=[]; per=Counter()
-for t,v in by.items():
- if v["ok"] and v["bad"]:
- ok=random.choice(v["ok"]); bad=random.choice(v["bad"])
- if ok==bad: continue
- p=prompts[t]; per[v["dia"]]+=1
- pairs.append({"conversations":[{"from":"human","value":p["messages"][1]["content"]}],"system":p["messages"][0]["content"],"chosen":{"from":"gpt","value":ok if ok.startswith("```") else "```\n"+ok+"\n```"},"rejected":{"from":"gpt","value":bad if bad.startswith("```") else "```\n"+bad+"\n```"}})
-random.shuffle(pairs); json.dump(pairs, open("data/lf/dpo_md_big_pairs.json","w"), ensure_ascii=False)
-info=json.load(open("data/lf/dataset_info.json")); info["dpo_md_big_pairs"]={"file_name":"dpo_md_big_pairs.json","ranking":True,"formatting":"sharegpt","columns":{"messages":"conversations","system":"system","chosen":"chosen","rejected":"rejected"}}
-json.dump(info, open("data/lf/dataset_info.json","w"), indent=2); print("md pairs:", len(pairs), dict(per))
-PY
-echo "[bigdpo] $(date) pairs built"
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" -e "s|dataset: dpo_exec_pairs|dataset: dpo_md_big_pairs|" -e "s|output_dir:.*|output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_md_big|" configs/lf/dpo_exec_v1.yaml > configs/lf/dpo_md_big.yaml
-GPUS=$GPU scripts/lf_train.sh configs/lf/dpo_md_big.yaml gradient_accumulation_steps=8 cutoff_len=4096 > logs/train_dpo_md_big.log 2>&1
-RUN=runs/lf_qwen35_9b_dpo_md_big; [ -f $RUN/train_results.json ] || { echo "[bigdpo] TRAIN FAILED"; exit 1; }
-echo "[bigdpo] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_dpo_md_big.yaml
-scripts/lf_export.sh configs/lf/export_dpo_md_big.yaml > logs/export_dpo_md_big.log 2>&1 || { echo "[bigdpo] EXPORT2 FAILED"; exit 1; }
-GPUS=$G1 eval/run_eval_vllm.sh $RUN/merged eval/out/qwen35_9b_dpo_md_big --no_think --max_new_tokens 6144 > logs/eval_dpo_md_big.log 2>&1
-echo "[bigdpo] 3DCodeBench: $(python3 -c "import json; s=json.load(open('eval/out/qwen35_9b_dpo_md_big/summary.json')); print(s['exec_ok'], round(s['[email protected]_mean_all(fail=0)'],3))")"
-GPUS=$G1 eval/run_dialect_eval.sh $RUN/merged dpo_md_big > logs/mdeval_dpo_md_big.log 2>&1
-# sampling eval for cq/scad/glsl
-conda activate vllm; export CUDA_VISIBLE_DEVICES=$G1
-for D in glsl openscad cadquery; do OUT=eval/out/md_dpo_md_big_T07_$D; mkdir -p $OUT; cp eval/out/md_dpo_md_big_$D/prompts.jsonl $OUT/; python eval/generate_vllm.py --model $RUN/merged --prompts $OUT/prompts.jsonl --out $OUT --tp 1 --no_think --max_new_tokens 8192 --temperature 0.7 --seed 1 2>&1 | grep -E "gen-vllm" | tail -1; done
-conda activate llmft
-for D in glsl openscad cadquery; do python eval/dialect_eval.py --dialect $D --test data/multidialect/$D/test.jsonl --gen_dir eval/out/md_dpo_md_big_T07_$D --workers 32 2>&1 | grep -E "dialect"; done
-for D in cadquery openscad glsl blender; do echo "[bigdpo] greedy $D: $(cat eval/out/md_dpo_md_big_$D/summary.json | tr -d '\n ' | cut -c1-160)"; done
-rm -rf $RUN/merged $BASE; echo "[bigdpo] DONE"
diff --git a/finetune/scripts/md_dpo_resume.sh b/finetune/scripts/md_dpo_resume.sh
deleted file mode 100755
index 80bb068e..00000000
--- a/finetune/scripts/md_dpo_resume.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-# resume multi-dialect DPO after OOM: train with cutoff 4096 (long GLSL/OpenSCAD pairs), then export + evals
-set -uo pipefail; GPU=${GPUS:-2,3}; G1=$(echo $GPU | cut -d, -f1); cd /wekafs/ict/hx_624/llm-ft
-BASE=runs/lf_qwen35_9b_lora_md_mixed/merged; RUN=runs/lf_qwen35_9b_dpo_md_mixed
-echo "[mddpo] $(date) retrain with cutoff 4096"
-GPUS=$GPU scripts/lf_train.sh configs/lf/dpo_md_mixed.yaml gradient_accumulation_steps=8 cutoff_len=4096 > logs/train_dpo_md_mixed.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[mddpo] TRAIN FAILED"; grep -E "Error" logs/train_dpo_md_mixed.log | grep -v errors | tail -2 | cut -c1-200; exit 1; }
-echo "[mddpo] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_dpo_md_mixed.yaml
-scripts/lf_export.sh configs/lf/export_dpo_md_mixed.yaml > logs/export_dpo_md_mixed.log 2>&1 || { echo "[mddpo] EXPORT2 FAILED"; exit 1; }
-GPUS=$G1 eval/run_eval_vllm.sh $RUN/merged eval/out/qwen35_9b_dpo_md_mixed --no_think --max_new_tokens 6144 > logs/eval_dpo_md_mixed.log 2>&1
-echo "[mddpo] 3DCodeBench: $(python3 -c "import json; s=json.load(open('eval/out/qwen35_9b_dpo_md_mixed/summary.json')); print(s['exec_ok'], round(s['[email protected]_mean_all(fail=0)'],3))")"
-GPUS=$G1 eval/run_dialect_eval.sh $RUN/merged dpo_md_mixed > logs/mdeval_dpo_md_mixed.log 2>&1
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm; export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$G1
-for D in glsl openscad cadquery; do OUT=eval/out/md_dpo_md_mixed_T07_$D; mkdir -p $OUT; cp eval/out/md_dpo_md_mixed_$D/prompts.jsonl $OUT/; python eval/generate_vllm.py --model $RUN/merged --prompts $OUT/prompts.jsonl --out $OUT --tp 1 --no_think --max_new_tokens 8192 --temperature 0.7 --seed 1 2>&1 | grep -E "gen-vllm" | tail -1; done
-conda activate llmft
-for D in glsl openscad cadquery; do python eval/dialect_eval.py --dialect $D --test data/multidialect/$D/test.jsonl --gen_dir eval/out/md_dpo_md_mixed_T07_$D --workers 32 2>&1 | grep -E "dialect"; done
-for D in cadquery openscad glsl blender; do echo "[mddpo] greedy $D: $(cat eval/out/md_dpo_md_mixed_$D/summary.json | tr -d '\n ' | cut -c1-160)"; done
-rm -rf $RUN/merged $BASE; echo "[mddpo] DONE"
diff --git a/finetune/scripts/md_dpo_round.sh b/finetune/scripts/md_dpo_round.sh
deleted file mode 100755
index 38e47570..00000000
--- a/finetune/scripts/md_dpo_round.sh
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/bin/bash
-# Multi-dialect execution-feedback DPO on md_mixed: sample K=2 (T=0.8) on 1500 train prompts per dialect -> execute with each dialect's executor -> (OK, FAIL) pairs -> DPO -> eval (sampling for cq/scad/glsl, greedy for blender & 3DCodeBench)
-set -uo pipefail; GPU=${GPUS:-2,3}; G1=$(echo $GPU | cut -d, -f1); G2=$(echo $GPU | cut -d, -f2); cd /wekafs/ict/hx_624/llm-ft; W=data/md_dpo_round; mkdir -p $W
-echo "[mddpo] $(date) start"
-source /wekafs/ict/hx_624/llm-ft/env.sh
-python - <<'PY'
-import json, random; random.seed(5)
-rows=[]
-for d in ["cadquery","openscad","glsl","blender"]:
- rs=[json.loads(l) for l in open(f"data/md_{d}/train.jsonl")]; random.shuffle(rs)
- for i,r in enumerate(rs[:1500]): rows.append({"task": f"{d}_{i:05d}", "dialect": d, "messages": r["messages"][:2]})
-random.shuffle(rows)
-for g in range(2):
- with open(f"data/md_dpo_round/prompts_g{g}.jsonl","w") as f:
- for r in rows[g::2]: f.write(json.dumps(r)+"\n")
-print("prompts", len(rows))
-PY
-BASE=runs/lf_qwen35_9b_lora_md_mixed/merged
-[ -d $BASE ] || scripts/lf_export.sh configs/lf/export_md_mixed.yaml > logs/export_md_mixed_dpo.log 2>&1 || { echo "[mddpo] EXPORT FAILED"; exit 1; }
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING
-for i in 1 2; do
- CUDA_VISIBLE_DEVICES=$G1 python eval/generate_vllm.py --model $BASE --prompts $W/prompts_g0.jsonl --out $W/gen_s${i}_g0 --tp 1 --no_think --max_new_tokens 6144 --temperature 0.8 --seed $((400+i)) > $W/gen_s${i}_g0.log 2>&1 &
- CUDA_VISIBLE_DEVICES=$G2 python eval/generate_vllm.py --model $BASE --prompts $W/prompts_g1.jsonl --out $W/gen_s${i}_g1 --tp 1 --no_think --max_new_tokens 6144 --temperature 0.8 --seed $((410+i)) > $W/gen_s${i}_g1.log 2>&1 &
- wait; grep -h gen-vllm $W/gen_s${i}_g0.log $W/gen_s${i}_g1.log
-done
-echo "[mddpo] $(date) sampling done"
-conda activate llmft
-python - <<'PY'
-# execute every generation with its dialect's executor (parallel), then build pairs
-import json, glob, os, sys, random
-from concurrent.futures import ThreadPoolExecutor
-sys.path.insert(0, "eval"); from dialect_runners import RUNNERS
-import subprocess
-BL="/wekafs/ict/hx_624/tools/blender-5.0.1-linux-x64/blender"; RUNNER=os.path.abspath("eval/blender_runner.py")
-def run_blender(code, d):
- d=os.path.abspath(d); os.makedirs(d, exist_ok=True); sp=os.path.join(d,"code.py"); open(sp,"w").write(code)
- try:
- subprocess.run([BL,"-b","--factory-startup","-noaudio","--python",RUNNER,"--","--script",sp,"--out",os.path.join(d,"out.glb"),"--report",os.path.join(d,"exec.json")],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL,timeout=120,env={**os.environ,"HOME":"/tmp"})
- r=json.load(open(os.path.join(d,"exec.json"))) if os.path.exists(os.path.join(d,"exec.json")) else {"status":"CRASH"}
- except subprocess.TimeoutExpired: r={"status":"TIMEOUT"}
- return r
-W="data/md_dpo_round"; prompts={}
-for f in glob.glob(f"{W}/prompts_g*.jsonl"):
- for l in open(f): r=json.loads(l); prompts[r["task"]]=r
-jobs=[]
-for d in sorted(glob.glob(f"{W}/gen_s*_g*/")):
- for t in os.listdir(d):
- cp=os.path.join(d,t,"code.py")
- if os.path.isfile(cp): jobs.append((d,t))
-def job(x):
- d,t=x; code=open(os.path.join(d,t,"code.py")).read(); dia=prompts[t]["dialect"]; wd=os.path.join(d,t,"exec")
- r = run_blender(code, wd) if dia=="blender" else RUNNERS[dia](code, wd)
- return (d,t,dia,r.get("status"))
-with ThreadPoolExecutor(48) as ex: res=list(ex.map(job, jobs))
-by={}
-for d,t,dia,st in res:
- code=open(os.path.join(d,t,"code.py")).read().strip()
- if code.count("\n")<3: continue
- by.setdefault(t,{"dia":dia,"ok":[],"bad":[]})["ok" if st=="OK" else "bad"].append(code)
-from collections import Counter
-print("per-dialect pass rate:", {dia: round(sum(1 for d_,t_,di,st in res if di==dia and st=="OK")/max(1,sum(1 for d_,t_,di,st in res if di==dia)),3) for dia in ["cadquery","openscad","glsl","blender"]})
-random.seed(2); pairs=[]; per=Counter()
-for t,v in by.items():
- if v["ok"] and v["bad"]:
- ok=random.choice(v["ok"]); bad=random.choice(v["bad"])
- if ok==bad: continue
- p=prompts[t]; per[v["dia"]]+=1
- pairs.append({"conversations":[{"from":"human","value":p["messages"][1]["content"]}],"system":p["messages"][0]["content"],"chosen":{"from":"gpt","value":ok if ok.startswith("```") else "```\n"+ok+"\n```"},"rejected":{"from":"gpt","value":bad if bad.startswith("```") else "```\n"+bad+"\n```"}})
-random.shuffle(pairs); json.dump(pairs, open("data/lf/dpo_md_pairs.json","w"), ensure_ascii=False)
-info=json.load(open("data/lf/dataset_info.json")); info["dpo_md_pairs"]={"file_name":"dpo_md_pairs.json","ranking":True,"formatting":"sharegpt","columns":{"messages":"conversations","system":"system","chosen":"chosen","rejected":"rejected"}}
-json.dump(info, open("data/lf/dataset_info.json","w"), indent=2); print("md pairs:", len(pairs), dict(per))
-PY
-echo "[mddpo] $(date) pairs built"
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" -e "s|dataset: dpo_exec_pairs|dataset: dpo_md_pairs|" -e "s|output_dir:.*|output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_md_mixed|" configs/lf/dpo_exec_v1.yaml > configs/lf/dpo_md_mixed.yaml
-GPUS=$GPU scripts/lf_train.sh configs/lf/dpo_md_mixed.yaml gradient_accumulation_steps=8 > logs/train_dpo_md_mixed.log 2>&1
-RUN=runs/lf_qwen35_9b_dpo_md_mixed; [ -f $RUN/train_results.json ] || { echo "[mddpo] TRAIN FAILED"; exit 1; }
-echo "[mddpo] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_dpo_md_mixed.yaml
-scripts/lf_export.sh configs/lf/export_dpo_md_mixed.yaml > logs/export_dpo_md_mixed.log 2>&1 || { echo "[mddpo] EXPORT2 FAILED"; exit 1; }
-GPUS=$G1 eval/run_eval_vllm.sh $RUN/merged eval/out/qwen35_9b_dpo_md_mixed --no_think --max_new_tokens 6144 > logs/eval_dpo_md_mixed.log 2>&1
-echo "[mddpo] 3DCodeBench: $(python3 -c "import json; s=json.load(open('eval/out/qwen35_9b_dpo_md_mixed/summary.json')); print(s['exec_ok'], round(s['[email protected]_mean_all(fail=0)'],3))")"
-GPUS=$G1 eval/run_dialect_eval.sh $RUN/merged dpo_md_mixed > logs/mdeval_dpo_md_mixed.log 2>&1
-# sampling eval for cq/scad/glsl
-conda activate vllm; export CUDA_VISIBLE_DEVICES=$G1
-for D in glsl openscad cadquery; do OUT=eval/out/md_dpo_md_mixed_T07_$D; mkdir -p $OUT; cp eval/out/md_dpo_md_mixed_$D/prompts.jsonl $OUT/; python eval/generate_vllm.py --model $RUN/merged --prompts $OUT/prompts.jsonl --out $OUT --tp 1 --no_think --max_new_tokens 8192 --temperature 0.7 --seed 1 2>&1 | grep -E "gen-vllm" | tail -1; done
-conda activate llmft
-for D in glsl openscad cadquery; do python eval/dialect_eval.py --dialect $D --test data/multidialect/$D/test.jsonl --gen_dir eval/out/md_dpo_md_mixed_T07_$D --workers 32 2>&1 | grep -E "dialect"; done
-for D in cadquery openscad glsl blender; do echo "[mddpo] greedy $D: $(cat eval/out/md_dpo_md_mixed_$D/summary.json | tr -d '\n ' | cut -c1-160)"; done
-rm -rf $RUN/merged $BASE; echo "[mddpo] DONE"
diff --git a/finetune/scripts/md_xl_ckpt_sweep.sh b/finetune/scripts/md_xl_ckpt_sweep.sh
deleted file mode 100755
index 093b5037..00000000
--- a/finetune/scripts/md_xl_ckpt_sweep.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-# After md_xl training: evaluate intermediate checkpoints (training-amount curve) on 3DCodeBench (greedy) + dialect tests (greedy blender; T=0.7 cq/scad/glsl)
-set -uo pipefail; GPU=${GPUS:-1}; cd /wekafs/ict/hx_624/llm-ft; RUN=/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_md_xl
-until grep -q "\[md md_xl\] .*train done" logs/exp_md_xl.log 2>/dev/null; do sleep 60; done
-CKS=$(ls -d $RUN/checkpoint-* 2>/dev/null | sed 's/.*checkpoint-//' | sort -n | tr '\n' ' '); echo "[bigsweep] checkpoints: $CKS"
-for STEP in $CKS; do
- CK=$RUN/checkpoint-$STEP; NAME=md_xl_ck$STEP
- sed -e "s|adapter_name_or_path:.*|adapter_name_or_path: $CK|" -e "s|export_dir:.*|export_dir: $CK/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_$NAME.yaml
- scripts/lf_export.sh configs/lf/export_$NAME.yaml > logs/export_$NAME.log 2>&1 || { echo "[bigsweep] EXPORT FAILED $STEP"; continue; }
- GPUS=$GPU eval/run_eval_vllm.sh $CK/merged eval/out/qwen35_9b_lora_$NAME --no_think --max_new_tokens 6144 > logs/eval_$NAME.log 2>&1
- echo "[bigsweep] ck$STEP 3DCodeBench: $(python3 -c "import json; s=json.load(open('eval/out/qwen35_9b_lora_$NAME/summary.json')); print(s['exec_ok'], round(s['[email protected]_mean_all(fail=0)'],3))")"
- GPUS=$GPU eval/run_dialect_eval.sh $CK/merged $NAME blender > logs/mdeval_$NAME.log 2>&1
- source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm; export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$GPU
- for D in glsl openscad cadquery; do OUT=eval/out/md_${NAME}_T07_$D; mkdir -p $OUT; cp eval/out/md_md_mixed_$D/prompts.jsonl $OUT/; python eval/generate_vllm.py --model $CK/merged --prompts $OUT/prompts.jsonl --out $OUT --tp 1 --no_think --max_new_tokens 8192 --temperature 0.7 --seed 1 2>&1 | grep -E "gen-vllm" | tail -1; done
- conda activate llmft
- for D in glsl openscad cadquery; do python eval/dialect_eval.py --dialect $D --test data/multidialect/$D/test.jsonl --gen_dir eval/out/md_${NAME}_T07_$D --workers 32 2>&1 | grep -E "dialect"; done
- echo "[bigsweep] ck$STEP blender: $(cat eval/out/md_${NAME}_blender/summary.json | tr -d '\n ' | cut -c1-140)"
- rm -rf $CK/merged
-done
-echo "[bigsweep] DONE"
diff --git a/finetune/scripts/md_xl_dpo_round.sh b/finetune/scripts/md_xl_dpo_round.sh
deleted file mode 100755
index 2314030c..00000000
--- a/finetune/scripts/md_xl_dpo_round.sh
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/bin/bash
-# Multi-dialect execution-feedback DPO on md_xl: sample K=2 (T=0.8) on 1500 train prompts per dialect -> execute with each dialect's executor -> (OK, FAIL) pairs -> DPO -> eval (sampling for cq/scad/glsl, greedy for blender & 3DCodeBench)
-set -uo pipefail; GPU=${GPUS:-2,3}; G1=$(echo $GPU | cut -d, -f1); G2=$(echo $GPU | cut -d, -f2); cd /wekafs/ict/hx_624/llm-ft; W=data/md_xl_dpo_round; mkdir -p $W
-echo "[xldpo] $(date) start"
-source /wekafs/ict/hx_624/llm-ft/env.sh
-python - <<'PY'
-import json, random; random.seed(5)
-rows=[]
-for d in ["cadquery","openscad","glsl","blender"]:
- rs=[json.loads(l) for l in open(f"data/md_{d}/train.jsonl")]; random.shuffle(rs)
- for i,r in enumerate(rs[:1500]): rows.append({"task": f"{d}_{i:05d}", "dialect": d, "messages": r["messages"][:2]})
-random.shuffle(rows)
-for g in range(2):
- with open(f"data/md_xl_dpo_round/prompts_g{g}.jsonl","w") as f:
- for r in rows[g::2]: f.write(json.dumps(r)+"\n")
-print("prompts", len(rows))
-PY
-BASE=runs/lf_qwen35_9b_lora_md_xl/merged
-[ -d $BASE ] || scripts/lf_export.sh configs/lf/export_md_xl.yaml > logs/export_md_xl_dpo.log 2>&1 || { echo "[xldpo] EXPORT FAILED"; exit 1; }
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING
-for i in 1 2; do
- CUDA_VISIBLE_DEVICES=$G1 python eval/generate_vllm.py --model $BASE --prompts $W/prompts_g0.jsonl --out $W/gen_s${i}_g0 --tp 1 --no_think --max_new_tokens 6144 --temperature 0.8 --seed $((400+i)) > $W/gen_s${i}_g0.log 2>&1 &
- CUDA_VISIBLE_DEVICES=$G2 python eval/generate_vllm.py --model $BASE --prompts $W/prompts_g1.jsonl --out $W/gen_s${i}_g1 --tp 1 --no_think --max_new_tokens 6144 --temperature 0.8 --seed $((410+i)) > $W/gen_s${i}_g1.log 2>&1 &
- wait; grep -h gen-vllm $W/gen_s${i}_g0.log $W/gen_s${i}_g1.log
-done
-echo "[xldpo] $(date) sampling done"
-conda activate llmft
-python - <<'PY'
-# execute every generation with its dialect's executor (parallel), then build pairs
-import json, glob, os, sys, random
-from concurrent.futures import ThreadPoolExecutor
-sys.path.insert(0, "eval"); from dialect_runners import RUNNERS
-import subprocess
-BL="/wekafs/ict/hx_624/tools/blender-5.0.1-linux-x64/blender"; RUNNER=os.path.abspath("eval/blender_runner.py")
-def run_blender(code, d):
- d=os.path.abspath(d); os.makedirs(d, exist_ok=True); sp=os.path.join(d,"code.py"); open(sp,"w").write(code)
- try:
- subprocess.run([BL,"-b","--factory-startup","-noaudio","--python",RUNNER,"--","--script",sp,"--out",os.path.join(d,"out.glb"),"--report",os.path.join(d,"exec.json")],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL,timeout=120,env={**os.environ,"HOME":"/tmp"})
- r=json.load(open(os.path.join(d,"exec.json"))) if os.path.exists(os.path.join(d,"exec.json")) else {"status":"CRASH"}
- except subprocess.TimeoutExpired: r={"status":"TIMEOUT"}
- return r
-W="data/md_xl_dpo_round"; prompts={}
-for f in glob.glob(f"{W}/prompts_g*.jsonl"):
- for l in open(f): r=json.loads(l); prompts[r["task"]]=r
-jobs=[]
-for d in sorted(glob.glob(f"{W}/gen_s*_g*/")):
- for t in os.listdir(d):
- cp=os.path.join(d,t,"code.py")
- if os.path.isfile(cp): jobs.append((d,t))
-def job(x):
- d,t=x; code=open(os.path.join(d,t,"code.py")).read(); dia=prompts[t]["dialect"]; wd=os.path.join(d,t,"exec")
- r = run_blender(code, wd) if dia=="blender" else RUNNERS[dia](code, wd)
- return (d,t,dia,r.get("status"))
-with ThreadPoolExecutor(48) as ex: res=list(ex.map(job, jobs))
-by={}
-for d,t,dia,st in res:
- code=open(os.path.join(d,t,"code.py")).read().strip()
- if code.count("\n")<3: continue
- by.setdefault(t,{"dia":dia,"ok":[],"bad":[]})["ok" if st=="OK" else "bad"].append(code)
-from collections import Counter
-print("per-dialect pass rate:", {dia: round(sum(1 for d_,t_,di,st in res if di==dia and st=="OK")/max(1,sum(1 for d_,t_,di,st in res if di==dia)),3) for dia in ["cadquery","openscad","glsl","blender"]})
-random.seed(2); pairs=[]; per=Counter()
-for t,v in by.items():
- if v["ok"] and v["bad"]:
- ok=random.choice(v["ok"]); bad=random.choice(v["bad"])
- if ok==bad: continue
- p=prompts[t]; per[v["dia"]]+=1
- pairs.append({"conversations":[{"from":"human","value":p["messages"][1]["content"]}],"system":p["messages"][0]["content"],"chosen":{"from":"gpt","value":ok if ok.startswith("```") else "```\n"+ok+"\n```"},"rejected":{"from":"gpt","value":bad if bad.startswith("```") else "```\n"+bad+"\n```"}})
-random.shuffle(pairs); json.dump(pairs, open("data/lf/dpo_md_xl_pairs.json","w"), ensure_ascii=False)
-info=json.load(open("data/lf/dataset_info.json")); info["dpo_md_xl_pairs"]={"file_name":"dpo_md_xl_pairs.json","ranking":True,"formatting":"sharegpt","columns":{"messages":"conversations","system":"system","chosen":"chosen","rejected":"rejected"}}
-json.dump(info, open("data/lf/dataset_info.json","w"), indent=2); print("md pairs:", len(pairs), dict(per))
-PY
-echo "[xldpo] $(date) pairs built"
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" -e "s|dataset: dpo_exec_pairs|dataset: dpo_md_xl_pairs|" -e "s|output_dir:.*|output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_dpo_md_xl|" configs/lf/dpo_exec_v1.yaml > configs/lf/dpo_md_xl.yaml
-GPUS=$GPU scripts/lf_train.sh configs/lf/dpo_md_xl.yaml gradient_accumulation_steps=8 cutoff_len=4096 > logs/train_dpo_md_xl.log 2>&1
-RUN=runs/lf_qwen35_9b_dpo_md_xl; [ -f $RUN/train_results.json ] || { echo "[xldpo] TRAIN FAILED"; exit 1; }
-echo "[xldpo] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_dpo_md_xl.yaml
-scripts/lf_export.sh configs/lf/export_dpo_md_xl.yaml > logs/export_dpo_md_xl.log 2>&1 || { echo "[xldpo] EXPORT2 FAILED"; exit 1; }
-GPUS=$G1 eval/run_eval_vllm.sh $RUN/merged eval/out/qwen35_9b_dpo_md_xl --no_think --max_new_tokens 6144 > logs/eval_dpo_md_xl.log 2>&1
-echo "[xldpo] 3DCodeBench: $(python3 -c "import json; s=json.load(open('eval/out/qwen35_9b_dpo_md_xl/summary.json')); print(s['exec_ok'], round(s['[email protected]_mean_all(fail=0)'],3))")"
-GPUS=$G1 eval/run_dialect_eval.sh $RUN/merged dpo_md_xl > logs/mdeval_dpo_md_xl.log 2>&1
-# sampling eval for cq/scad/glsl
-conda activate vllm; export CUDA_VISIBLE_DEVICES=$G1
-for D in glsl openscad cadquery; do OUT=eval/out/md_dpo_md_xl_T07_$D; mkdir -p $OUT; cp eval/out/md_dpo_md_xl_$D/prompts.jsonl $OUT/; python eval/generate_vllm.py --model $RUN/merged --prompts $OUT/prompts.jsonl --out $OUT --tp 1 --no_think --max_new_tokens 8192 --temperature 0.7 --seed 1 2>&1 | grep -E "gen-vllm" | tail -1; done
-conda activate llmft
-for D in glsl openscad cadquery; do python eval/dialect_eval.py --dialect $D --test data/multidialect/$D/test.jsonl --gen_dir eval/out/md_dpo_md_xl_T07_$D --workers 32 2>&1 | grep -E "dialect"; done
-for D in cadquery openscad glsl blender; do echo "[xldpo] greedy $D: $(cat eval/out/md_dpo_md_xl_$D/summary.json | tr -d '\n ' | cut -c1-160)"; done
-rm -rf $RUN/merged $BASE; echo "[xldpo] DONE"
diff --git a/finetune/scripts/md_xl_extra_eval.sh b/finetune/scripts/md_xl_extra_eval.sh
deleted file mode 100755
index a4f71b76..00000000
--- a/finetune/scripts/md_xl_extra_eval.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# GPU 0 while DPO (GPUs 2,3) and sweep (GPU 1) run: three.js eval (greedy + T=0.7) and 3DCodeBench best-of-4 for md_xl (uses the merged model re-exported by the DPO round)
-cd /wekafs/ict/hx_624/llm-ft; M=runs/lf_qwen35_9b_lora_md_xl/merged
-until [ -f data/md_xl_dpo_round/gen_s1_g0.log ] && [ -f $M/config.json ]; do sleep 30; done; sleep 60
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=0 PLAYWRIGHT_BROWSERS_PATH=/wekafs/ict/hx_624/cache/ms-playwright
-echo "[xlextra] $(date) three.js gens"
-mkdir -p eval/out/md_md_xl_threejs eval/out/md_md_xl_T07_threejs
-python eval/generate_vllm.py --model $M --prompts eval/out/_3js_prompts.jsonl --out eval/out/md_md_xl_threejs --tp 1 --no_think --max_new_tokens 12288 2>&1 | grep -E "gen-vllm|Error" | tail -1
-python eval/generate_vllm.py --model $M --prompts eval/out/_3js_prompts.jsonl --out eval/out/md_md_xl_T07_threejs --tp 1 --no_think --max_new_tokens 12288 --temperature 0.7 --seed 1 2>&1 | grep -E "gen-vllm|Error" | tail -1
-echo "[xlextra] $(date) best-of-4"
-GPUS=0 eval/best_of_n.sh $M md_xl_T07 4 0.7 2>&1 | grep -E "pass@|OK rate|BEST"
-conda activate llmft
-for N in md_md_xl_threejs md_md_xl_T07_threejs; do echo "== $N"; python eval/threejs_eval.py --gen_dir eval/out/$N 2>&1 | tail -2; done
-echo "[xlextra] DONE"
diff --git a/finetune/scripts/md_xl_launch.sh b/finetune/scripts/md_xl_launch.sh
deleted file mode 100755
index 2ea3bb05..00000000
--- a/finetune/scripts/md_xl_launch.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-cd /wekafs/ict/hx_624/llm-ft; source env.sh
-echo "[md_xl] $(date) build data"
-python scripts/build_md_xl.py 2>&1 | grep -v Warning | tail -1 | tee logs/build_md_xl.stats
-python scripts/to_llamafactory.py --data_dir /wekafs/ict/hx_624/llm-ft/data/md_xl --name md_xl 2>&1 | tail -3 | cut -c1-200
-# ~10 checkpoints over the run: steps = tokens / (4 GPUs x 2 accum x 8192)
-python3 - <<'PY'
-import re, yaml
-s=open("logs/build_md_xl.stats").read(); tok=float(re.search(r"tokens/epoch ([0-9.]+)M", s).group(1))*1e6
-steps=tok/(8*8192); save=max(50, int(round(steps/10/50))*50)
-p="configs/lf/lora_md_xl.yaml"; c=yaml.safe_load(open(p)); c["save_steps"]=save; c["eval_steps"]=save; c["save_total_limit"]=14
-yaml.safe_dump(c, open(p,"w"), sort_keys=False); print(f"[md_xl] est. steps {steps:.0f}, save/eval every {save} steps")
-PY
-echo "BUILD_MD_XL_DONE"
-G=0,1,2,3; echo "[md_xl] using GPUs $G"
-scripts/run_md_exp.sh $G md_xl 2>&1 | tee -a logs/exp_md_xl.log
-grep -q "\[md md_xl\] DONE" logs/exp_md_xl.log || { echo "[md_xl] pipeline failed, not sweeping"; exit 1; }
-echo "[md_xl] $(date) starting checkpoint sweep on GPU 1"
-GPUS=1 scripts/md_xl_ckpt_sweep.sh > logs/md_xl_ckpt_sweep.log 2>&1
-echo "[md_xl] ALL DONE"
diff --git a/finetune/scripts/node_smoke.sh b/finetune/scripts/node_smoke.sh
deleted file mode 100755
index ad7ec2ce..00000000
--- a/finetune/scripts/node_smoke.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-# smoke a config on whatever node/GPUs we are given: scripts/node_smoke.sh <config.yaml> <tag> [steps]
-cd /wekafs/ict/hx_624/llm-ft || exit 1
-CFG=$1; TAG=$2; N=${3:-4}
-GPUS=${GPUS:-0,1,2,3} scripts/lf_train.sh $CFG max_steps=$N save_steps=100000 eval_steps=100000 \
- output_dir=/wekafs/ict/hx_624/llm-ft/runs/_smoke_$TAG > logs/smoke_$TAG.log 2>&1
-grep -oE "'train_runtime': [0-9.]+|out of memory|[0-9]/$N \[[0-9:]+<[0-9:]+, *[0-9.]+s/it" logs/smoke_$TAG.log | tail -2
-rm -rf runs/_smoke_$TAG
diff --git a/finetune/scripts/ntok_cache.py b/finetune/scripts/ntok_cache.py
deleted file mode 100644
index 7884a458..00000000
--- a/finetune/scripts/ntok_cache.py
+++ /dev/null
@@ -1,12 +0,0 @@
-"""Helper for build scripts: load cached token counts for a jsonl (scripts/cache_ntok.py), falling back to tokenizing."""
-import os
-def load_ntok(path, tok=None):
- c = path + ".ntok"
- if os.path.exists(c):
- ns = [int(x) for x in open(c).read().split()]
- if ns and sum(1 for _ in open(path)) == len(ns): return ns
- if tok is None:
- from transformers import AutoTokenizer; tok = AutoTokenizer.from_pretrained("/wekafs/ict/hx_624/models/Qwen3.5-9B")
- import json
- ns = [len(tok(tok.apply_chat_template(json.loads(l)["messages"], tokenize=False)).input_ids) for l in open(path)]
- open(c, "w").write("\n".join(map(str, ns)) + "\n"); return ns
diff --git a/finetune/scripts/prep_data.py b/finetune/scripts/prep_data.py
deleted file mode 100644
index 87141c34..00000000
--- a/finetune/scripts/prep_data.py
+++ /dev/null
@@ -1,184 +0,0 @@
-"""Build SFT data (chat 'messages' jsonl) for text -> Blender-Python from the 3DCodeVerse-family sources.
-
-Sources (all Blender Python):
- * bioinspired3d geo/tex metadata.parquet (ilabai/3dcodeverse) ~6.3k, short scripts
- * 3dcodebench factories geo/tex parquet (ilabai/3dcodeverse) 243*2, Infinigen style, LONG scripts
- -> by default ONLY the 31 factories that are NOT in the 3DCodeBench test set (avoid contamination)
- * blender_distill (Claude-generated) (ilabai/3dcodeverse) ~60-100
- * thingiverse-openscad-blender-5-0 (ilabai/...) ~1.2k, keep native-CSG only (no mesh fallback)
-Outputs: <out>/train.jsonl, <out>/val.jsonl, <out>/stats.json, <out>/bench_prompts.jsonl
-"""
-import argparse, glob, hashlib, json, os, random, re
-import pandas as pd
-
-SYSTEM = ("You are an expert in procedural 3D modeling with Blender Python (bpy). "
- "Given a description of an object, write a complete, standalone Blender 5 Python script that builds it "
- "from scratch (clear the default scene first, create geometry with bpy/bmesh, assign simple materials when "
- "relevant, leave the finished mesh objects in the scene). Output ONLY the code in one ```python block.")
-
-def ans(code):
- return "```python\n" + code.strip("\n") + "\n```"
-
-def wrap_desc(desc):
- starters = ["Write a Blender Python script that builds the following object: ",
- "Create this 3D object with Blender Python (bpy): ",
- "Using Python Blender code, procedurally model: ",
- "Generate a Blender Python (bpy) script for a 3D model matching this description: "]
- return random.choice(starters) + desc.strip()
-
-PROMPT_W = {"instruction": 6, "detailed": 3, "name": 1}
-def pick_prompt(name, caps):
- """caps: dict with keys detailed / instruction / factory (some may be missing)."""
- ins = (caps or {}).get("instruction") or ""
- det = (caps or {}).get("detailed") or ""
- opts = []
- if ins and len(ins) > 20: opts += [("instruction", ins)] * PROMPT_W.get("instruction", 0)
- if det and len(det) > 20: opts += [("detailed", wrap_desc(det))] * PROMPT_W.get("detailed", 0)
- if name and len(name) > 15 and not name.lower().startswith("deepcad"): opts += [("name", name)] * PROMPT_W.get("name", 0)
- if not opts: return None, None
- return random.choice(opts)
-
-def code_ok(code, min_lines=4):
- if not code or code.count("\n") < min_lines: return False
- if "import bpy" not in code and "bpy." not in code and "import cadquery" not in code: return False
- if "reference_mesh.json" in code or "MESH_REFERENCE_ASSET" in code: return False # mesh fallback
- return True
-
-def main():
- ap = argparse.ArgumentParser()
- ap.add_argument("--root", default="/wekafs/ict/hx_624/data")
- ap.add_argument("--out", default="/wekafs/ict/hx_624/llm-ft/data/sft_v1")
- ap.add_argument("--val_frac", type=float, default=0.02)
- ap.add_argument("--seed", type=int, default=42)
- ap.add_argument("--include_test_factories", action="store_true", help="(contaminated) also include the 212 factories that overlap the benchmark")
- ap.add_argument("--max_chars", type=int, default=60000, help="drop samples whose code is longer than this (~15k tokens)")
- ap.add_argument("--tokenizer", default="/wekafs/ict/hx_624/models/Qwen2.5-Coder-7B-Instruct")
- ap.add_argument("--max_tokens", type=int, default=8192, help="drop samples whose full chat exceeds this many tokens")
- ap.add_argument("--sources", default="bio3d,fac,distill,thingi50", help="comma list of sources to include: bio3d,fac,distill,thingi50,deepcad")
- ap.add_argument("--prompt_fields", default="instruction:6,detailed:3,name:1", help="weighted prompt field choice, e.g. 'instruction:1' for instruction-only")
- ap.add_argument("--deepcad_n", type=int, default=20000, help="number of deepcad CadQuery samples when 'deepcad' in --sources")
- args = ap.parse_args()
- random.seed(args.seed)
- os.makedirs(args.out, exist_ok=True)
- SRC = set(args.sources.split(","))
- PROMPT_W.clear(); PROMPT_W.update({k: int(v) for k, v in (x.split(":") for x in args.prompt_fields.split(","))})
- R = args.root
- samples = [] # dict(source, id, prompt_kind, messages)
-
- # ---- test-set names (for contamination control)
- bench_dir = f"{R}/3dcodebench/data"
- test_names = {d.replace("_seed0", "") for d in os.listdir(bench_dir)}
-
- # ---- bioinspired3d
- for sub in (["bpy_structures_geo", "bpy_structures_tex"] if "bio3d" in SRC else []):
- df = pd.read_parquet(f"{R}/3dcodeverse/bioinspired3d_{sub}_metadata.parquet")
- for r in df.itertuples():
- if not code_ok(r.code): continue
- kind, p = pick_prompt(r.name, dict(r.captions))
- if not p: continue
- samples.append(dict(source=f"bio3d_{sub[-3:]}", id=r.id, prompt_kind=kind, code=r.code, prompt=p))
-
- # ---- 3dcodebench factories (Infinigen style)
- for sub in (["factories_geo", "factories_tex"] if "fac" in SRC else []):
- df = pd.read_parquet(f"{R}/3dcodeverse/3dcodebench_{sub}_metadata.parquet")
- for r in df.itertuples():
- fac = r.name.replace("Factory", "")
- if fac in test_names and not args.include_test_factories: continue
- if not code_ok(r.code): continue
- kind, p = pick_prompt(None, dict(r.captions))
- if not p: continue
- samples.append(dict(source=f"fac_{sub[-3:]}" + ("_TEST" if fac in test_names else ""), id=r.id, prompt_kind=kind, code=r.code, prompt=p))
-
- # ---- blender_distill
- for cp in (glob.glob(f"{R}/3dcodeverse/blender_distill/**/code.py", recursive=True) if "distill" in SRC else []):
- d = os.path.dirname(cp); code = open(cp).read()
- if not code_ok(code): continue
- caps = json.load(open(os.path.join(d, "captions.json"))) if os.path.exists(os.path.join(d, "captions.json")) else {}
- p = caps.get("user_instruction") or (caps.get("instruction") and wrap_desc(caps["instruction"]))
- if not p: continue
- # distill scripts define build() but may not call it -> make sure the script executes standalone
- if re.search(r"^def build\(\):", code, re.M) and not re.search(r"^\s*build\(\)\s*$", code, re.M) and "__main__" not in code:
- code = code.rstrip("\n") + "\n\n\nif __name__ == \"__main__\":\n build()\n"
- samples.append(dict(source="distill", id=os.path.relpath(d, R), prompt_kind="user_instruction", code=code, prompt=p))
-
- # ---- deepcad (CadQuery) -- cross-dialect data; the code is NOT Blender, system prompt is adapted
- if "deepcad" in SRC:
- dfs = [pd.read_parquet(f) for f in sorted(glob.glob(f"{R}/3dcodeverse_meta/deepcad/*/metadata.parquet"))]
- dd = pd.concat(dfs, ignore_index=True).sample(n=min(args.deepcad_n, sum(len(d) for d in dfs)), random_state=args.seed)
- for r in dd.itertuples():
- code = r.code or ""
- if "import cadquery" not in code or code.count("\n") < 3: continue
- caps = dict(r.captions); ins = caps.get("instruction") or caps.get("detailed") or ""
- if len(ins) < 20: continue
- p = "Write a CadQuery (Python) script that builds the following CAD model: " + ins.strip()
- samples.append(dict(source="deepcad", id=r.id, prompt_kind="instruction", code=code, prompt=p, dialect="cadquery"))
- # ---- thingiverse-openscad-blender-5-0 (native CSG only)
- for cp in (glob.glob(f"{R}/thingiverse_5_0/*/code.py") if "thingi50" in SRC else []):
- d = os.path.dirname(cp); code = open(cp).read()
- rep_p = os.path.join(d, "reports", "translation_report.json")
- status = json.load(open(rep_p)).get("status", "") if os.path.exists(rep_p) else ""
- if "mesh_fallback" in status or not code_ok(code): continue
- caps = json.load(open(os.path.join(d, "captions.json"))) if os.path.exists(os.path.join(d, "captions.json")) else {}
- desc = caps.get("synthetic_prompt") or caps.get("detailed") or ""
- if len(desc) < 40: continue
- p = ("The following request was originally written for OpenSCAD. Implement the same design in Blender Python (bpy) "
- "instead, as a standalone script that builds the geometry with native Blender primitives/booleans.\n\n" + desc.strip())
- samples.append(dict(source="thingi50", id=os.path.basename(d), prompt_kind="synthetic_prompt", code=code, prompt=p))
-
- # ---- dedup by code hash, length filter
- seen, uniq = set(), []
- for s in samples:
- h = hashlib.sha1(s["code"].strip().encode()).hexdigest()
- if h in seen or len(s["code"]) > args.max_chars: continue
- seen.add(h); uniq.append(s)
- # ---- token length filter (drop too-long samples instead of truncating the completion)
- tok = None
- try:
- from transformers import AutoTokenizer
- tok = AutoTokenizer.from_pretrained(args.tokenizer)
- except Exception as e:
- print("tokenizer unavailable:", e)
- if tok is not None:
- before = len(uniq)
- def ntok(s):
- msgs = [{"role": "system", "content": SYSTEM}, {"role": "user", "content": s["prompt"]}, {"role": "assistant", "content": ans(s["code"])}]
- return len(tok(tok.apply_chat_template(msgs, tokenize=False)).input_ids)
- uniq = [s for s in uniq if ntok(s) <= args.max_tokens]
- print(f"dropped {before - len(uniq)} samples longer than {args.max_tokens} tokens")
- random.shuffle(uniq)
- n_val = max(1, int(len(uniq) * args.val_frac))
- val, train = uniq[:n_val], uniq[n_val:]
-
- SYSTEM_CQ = ("You are an expert CAD programmer. Given a description of a part, write a complete, standalone CadQuery (Python) "
- "script that builds it. Output ONLY the code in one ```python block.")
- def to_msgs(s):
- return {"messages": [{"role": "system", "content": SYSTEM_CQ if s.get("dialect") == "cadquery" else SYSTEM},
- {"role": "user", "content": s["prompt"]},
- {"role": "assistant", "content": ans(s["code"])}],
- "source": s["source"], "id": s["id"], "prompt_kind": s["prompt_kind"]}
-
- stats = {"n_train": len(train), "n_val": len(val), "by_source": {}, "token_len": {}}
- for split, rows in [("train", train), ("val", val)]:
- lens = []
- with open(f"{args.out}/{split}.jsonl", "w") as f:
- for s in rows:
- m = to_msgs(s)
- f.write(json.dumps(m, ensure_ascii=False) + "\n")
- stats["by_source"].setdefault(split, {}); stats["by_source"][split][s["source"]] = stats["by_source"][split].get(s["source"], 0) + 1
- if tok is not None:
- lens.append(len(tok(tok.apply_chat_template(m["messages"], tokenize=False)).input_ids))
- if lens:
- import numpy as np
- lens = np.array(lens)
- stats["token_len"][split] = {"p50": int(np.percentile(lens, 50)), "p90": int(np.percentile(lens, 90)), "p99": int(np.percentile(lens, 99)), "max": int(lens.max()), "total": int(lens.sum()), "n_gt_8192": int((lens > 8192).sum()), "n_gt_16384": int((lens > 16384).sum())}
-
- # ---- benchmark prompts
- with open(f"{args.out}/bench_prompts.jsonl", "w") as f:
- for d in sorted(os.listdir(bench_dir)):
- p = open(f"{bench_dir}/{d}/prompt_instruction.txt").read().strip()
- f.write(json.dumps({"task": d, "messages": [{"role": "system", "content": SYSTEM}, {"role": "user", "content": p}]}) + "\n")
- json.dump(stats, open(f"{args.out}/stats.json", "w"), indent=2)
- print(json.dumps(stats, indent=2))
-
-if __name__ == "__main__":
- main()
diff --git a/finetune/scripts/qc_repair.py b/finetune/scripts/qc_repair.py
deleted file mode 100644
index 22fe2afd..00000000
--- a/finetune/scripts/qc_repair.py
+++ /dev/null
@@ -1,434 +0,0 @@
-"""Validate every converted sample with a real compiler/parser and repair what can be repaired minimally.
-
-Three passes, each writing a report and (where it helps) a repaired copy of the subdir dataset:
-
- glsl compile every unique shader with glslangValidator (the same wrapper the evaluator uses).
- Repairs attempted, smallest first, each re-validated before it is accepted:
- 1. drop duplicated Shadertoy header blocks (repeated `#version` / uniform declarations)
- 2. balance braces/parens at EOF (append the missing closers)
- 3. drop a trailing incomplete statement (last line without `;`/`}`)
- 4. wrap a bare body in `void mainImage(out vec4 fragColor, in vec2 fragCoord){ ... }`
- python ast.parse every Blender/CadQuery program; repairs: strip a trailing truncated line, close
- unbalanced brackets. (No cosmetic rewrites — a program either parses or it does not.)
- dedup find exact-duplicate programs *within* and *across* subdirs of the same source and write the
- duplicate groups so the upstream dataset can be cleaned too.
-
-usage: python scripts/qc_repair.py --root /wekafs/ict/hx_624/hf_subdirs [--pass glsl|python|dedup|all] [--workers 32]
-"""
-import argparse
-import ast
-import collections
-import glob
-import hashlib
-import itertools
-import json
-import os
-import re
-import subprocess
-import sys
-import tempfile
-from concurrent.futures import ProcessPoolExecutor
-
-import pandas as pd
-
-GLSLANG = "/wekafs/ict/hx_624/anaconda3/envs/llmft/bin/glslangValidator"
-PRELUDE = """#version 310 es
-precision highp float; precision highp int;
-uniform vec3 iResolution; uniform float iTime; uniform float iTimeDelta; uniform int iFrame;
-uniform vec4 iMouse; uniform vec4 iDate; uniform float iSampleRate;
-uniform float iChannelTime[4]; uniform vec3 iChannelResolution[4];
-uniform sampler2D iChannel0; uniform sampler2D iChannel1; uniform sampler2D iChannel2; uniform sampler2D iChannel3;
-out vec4 _fragColor;
-"""
-
-
-def code_of(msg):
- m = re.findall(r"```[a-zA-Z]*\n(.*?)```", msg, flags=re.S)
- return (max(m, key=len) if m else msg).strip()
-
-
-def _prelude(version, cube_channels=()):
- ch = "".join(f"uniform {'samplerCube' if i in cube_channels else 'sampler2D'} iChannel{i};\n" for i in range(4))
- return (f"#version {version}\nprecision highp float; precision highp int;\n"
- "uniform vec3 iResolution; uniform float iTime; uniform float iTimeDelta; uniform int iFrame;\n"
- "uniform vec4 iMouse; uniform vec4 iDate; uniform float iSampleRate; uniform float iFrameRate;\n"
- "uniform float iChannelTime[4]; uniform vec3 iChannelResolution[4];\n" + ch + "out vec4 _fragColor;\n")
-
-
-CUBE_USE = re.compile(r"texture(?:Lod)?\s*\(\s*iChannel([0-3])\s*,\s*(?:vec3|normalize|reflect|refract|[a-zA-Z_]\w*\s*\.\s*xyz)")
-EPILOGUE = "\nvoid main(){ mainImage(_fragColor, gl_FragCoord.xy); }\n"
-STRIP = re.compile(r"^[ \t]*(?:#version[^\n]*|precision\s+\w+\s+\w+\s*;|uniform\s+(?:vec[234]|float|int|sampler2D|samplerCube)\s+\w+(?:\[\d+\])?\s*;|out\s+vec4\s+\w+\s*;)[ \t]*$", re.M) # whole line only: a glued/minified line carries real code
-
-
-def _try_compile(src):
- with tempfile.NamedTemporaryFile("w", suffix=".frag", delete=False) as f:
- f.write(src); p = f.name
- try:
- r = subprocess.run([GLSLANG, "-S", "frag", p], stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
- timeout=25, text=True, errors="replace")
- out = r.stdout or ""
- return r.returncode == 0, next((l for l in out.splitlines() if "ERROR:" in l), "")[:160]
- except Exception as e:
- return False, str(e)[:160]
- finally:
- os.unlink(p)
-
-
-USED_CH = re.compile(r"iChannel([0-3])")
-
-
-def glsl_compile(body):
- """Shadertoy targets WebGL2 (GLSL ES 3.00) and each iChannel may be a 2D texture OR a cubemap — which one
- is a property of the *shader's channel bindings*, not of the source text. Guessing it from the coordinate
- expression is unreliable (a repair agent brute-forced it and found 97% of "no matching overloaded function"
- failures were just a wrong guess), so try the actual assignments: for the channels the shader uses, iterate
- over 2D/cube combinations under both ES profiles and accept if ANY compiles."""
- stripped = STRIP.sub("", body)
- used = sorted({int(m.group(1)) for m in USED_CH.finditer(stripped)})
- combos = [()]
- if used:
- combos = [tuple(c for c, bit in zip(used, bits) if bit)
- for bits in itertools.product((0, 1), repeat=len(used))]
- combos.sort(key=len) # all-2D first, then progressively more cubemaps
- last = ""
- for ver in ("300 es", "310 es"):
- for cc in combos:
- ok, err = _try_compile(_prelude(ver, cc) + stripped + EPILOGUE)
- if ok:
- return True, ""
- last = last or err
- return False, last
-
-
-def dedup_headers(body):
- """shadertoy forks often repeat the whole header; keep the first occurrence of each duplicated line block"""
- lines = body.splitlines()
- seen, out, removed = set(), [], 0
- for ln in lines:
- s = ln.strip()
- if s.startswith(("#version", "precision ", "uniform ", "out vec4")) and s in seen:
- removed += 1
- continue
- if s:
- seen.add(s)
- out.append(ln)
- return ("\n".join(out), removed) if removed else (body, 0)
-
-
-def balance(body):
- add = ""
- for o, c in (("{", "}"), ("(", ")")):
- d = body.count(o) - body.count(c)
- if d > 0:
- add += c * d
- return (body + "\n" + add if add else body), len(add)
-
-
-def drop_tail(body):
- lines = body.rstrip().splitlines()
- while lines and not lines[-1].strip().endswith((";", "}", "{")):
- lines.pop()
- return "\n".join(lines), 1
-
-
-def wrap_main(body):
- if "mainImage" in body or "void main" in body:
- return body, 0
- return "void mainImage(out vec4 fragColor, in vec2 fragCoord){\n" + body + "\n}", 1
-
-
-def repair_glsl(body):
- """try repairs smallest-first; return (fixed_body, recipe) or (None, reason)"""
- ok, err = glsl_compile(body)
- if ok:
- return body, "already_ok"
- steps = []
- cur = body
- for name, fn in (("dedup_headers", dedup_headers), ("balance", balance), ("drop_tail", drop_tail), ("wrap_main", wrap_main)):
- new, n = fn(cur)
- if n == 0 or new == cur:
- continue
- cur = new
- steps.append(name)
- ok, err = glsl_compile(cur)
- if ok:
- return cur, "+".join(steps)
- return None, err or "unfixable"
-
-
-def _glsl_job(args):
- key, body = args
- fixed, recipe = repair_glsl(body)
- return key, (fixed is not None), recipe, (fixed if fixed and recipe != "already_ok" else None)
-
-
-def shadertoy_provenance():
- """id -> flags the dataset itself records: a shader that needs a Common tab, extra buffers or external
- textures CANNOT compile standalone — that is a property of the sample, not a defect to repair."""
- prov = {}
- for p in glob.glob("/wekafs/ict/hx_624/data/3dcodeverse_meta/shadertoy/*/metadata.parquet"):
- df = pd.read_parquet(p, columns=["id", "meta_json"])
- for r in df.itertuples():
- try:
- m = json.loads(r.meta_json) if isinstance(r.meta_json, str) else (r.meta_json or {})
- except Exception:
- m = {}
- prov[str(r.id)] = {"num_passes": m.get("num_passes") or 1,
- "has_common_pass": bool(m.get("has_common_pass")),
- "external_assets": bool(m.get("external_assets")),
- "multi_file": bool(m.get("multi_file"))}
- return prov
-
-
-def classify(err, flags):
- if flags.get("has_common_pass"):
- return "expected_needs_common_pass"
- if (flags.get("num_passes") or 1) > 1:
- return "expected_multi_pass"
- if flags.get("external_assets"):
- return "expected_external_assets"
- e = err or ""
- if "syntax error" in e or "unexpected" in e:
- return "syntax_error"
- if "undeclared identifier" in e or "no matching overloaded function" in e:
- return "missing_symbol"
- return "other"
-
-
-def pass_glsl(root, workers, limit=None):
- prov = shadertoy_provenance()
- print(f"[qc] provenance flags for {len(prov)} shadertoy samples", flush=True)
- dirs = sorted(glob.glob(f"{root}/shadertoy/*_llamafactory"))
- uniq, where, hid = {}, collections.defaultdict(list), {}
- for d in dirs:
- p = os.path.join(d, "train.parquet")
- if not os.path.exists(p):
- continue
- df = pd.read_parquet(p)
- for i, row in enumerate(df.itertuples()):
- body = code_of(row.conversations[1]["value"])
- h = hashlib.md5(body.encode()).hexdigest()
- uniq.setdefault(h, body)
- hid.setdefault(h, row.id)
- where[h].append((d, i))
- items = list(uniq.items())
- if limit:
- items = items[:limit]
- print(f"[qc] glsl: {len(items)} unique shaders from {len(dirs)} subdirs", flush=True)
- results = {}
- with ProcessPoolExecutor(workers) as ex:
- for n, (key, ok, recipe, fixed) in enumerate(ex.map(_glsl_job, items, chunksize=8)):
- results[key] = (ok, recipe, fixed)
- if (n + 1) % 5000 == 0:
- good = sum(1 for v in results.values() if v[0])
- print(f"[qc] glsl {n+1}/{len(items)} compile-ok {good} ({100*good/(n+1):.1f}%)", flush=True)
- stats = collections.Counter(v[1] for v in results.values())
- cls = collections.Counter()
- for h, (ok, recipe, _f) in results.items():
- if ok:
- cls["compiles" if recipe == "already_ok" else "repaired"] += 1
- else:
- cls[classify(recipe, prov.get(hid.get(h, ""), {}))] += 1
- fixed_map = {k: v[2] for k, v in results.items() if v[2]}
- # write repaired parquets
- per_dir = collections.Counter()
- for h, locs in where.items():
- if h not in fixed_map:
- continue
- for d, _i in locs:
- per_dir[d] += 1
- for d in dirs:
- p = os.path.join(d, "train.parquet")
- if not os.path.exists(p) or per_dir[d] == 0:
- continue
- df = pd.read_parquet(p)
- conv = df["conversations"].tolist()
- nfix = 0
- for i, c in enumerate(conv):
- body = code_of(c[1]["value"])
- h = hashlib.md5(body.encode()).hexdigest()
- if h in fixed_map:
- c[1]["value"] = "```glsl\n" + fixed_map[h].strip() + "\n```"
- nfix += 1
- df["conversations"] = conv
- df.to_parquet(p, index=False, compression="zstd")
- q = os.path.join(d, "qc.json")
- if os.path.exists(q):
- j = json.load(open(q))
- j["glsl_repaired_rows"] = nfix
- json.dump(j, open(q, "w"), indent=2)
- json.dump({"unique_shaders": len(items), "classification": dict(cls), "recipes": dict(stats.most_common(20)),
- "compiled_before": stats.get("already_ok", 0),
- "repaired": sum(v for k, v in stats.items() if k not in ("already_ok",) and not k.startswith("ERROR") and k != "unfixable"),
- "unfixable": sum(v for k, v in stats.items() if k == "unfixable" or k.startswith("ERROR"))},
- open(f"{root}/glsl_validation_report.json", "w"), indent=2)
- print("[qc] glsl classification:", dict(cls), flush=True)
-
-
-def pass_python(root):
- out = []
- for d in sorted(glob.glob(f"{root}/**/*_llamafactory", recursive=True)):
- q = json.load(open(os.path.join(d, "qc.json"))) if os.path.exists(os.path.join(d, "qc.json")) else {}
- if q.get("dialect") not in ("blender", "cadquery"):
- continue
- p = os.path.join(d, "train.parquet")
- df = pd.read_parquet(p)
- bad = 0
- for row in df.itertuples():
- try:
- ast.parse(code_of(row.conversations[1]["value"]))
- except Exception:
- bad += 1
- out.append({"subdir": os.path.relpath(d, root), "rows": len(df), "ast_fail": bad})
- print(f"[qc] python {os.path.relpath(d, root):45s} rows={len(df):7,} ast_fail={bad}", flush=True)
- json.dump(out, open(f"{root}/python_validation_report.json", "w"), indent=2)
-
-
-def pass_dedup(root):
- """exact duplicate programs within and across subdirs of the same source"""
- by_src = collections.defaultdict(lambda: collections.defaultdict(list))
- for d in sorted(glob.glob(f"{root}/**/*_llamafactory", recursive=True)):
- p = os.path.join(d, "train.parquet")
- if not os.path.exists(p):
- continue
- src = os.path.relpath(d, root).split("/")[0]
- df = pd.read_parquet(p)
- seen = set()
- for row in df.itertuples():
- if row.id in seen:
- continue
- seen.add(row.id)
- h = hashlib.md5(code_of(row.conversations[1]["value"]).encode()).hexdigest()
- by_src[src][h].append(row.id)
- report = {}
- for src, groups in by_src.items():
- dupes = {h: ids for h, ids in groups.items() if len(ids) > 1}
- n_extra = sum(len(v) - 1 for v in dupes.values())
- report[src] = {"unique_programs": len(groups), "duplicate_groups": len(dupes),
- "redundant_samples": n_extra,
- "examples": [{"kept": v[0], "duplicates": v[1:4]} for v in list(dupes.values())[:5]]}
- json.dump({h: ids for h, ids in dupes.items()}, open(f"{root}/duplicates_{src}.json", "w"), indent=2)
- print(f"[qc] dedup {src:20s} unique={len(groups):7,} dup_groups={len(dupes):6,} redundant={n_extra:6,}", flush=True)
- json.dump(report, open(f"{root}/duplicate_report.json", "w"), indent=2)
-
-
-
-def dedupe_decls(body):
- """after merging a Common tab, the same #define / struct / function can appear twice — a redefinition is a
- compile error, and even when it is not, it is pure redundancy. Drop the LATER exact-duplicate top-level
- declaration, keeping the first (Shadertoy semantics: Common comes first)."""
- lines = body.splitlines()
- seen_def, seen_sig, out, removed = set(), set(), [], 0
- i = 0
- sig_re = re.compile(r"^\s*(?:[A-Za-z_][\w]*\s+){1,3}([A-Za-z_]\w*)\s*\(([^)]*)\)\s*\{?\s*$")
- def_re = re.compile(r"^\s*#define\s+(\w+)")
- while i < len(lines):
- ln = lines[i]
- m = def_re.match(ln)
- if m:
- if ln.strip() in seen_def:
- removed += 1; i += 1; continue
- seen_def.add(ln.strip()); out.append(ln); i += 1; continue
- m = sig_re.match(ln)
- if m and "{" in ln:
- sig = (m.group(1), re.sub(r"\s+", "", m.group(2)))
- depth = ln.count("{") - ln.count("}")
- block = [ln]; j = i + 1
- while j < len(lines) and depth > 0:
- depth += lines[j].count("{") - lines[j].count("}")
- block.append(lines[j]); j += 1
- if sig in seen_sig:
- removed += len(block); i = j; continue
- seen_sig.add(sig); out.extend(block); i = j; continue
- out.append(ln); i += 1
- return ("\n".join(out), removed) if removed else (body, 0)
-
-
-def _flat_job(args):
- key, body = args
- ok, err = glsl_compile(body)
- if ok:
- slim, n = dedupe_decls(body)
- if n:
- ok2, _ = glsl_compile(slim)
- if ok2:
- return key, True, f"ok_slimmed({n}_lines)", slim
- return key, True, "ok", None
- cur, steps = body, []
- for name, fn in (("dedupe_decls", dedupe_decls), ("dedup_headers", dedup_headers), ("balance", balance), ("drop_tail", drop_tail)):
- new, n = fn(cur)
- if n == 0 or new == cur:
- continue
- cur = new; steps.append(name)
- ok, err = glsl_compile(cur)
- if ok:
- return key, True, "+".join(steps), cur
- return key, False, err or "unfixable", None
-
-
-def pass_glsl_flat(root, workers, limit=None):
- """validate + slim the flattened (Common-merged) shaders"""
- dirs = sorted(glob.glob(f"{root}/shadertoy/*_llamafactory_flat"))
- uniq, where = {}, collections.defaultdict(list)
- for d in dirs:
- p = os.path.join(d, "train.parquet")
- if not os.path.exists(p):
- continue
- df = pd.read_parquet(p)
- for i, row in enumerate(df.itertuples()):
- body = code_of(row.conversations[1]["value"])
- h = hashlib.md5(body.encode()).hexdigest()
- uniq.setdefault(h, body); where[h].append((d, i))
- items = list(uniq.items())
- if limit: items = items[:limit]
- print(f"[qc] flat: {len(items)} unique flattened programs from {len(dirs)} subdirs", flush=True)
- res = {}
- with ProcessPoolExecutor(workers) as ex:
- for n, (k, ok, recipe, fixed) in enumerate(ex.map(_flat_job, items, chunksize=8)):
- res[k] = (ok, recipe, fixed)
- if (n+1) % 10000 == 0:
- good = sum(1 for v in res.values() if v[0])
- print(f"[qc] flat {n+1}/{len(items)} compile-ok {good} ({100*good/(n+1):.1f}%)", flush=True)
- fixed_map = {k: v[2] for k, v in res.items() if v[2]}
- for d in dirs:
- p = os.path.join(d, "train.parquet")
- if not os.path.exists(p): continue
- df = pd.read_parquet(p); conv = df["conversations"].tolist(); okcol = []; nfix = 0
- for c in conv:
- body = code_of(c[1]["value"]); h = hashlib.md5(body.encode()).hexdigest()
- if h in fixed_map:
- c[1]["value"] = "```glsl\n" + fixed_map[h].strip() + "\n```"; nfix += 1
- okcol.append(bool(res.get(h, (False,))[0]))
- df["conversations"] = conv; df["compiles"] = okcol
- df.to_parquet(p, index=False, compression="zstd")
- json.dump({"rows": len(df), "compiles": int(sum(okcol)), "repaired_or_slimmed": nfix},
- open(os.path.join(d, "qc.json"), "w"), indent=2)
- cls = collections.Counter(v[1] if v[0] else "FAIL:" + v[1][:40] for v in res.values())
- good = sum(1 for v in res.values() if v[0])
- json.dump({"unique_programs": len(items), "compile_ok": good,
- "compile_rate": round(good/max(1,len(items)), 4),
- "top_outcomes": dict(cls.most_common(15))},
- open(f"{root}/glsl_flat_validation_report.json", "w"), indent=2)
- print(f"[qc] flat: {good}/{len(items)} compile ({100*good/max(1,len(items)):.1f}%)", flush=True)
- print("[qc] flat outcomes:", dict(cls.most_common(8)), flush=True)
-
-
-def main():
- ap = argparse.ArgumentParser()
- ap.add_argument("--root", default="/wekafs/ict/hx_624/hf_subdirs")
- ap.add_argument("--pass", dest="which", default="all", choices=["glsl", "glsl_flat", "python", "dedup", "all"])
- ap.add_argument("--workers", type=int, default=32)
- ap.add_argument("--limit", type=int, default=None)
- a = ap.parse_args()
- if a.which in ("dedup", "all"):
- pass_dedup(a.root)
- if a.which in ("python", "all"):
- pass_python(a.root)
- if a.which in ("glsl", "all"):
- pass_glsl(a.root, a.workers, a.limit)
- if a.which == "glsl_flat":
- pass_glsl_flat(a.root, a.workers, a.limit)
-
-
-if __name__ == "__main__":
- main()
diff --git a/finetune/scripts/queue.sh b/finetune/scripts/queue.sh
deleted file mode 100755
index 5bb5c90f..00000000
--- a/finetune/scripts/queue.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-# queue.sh <GPU> <NAME1> [NAME2 ...]: run experiments sequentially on one GPU (waits until no training of ours is using that GPU)
-GPU=$1; shift
-cd /wekafs/ict/hx_624/llm-ft
-for NAME in "$@"; do
- # wait until every GPU in the list has < 10 GB used (previous job finished)
- until [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i $GPU | sort -n | tail -1)" -lt 10000 ]; do sleep 30; done
- scripts/run_exp.sh $GPU $NAME 2>&1 | tee -a logs/exp_$NAME.log
-done
-echo "QUEUE_DONE gpu=$GPU"
diff --git a/finetune/scripts/queue.txt b/finetune/scripts/queue.txt
index af0da6aa..e8119a05 100644
--- a/finetune/scripts/queue.txt
+++ b/finetune/scripts/queue.txt
@@ -1,20 +1,3 @@
-mm_ablation|scripts/run_mm_ablation.sh
-mm_eval_fixed|bash scripts/run_mm_eval_fixed.sh
-mm_multisuite|bash scripts/run_mm_multisuite.sh
-mmmix2|scripts/run_9b_mmmix2.sh
-mmvis|scripts/run_9b_mmvis.sh
-img_budget2|scripts/eval_img_budget.sh
-27b_mm|bash scripts/run_27b_mm.sh
-img_decoding|bash scripts/run_img_decoding.sh
-mm1_singleview|bash scripts/run_9b_mm1.sh
-mmmix2_eval|bash scripts/run_mmmix2_eval.sh
+pubimg|bash -c 'cd /wekafs/ict/hx_624/llm-ft; GPUS=$(scripts/free_gpus.sh 60000) scripts/lf_train.sh configs/lf/sft_9b_lora64_lr1e-4_len8k_pubimg.yaml > logs/train_pubimg.log 2>&1'
+stopdpo_r2_plus|bash scripts/run_stopdpo_r2_plus.sh
noise_profile|bash scripts/run_noise_profile.sh
-27b_mm_eval|bash scripts/run_27b_mm_eval.sh
-bal9b|bash scripts/run_9b_balanced.sh
-stopdpo_train|bash scripts/run_stop_dpo_train.sh
-best_dual|bash scripts/run_best_dual_decode.sh
-27b_dual|bash scripts/run_27b_dual_decode.sh
-stopdpo_r2|bash scripts/run_stop_dpo_r2.sh
-mmvis_eval|bash scripts/run_mmvis_eval.sh
-rescore|bash scripts/run_rescore_sampled.sh
-stop_transfer|bash scripts/run_stopdpo_transfer.sh
diff --git a/finetune/scripts/reexec_scipy_affected.sh b/finetune/scripts/reexec_scipy_affected.sh
deleted file mode 100755
index 6e927054..00000000
--- a/finetune/scripts/reexec_scipy_affected.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# Re-execute + re-score every 3DCodeBench run that had failures caused by the missing scipy in Blender's Python.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate llmft
-for RUN in qwen35_9b_lora_v7_ep4 md_big_T07_s2 qwen35_9b_full_md_bal qwen35_9b_lora_md_bal dpo_geo_md_xl_T07_s3 \
- md_xl_T07_s2 md_xl_T07_s3 qwen35_9b_full_v2_3gpu qwen35_9b_full_v3_4gpu qwen35_9b_lora_md_glsl \
- qwen35_9b_lora_md_xl_ck3150 qwen35_9b_lora_v6_detail; do
- D=eval/out/$RUN; [ -d $D ] || continue
- OLD=$(python3 -c "import json;print(json.load(open('$D/summary.json'))['exec_ok'])" 2>/dev/null || echo "?")
- python eval/run_bench.py --gen_dir $D --workers 20 --timeout 300 > /dev/null 2>&1
- python eval/metrics.py --gen_dir $D > /dev/null 2>&1
- NEW=$(python3 -c "import json;s=json.load(open('$D/summary.json'));print(f\"{s['exec_ok']}/{s['n_tasks']} = {100*s['exec_ok_rate']:.1f}% [email protected](all) {s['[email protected]_mean_all(fail=0)']:.3f}\")" 2>/dev/null)
- echo "[rescore] $RUN: was exec_ok=$OLD -> now $NEW"
-done
-echo "[rescore] DONE"
diff --git a/finetune/scripts/render_verify_glsl.py b/finetune/scripts/render_verify_glsl.py
deleted file mode 100644
index c3773022..00000000
--- a/finetune/scripts/render_verify_glsl.py
+++ /dev/null
@@ -1,78 +0,0 @@
-"""Render-verify the compile-verified Shadertoy corpus: compiling is not the same as drawing something.
-
-Samples (or exhaustively walks) the unique programs in the flattened shadertoy datasets, renders each in headless
-WebGL2, and records status / distinct colours / pixel std / whether the image changes with iTime. Writes
-`renders_ok`, `renders_status` back into the parquet rows when run with --write.
-
-usage: python scripts/render_verify_glsl.py [--sample 3000] [--workers 8] [--write]
-"""
-import argparse, collections, glob, hashlib, json, os, random, re, sys, tempfile
-from concurrent.futures import ProcessPoolExecutor
-import pandas as pd
-sys.path.insert(0, "/wekafs/ict/hx_624/llm-ft/eval")
-os.environ.setdefault("PLAYWRIGHT_BROWSERS_PATH", "/wekafs/ict/hx_624/cache/ms-playwright")
-
-def code_of(m):
- x = re.findall(r"```[a-z]*\n(.*?)```", m, flags=re.S)
- return (x[0] if x else m).strip()
-
-def job(chunk):
- """one persistent browser per worker, many shaders per browser (a browser launch costs 3-5 s)"""
- from glsl_render_batch import BatchRenderer
- out = []
- with BatchRenderer() as r:
- for h, code in chunk:
- x = r.run(code)
- out.append((h, x.get("status", "FAIL"), x.get("distinct", 0), x.get("std", 0.0),
- bool(x.get("changed")), (x.get("error") or "")[:120]))
- return out
-
-def main():
- ap = argparse.ArgumentParser()
- ap.add_argument("--sample", type=int, default=3000)
- ap.add_argument("--workers", type=int, default=8)
- ap.add_argument("--write", action="store_true")
- a = ap.parse_args()
- uniq, where = {}, collections.defaultdict(list)
- for f in sorted(glob.glob("/wekafs/ict/hx_624/hf_subdirs/shadertoy/*_llamafactory_flat/train.parquet")):
- df = pd.read_parquet(f)
- if "compiles" not in df: continue
- for i, row in enumerate(df[df["compiles"]].itertuples()):
- b = code_of(row.conversations[1]["value"]); h = hashlib.md5(b.encode()).hexdigest()
- uniq.setdefault(h, b); where[h].append(f)
- items = list(uniq.items())
- print(f"[render] {len(items)} unique compile-verified programs", flush=True)
- random.seed(11); random.shuffle(items)
- if a.sample: items = items[:a.sample]
- res, stats = {}, collections.Counter()
- CH = 60
- chunks = [items[i:i+CH] for i in range(0, len(items), CH)]
- done = 0
- with ProcessPoolExecutor(a.workers) as ex:
- for out in ex.map(job, chunks):
- for h, st, dis, std, ch, err in out:
- res[h] = (st, dis, std, ch, err); stats[st] += 1
- done += len(out)
- if done % 1200 < CH:
- print(f"[render] {done}/{len(items)} {dict(stats)}", flush=True)
- animated = sum(1 for v in res.values() if v[3])
- rep = {"checked": len(res), "status": dict(stats), "animated": animated,
- "render_rate": round(stats["OK"]/max(1,len(res)), 4),
- "static_examples": [{"hash": h, "err": v[4]} for h, v in list(res.items()) if v[0] == "STATIC"][:5],
- "fail_examples": [{"hash": h, "err": v[4]} for h, v in list(res.items()) if v[0] == "FAIL"][:5]}
- json.dump(rep, open("/wekafs/ict/hx_624/hf_subdirs/glsl_render_report.json", "w"), indent=2)
- print(f"[render] OK {stats['OK']}/{len(res)} ({100*stats['OK']/max(1,len(res)):.1f}%) | animated {animated} | {dict(stats)}", flush=True)
- if a.write:
- for f in sorted(glob.glob("/wekafs/ict/hx_624/hf_subdirs/shadertoy/*_llamafactory_flat/train.parquet")):
- df = pd.read_parquet(f)
- if "compiles" not in df: continue
- st = []
- for row in df.itertuples():
- b = code_of(row.conversations[1]["value"]); h = hashlib.md5(b.encode()).hexdigest()
- st.append(res.get(h, ("unchecked",))[0])
- df["renders_status"] = st; df["renders_ok"] = [s == "OK" for s in st]
- df.to_parquet(f, index=False, compression="zstd")
- print("[render] wrote renders_status/renders_ok into the parquets", flush=True)
-
-if __name__ == "__main__":
- main()
diff --git a/finetune/scripts/repro_probe.sh b/finetune/scripts/repro_probe.sh
deleted file mode 100755
index e73da6a0..00000000
--- a/finetune/scripts/repro_probe.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-# 12.7 showed two DIFFERENT harnesses disagree on 29 of 211 tasks at temperature 0. The open question is whether
-# greedy is reproducible when NOTHING changes: same script, same flags, same card. Three identical runs answer it.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING
-M=runs/lf_qwen35_9b_mm_text/merged
-G=""; for _ in $(seq 1 40); do G=$(scripts/free_gpus.sh 40000 | cut -d, -f1); [ -n "$G" ] && break; sleep 30; done
-[ -z "$G" ] && { echo "[repro] no GPU with 40 GB free"; exit 0; }
-export CUDA_VISIBLE_DEVICES=$G
-for R in 1 2 3; do
- OUT=eval/out/_repro_r$R; mkdir -p $OUT
- echo "[repro] run $R on GPU $G"
- python eval/generate_vllm.py --model $M --prompts data/sft_v1/bench_prompts.jsonl --out $OUT --tp 1 \
- --no_think --dialect blender --max_new_tokens 32768 --max_model_len 40960 2>&1 | tail -1
-done
-conda activate llmft
-python - <<'PY'
-import os, glob, itertools
-runs = ["eval/out/_repro_r1", "eval/out/_repro_r2", "eval/out/_repro_r3"]
-tasks = sorted(set.intersection(*[{os.path.basename(p) for p in glob.glob(r + "/*") if os.path.isdir(p)} for r in runs]))
-print(f"[repro] {len(tasks)} tasks common to all three runs")
-for a, b in itertools.combinations(range(3), 2):
- same = sum(1 for t in tasks
- if open(f"{runs[a]}/{t}/code.py", "rb").read() == open(f"{runs[b]}/{t}/code.py", "rb").read())
- print(f"[repro] run{a+1} vs run{b+1}: byte-identical {same}/{len(tasks)}")
-PY
-echo "[repro] DONE"
diff --git a/finetune/scripts/run_27b.sh b/finetune/scripts/run_27b.sh
deleted file mode 100755
index 3c4d30d7..00000000
--- a/finetune/scripts/run_27b.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-# 27B pipeline: wait for free GPUs -> ZeRO-3 LoRA smoke test -> full train -> merge -> eval_all (TP=2) on all six suites
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-echo "[27b] $(date) waiting for GPUs 0-3 to be free"
-until [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i 0,1,2,3 | sort -n | tail -1)" -lt 8000 ]; do sleep 60; done # all four idle
-echo "[27b] $(date) ZeRO-3 smoke test (6 steps, 4 GPUs)"
-GPUS=0,1,2,3 scripts/lf_train.sh configs/lf/lora_27b_md_z3.yaml max_steps=6 save_steps=100000 eval_steps=100000 \
- output_dir=/wekafs/ict/hx_624/llm-ft/runs/_smoke_27b_z3 > logs/smoke_27b_z3.log 2>&1
-if ! grep -q "train_runtime" logs/smoke_27b_z3.log; then
- echo "[27b] SMOKE FAILED: $(grep -E 'OutOfMemoryError|RuntimeError|Error' logs/smoke_27b_z3.log | grep -v errors | tail -1 | cut -c1-200)"; exit 1
-fi
-echo "[27b] smoke ok: $(grep -oE "'train_runtime': [0-9.]+" logs/smoke_27b_z3.log | tail -1)"; rm -rf runs/_smoke_27b_z3
-echo "[27b] $(date) full LoRA train (md_27b_max: 78k pairs / 67.6M tok, 6 dialects)"
-GPUS=0,1,2,3 scripts/lf_train.sh configs/lf/lora_27b_md_z3.yaml > logs/train_27b_max.log 2>&1
-RUN=runs/lf_qwen38_27b_lora_md_max
-[ -f $RUN/train_results.json ] || { echo "[27b] TRAIN FAILED: $(grep -E 'Error|OutOfMemory' logs/train_27b_max.log | grep -v errors | tail -1 | cut -c1-200)"; exit 1; }
-echo "[27b] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-200)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B|" \
- -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" \
- -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_27b_max.yaml
-scripts/lf_export.sh configs/lf/export_27b_max.yaml > logs/export_27b_max.log 2>&1 || { echo "[27b] EXPORT FAILED"; exit 1; }
-echo "[27b] $(date) eval tuned model (TP=2, GPUs 0,1)"
-GPUS=0,1 TP=2 eval/eval_all.sh $RUN/merged q27b_ft --max_new 8192 2>&1 | grep -E "gen-multi|extract\]|status counts|dialect|DONE" | tail -30
-echo "[27b] ALL DONE"
diff --git a/finetune/scripts/run_27b_clean.sh b/finetune/scripts/run_27b_clean.sh
deleted file mode 100755
index 788dce43..00000000
--- a/finetune/scripts/run_27b_clean.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash
-# 27B v4: v2's winning blender-heavy core + CadQuery raised 33k -> 105k unique samples (one caption each).
-# Question: can a single 27B top both 3DCodeBench (v2: 93.4%) and CadQuery (9B md_xl: 97.5%)?
-#
-# 27B LoRA on 80 GB cards sits right at the memory edge — the identical recipe that trained v2 OOMs on other
-# days. So instead of guessing, try a ladder of settings (keeping lora_rank 64, the quality-relevant knob;
-# every sample in this mix is <=3400 tokens, so a smaller cutoff truncates nothing) and take the first that
-# survives 4 real steps.
-set -uo pipefail
-cd /wekafs/ict/hx_624/llm-ft
-GPUS_USE=$(scripts/free_gpus.sh); NGPU=$(echo "$GPUS_USE" | awk -F, '{print NF}')
-[ -z "$GPUS_USE" ] && { echo "[27bclean] no free GPUs"; exit 1; }
-RUN=runs/lf_qwen38_27b_clean
-
-WIN=""
-for SPEC in "3584 5 adamw_torch" "3072 6 adamw_torch" "3072 6 adamw_8bit" "2560 8 adamw_8bit"; do
- set -- $SPEC; CUT=$1; ACC=$2; OPT=$3
- echo "[27bclean] $(date) probing cutoff=$CUT accum=$ACC optim=$OPT"
- EXTRA=""; [ "$OPT" = "adamw_8bit" ] && EXTRA="optim=adamw_8bit"
- GPUS=$GPUS_USE scripts/lf_train.sh configs/lf/lora_27b_clean.yaml max_steps=4 save_steps=100000 eval_steps=100000 \
- cutoff_len=$CUT gradient_accumulation_steps=$ACC $EXTRA \
- tokenized_path=/wekafs/ict/hx_624/llm-ft/data/lf/tok_27bclean_$CUT \
- output_dir=/wekafs/ict/hx_624/llm-ft/runs/_probe_v4 > logs/probe_v4_$CUT$OPT.log 2>&1
- rm -rf runs/_probe_v4
- if grep -q "train_runtime" logs/probe_v4_$CUT$OPT.log; then
- S=$(grep -oE "[0-9]/4 \[[0-9:]+<[0-9:]+, *[0-9.]+s/it" logs/probe_v4_$CUT$OPT.log | tail -1)
- echo "[27bclean] OK at cutoff=$CUT accum=$ACC optim=$OPT ($S)"; WIN="$CUT $ACC $OPT"; break
- fi
- ERR=$(grep -oE "torch.OutOfMemoryError[^\"]*|Triton Error \[CUDA\]: out of memory|RuntimeError: [^\"]{0,120}" logs/probe_v4_$CUT$OPT.log | tail -1)
- echo "[27bclean] FAILED at cutoff=$CUT accum=$ACC optim=$OPT -> ${ERR:-unknown error, see logs/probe_v4_$CUT$OPT.log}"
- case "$ERR" in *"Triton >= 3.4"*|*"tilelang"*) echo "[27bclean] ABORT: the lf env's triton was downgraded (Hopper needs 3.7.1) — fix the env, not the config"; exit 2;; esac
-done
-[ -z "$WIN" ] && { echo "[27bclean] every setting OOMed — needs more GPUs or a sharded optimizer"; exit 1; }
-set -- $WIN; CUT=$1; ACC=$2; OPT=$3
-EXTRA=""; [ "$OPT" = "adamw_8bit" ] && EXTRA="optim=adamw_8bit"
-
-echo "[27bclean] $(date) train (191.7k pairs / 177M tok, leak-free, cutoff=$CUT accum=$ACC optim=$OPT, GPUs $GPUS_USE)"
-GPUS=$GPUS_USE scripts/lf_train.sh configs/lf/lora_27b_clean.yaml cutoff_len=$CUT gradient_accumulation_steps=$ACC $EXTRA \
- tokenized_path=/wekafs/ict/hx_624/llm-ft/data/lf/tok_27bclean_$CUT > logs/train_27b_v4.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[27bclean] TRAIN FAILED: $(grep -E 'out of memory|Error' logs/train_27b_v4.log | grep -v errors | tail -1 | cut -c1-160)"; exit 1; }
-echo "[27bclean] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-160)"
-
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B|" \
- -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" \
- -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_27b_clean.yaml
-scripts/lf_export.sh configs/lf/export_27b_clean.yaml > logs/export_27b_clean.log 2>&1 || { echo "[27bclean] EXPORT FAILED"; exit 1; }
-echo "[27bclean] $(date) eval greedy"
-GPUS=$GPUS_USE TP=2 eval/eval_all_run2.sh $RUN/merged q27b_clean --max_new 8192 2>&1 | grep -E "gen-multi|status counts|dialect|DONE" | tail -20
-echo "[27bclean] $(date) eval sampled (openscad/glsl)"
-GPUS=$GPUS_USE TP=2 eval/eval_all_run2.sh $RUN/merged q27b_clean_T07 --temp 0.7 --seed 1 --max_new 8192 --suites openscad glsl 2>&1 | grep -E "dialect|DONE" | tail -4
-echo "[27bclean] ALL DONE"
diff --git a/finetune/scripts/run_27b_dpo.sh b/finetune/scripts/run_27b_dpo.sh
deleted file mode 100755
index cb0c6c4e..00000000
--- a/finetune/scripts/run_27b_dpo.sh
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/bin/bash
-# 27B v2 + multi-dialect execution-feedback DPO: sample K=2 (T=0.8) on 1200 train prompts per dialect ->
-# execute with each dialect's executor -> (OK, FAIL) pairs -> DPO (cutoff 2048, DDP) -> full eval.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft; W=data/dpo_27b_v2; mkdir -p $W
-BASE=runs/lf_qwen38_27b_lora_v2/merged
-# opportunistic: take whatever GPUs are fully idle (>=2), confirmed 3 times in a row
-STABLE=0; GPUS_USE=""
-while [ $STABLE -lt 3 ]; do
- F=$(scripts/free_gpus.sh); N=$(echo "$F" | awk -F, 'NF&&$1!=""{print NF}')
- if [ -n "$F" ] && [ "${N:-0}" -ge 2 ]; then
- if [ "$F" = "$GPUS_USE" ]; then STABLE=$((STABLE+1)); else GPUS_USE="$F"; STABLE=1; fi
- else STABLE=0; GPUS_USE=""; fi
- sleep 60
-done
-NGPU=$(echo "$GPUS_USE" | awk -F, '{print NF}')
-echo "[sched] using GPUs $GPUS_USE ($NGPU cards)"
-echo "[27bdpo] $(date) sampling with the tuned 27B (TP=2)"
-source /wekafs/ict/hx_624/llm-ft/env.sh
-python - <<'PY'
-import json, random; random.seed(9)
-rows=[]
-for d in ["blender","cadquery","openscad","glsl"]:
- rs=[json.loads(l) for l in open(f"data/multidialect/{d}/train.jsonl")]; random.shuffle(rs)
- for i,r in enumerate(rs[:1200]): rows.append({"task": f"{d}_{i:05d}", "dialect": d, "messages": r["messages"][:2]})
-random.shuffle(rows)
-with open("data/dpo_27b_v2/prompts.jsonl","w") as f:
- for r in rows: f.write(json.dumps(r)+"\n")
-print("prompts", len(rows))
-PY
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$GPUS_USE
-for i in 1 2; do
- python eval/generate_vllm.py --model $BASE --prompts $W/prompts.jsonl --out $W/gen_s$i --tp $NGPU --no_think \
- --max_new_tokens 4096 --temperature 0.8 --seed $((700+i)) 2>&1 | grep -E "gen-vllm|Error" | tail -1
-done
-echo "[27bdpo] $(date) executing + building pairs"
-conda activate llmft
-python - <<'PY'
-import json, os, glob, random, subprocess, sys
-from concurrent.futures import ThreadPoolExecutor
-sys.path.insert(0, "eval"); from dialect_runners import RUNNERS
-BL="/wekafs/ict/hx_624/tools/blender-5.0.1-linux-x64/blender"; RUNNER=os.path.abspath("eval/blender_runner.py")
-def run_blender(code, d):
- d=os.path.abspath(d); os.makedirs(d, exist_ok=True); sp=os.path.join(d,"code.py"); open(sp,"w").write(code)
- try:
- subprocess.run([BL,"-b","--factory-startup","-noaudio","--python",RUNNER,"--","--script",sp,"--out",os.path.join(d,"out.glb"),"--report",os.path.join(d,"exec.json")],
- stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=120, env={**os.environ,"HOME":"/tmp"})
- return json.load(open(os.path.join(d,"exec.json"))) if os.path.exists(os.path.join(d,"exec.json")) else {"status":"CRASH"}
- except subprocess.TimeoutExpired: return {"status":"TIMEOUT"}
-W="data/dpo_27b_v2"; prompts={json.loads(l)["task"]: json.loads(l) for l in open(f"{W}/prompts.jsonl")}
-jobs=[]
-for d in sorted(glob.glob(f"{W}/gen_s*/")):
- for t in os.listdir(d):
- if os.path.isfile(os.path.join(d,t,"code.py")): jobs.append((d,t))
-def job(x):
- d,t=x; code=open(os.path.join(d,t,"code.py")).read(); dia=prompts[t]["dialect"]; wd=os.path.join(d,t,"exec")
- r = run_blender(code, wd) if dia=="blender" else RUNNERS[dia](code, wd)
- return (d,t,dia,r.get("status"))
-with ThreadPoolExecutor(40) as ex: res=list(ex.map(job, jobs))
-by={}
-for d,t,dia,st in res:
- code=open(os.path.join(d,t,"code.py")).read().strip()
- if code.count("\n")<3: continue
- by.setdefault(t,{"dia":dia,"ok":[],"bad":[]})["ok" if st=="OK" else "bad"].append(code)
-from collections import Counter
-print("per-dialect pass rate:", {dia: round(sum(1 for _,_,di,st in res if di==dia and st=="OK")/max(1,sum(1 for _,_,di,_ in res if di==dia)),3) for dia in ["blender","cadquery","openscad","glsl"]})
-random.seed(3); pairs=[]; per=Counter()
-for t,v in by.items():
- if v["ok"] and v["bad"]:
- ok=random.choice(v["ok"]); bad=random.choice(v["bad"])
- if ok==bad: continue
- p=prompts[t]; per[v["dia"]]+=1
- pairs.append({"conversations":[{"from":"human","value":p["messages"][1]["content"]}],"system":p["messages"][0]["content"],
- "chosen":{"from":"gpt","value":ok if ok.startswith("```") else "```\n"+ok+"\n```"},
- "rejected":{"from":"gpt","value":bad if bad.startswith("```") else "```\n"+bad+"\n```"}})
-random.shuffle(pairs); json.dump(pairs, open("data/lf/dpo_27b_pairs.json","w"), ensure_ascii=False)
-info=json.load(open("data/lf/dataset_info.json")); info["dpo_27b_pairs"]={"file_name":"dpo_27b_pairs.json","ranking":True,"formatting":"sharegpt","columns":{"messages":"conversations","system":"system","chosen":"chosen","rejected":"rejected"}}
-json.dump(info, open("data/lf/dataset_info.json","w"), indent=2); print("27B pairs:", len(pairs), dict(per))
-PY
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" -e "s|dataset: dpo_exec_pairs|dataset: dpo_27b_pairs|" \
- -e "s|output_dir:.*|output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen38_27b_dpo|" configs/lf/dpo_exec_v1.yaml > configs/lf/dpo_27b.yaml
-echo "[27bdpo] $(date) DPO train (cutoff 2048, 4 GPUs)"
-GPUS=$GPUS_USE scripts/lf_train.sh configs/lf/dpo_27b.yaml cutoff_len=2048 gradient_accumulation_steps=4 > logs/train_27b_dpo.log 2>&1
-RUN=runs/lf_qwen38_27b_dpo
-[ -f $RUN/train_results.json ] || { echo "[27bdpo] TRAIN FAILED: $(grep -E 'OutOfMemory|Error' logs/train_27b_dpo.log | grep -v errors | tail -1 | cut -c1-160)"; exit 1; }
-echo "[27bdpo] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-160)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_27b_dpo.yaml
-scripts/lf_export.sh configs/lf/export_27b_dpo.yaml > logs/export_27b_dpo.log 2>&1 || { echo "[27bdpo] EXPORT FAILED"; exit 1; }
-GPUS=$GPUS_USE TP=$NGPU eval/eval_all_run2.sh $RUN/merged q27b_dpo --max_new 8192 2>&1 | grep -E "gen-multi|status counts|dialect|DONE" | tail -20
-GPUS=$GPUS_USE TP=$NGPU eval/eval_all_run2.sh $RUN/merged q27b_dpo_T07 --temp 0.7 --seed 1 --max_new 8192 --suites openscad glsl 2>&1 | grep -E "dialect|DONE" | tail -4
-echo "[27bdpo] ALL DONE"
diff --git a/finetune/scripts/run_27b_dpo_train.sh b/finetune/scripts/run_27b_dpo_train.sh
deleted file mode 100755
index 5af1d630..00000000
--- a/finetune/scripts/run_27b_dpo_train.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-# Resume the 27B execution-feedback DPO round from the already-built pairs (756 pairs, data/lf/dpo_27b_pairs.json).
-# DPO forwards chosen+rejected, so a plain DDP LoRA OOMs at 27B; the token count here is tiny, so ZeRO-3 is the right trade.
-set -uo pipefail
-cd /wekafs/ict/hx_624/llm-ft
-BASE=runs/lf_qwen38_27b_lora_v2/merged
-RUN=runs/lf_qwen38_27b_dpo
-
-STABLE=0; GPUS_USE=""
-while [ $STABLE -lt 2 ]; do
- F=$(scripts/free_gpus.sh); N=$(echo "$F" | awk -F, 'NF&&$1!=""{print NF}')
- if [ -n "$F" ] && [ "${N:-0}" -ge 2 ]; then
- if [ "$F" = "$GPUS_USE" ]; then STABLE=$((STABLE+1)); else GPUS_USE="$F"; STABLE=1; fi
- else STABLE=0; GPUS_USE=""; fi
- sleep 30
-done
-NGPU=$(echo "$GPUS_USE" | awk -F, '{print NF}')
-echo "[27bdpo] $(date) DPO train on GPUs $GPUS_USE (ZeRO-3, cutoff 2048)"
-GPUS=$GPUS_USE scripts/lf_train.sh configs/lf/dpo_27b.yaml cutoff_len=2048 gradient_accumulation_steps=4 \
- deepspeed=/wekafs/ict/hx_624/tools/LLaMA-Factory/examples/deepspeed/ds_z3_config.json > logs/train_27b_dpo.log 2>&1
-if [ ! -f $RUN/train_results.json ]; then
- echo "[27bdpo] TRAIN FAILED: $(grep -E 'OutOfMemory|out of memory|Error' logs/train_27b_dpo.log | grep -v errors | tail -1 | cut -c1-160)"
- exit 1
-fi
-echo "[27bdpo] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-160)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" \
- -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" \
- -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_27b_dpo.yaml
-scripts/lf_export.sh configs/lf/export_27b_dpo.yaml > logs/export_27b_dpo.log 2>&1 || { echo "[27bdpo] EXPORT FAILED"; exit 1; }
-echo "[27bdpo] $(date) eval"
-GPUS=$GPUS_USE TP=$NGPU eval/eval_all_run2.sh $RUN/merged q27b_dpo --max_new 8192 2>&1 | grep -E "gen-multi|status counts|dialect|DONE" | tail -20
-GPUS=$GPUS_USE TP=$NGPU eval/eval_all_run2.sh $RUN/merged q27b_dpo_T07 --temp 0.7 --seed 1 --max_new 8192 --suites openscad glsl 2>&1 | grep -E "dialect|DONE" | tail -4
-echo "[27bdpo] ALL DONE"
diff --git a/finetune/scripts/run_27b_dual_decode.sh b/finetune/scripts/run_27b_dual_decode.sh
deleted file mode 100755
index 55f3add9..00000000
--- a/finetune/scripts/run_27b_dual_decode.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-# 27B v2 is the project's other headline model and its dialect numbers are greedy-only, so by section 13 they
-# understate it the same way the 9B's did (base 27B scores 88% on OpenSCAD, the fine-tune reads 34%).
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-RUN=runs/lf_qwen38_27b_lora_v2
-if [ ! -d $RUN/merged ]; then
- [ -f configs/lf/export_27b_v2.yaml ] || { echo "[27bdual] no export config"; exit 0; }
- scripts/lf_export.sh configs/lf/export_27b_v2.yaml > logs/export_27b_v2_dual.log 2>&1 \
- || { echo "[27bdual] EXPORT FAILED: $(grep -iE 'error|OSError' logs/export_27b_v2_dual.log | tail -1 | cut -c1-160)"; exit 0; }
-fi
-# a 51 GB checkpoint does not fit one shared card; two-way tensor parallel with the Mamba-cache cap it needs
-G=${GPUS:-$(scripts/free_gpus.sh 45000 | cut -d, -f1,2)}
-TP=$(echo "$G" | awk -F, '{print NF}')
-{ [ -z "$G" ] || [ "${TP:-0}" -lt 2 ]; } && { echo "[27bdual] skipped: need two cards with 45 GB free, got [$G]"; exit 0; }
-echo "[27bdual] $(date) on GPUs $G (tp=$TP)"
-GPUS=$G TP=$TP bash eval/eval_all_run2.sh $RUN/merged q27b_v2_t07 --temp 0.7 --seed 1 2>&1 | tail -10
-echo "[27bdual] DONE"
diff --git a/finetune/scripts/run_27b_mm.sh b/finetune/scripts/run_27b_mm.sh
deleted file mode 100755
index e7203dfa..00000000
--- a/finetune/scripts/run_27b_mm.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-# The 9B result to test at scale: adding reference images improved even the TEXT-only path (90.6%). Does that
-# still hold for a 27B, or is it a small-model effect? Single view, because four views do not fit a 27B cutoff.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-V=27b_mm_img_text; RUN=runs/lf_qwen38_27b_mm_img_text
-G=""; for _ in $(seq 1 60); do G=$(scripts/free_gpus.sh 60000); [ -n "$G" ] && break; sleep 60; done
-[ -z "$G" ] && { echo "[$V] skipped: no GPU with 60 GB free after 60 min"; exit 0; }
-echo "[$V] $(date) train on GPUs $G"
-GPUS=$G scripts/lf_train.sh configs/lf/lora_27b_mm_img_text.yaml > logs/train_$V.log 2>&1
-if [ ! -f $RUN/train_results.json ]; then
- # a 27B holding full weights per rank plus image activations may simply not fit; that is a result, so report the
- # real error rather than a bare "failed"
- echo "[$V] TRAIN FAILED: $(grep -iE 'out of memory|Error|Traceback' logs/train_$V.log | grep -v errors | tail -2 | tr '\n' ' ' | cut -c1-220)"; exit 0; fi
-echo "[$V] train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-130)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_$V.yaml
-scripts/lf_export.sh configs/lf/export_$V.yaml > logs/export_$V.log 2>&1 || { echo "[$V] EXPORT FAILED"; exit 0; }
-G1=""; for _ in $(seq 1 40); do G1=$(scripts/free_gpus.sh 70000 | cut -d, -f1); [ -n "$G1" ] && break; sleep 30; done
-[ -z "$G1" ] && { echo "[$V] eval skipped: a 27B needs ~55 GB of weights and no card had 70 GB free"; exit 0; }
-echo "[$V] $(date) eval on GPU $G1"
-GPUS=$G1 TP=1 bash eval/eval_all_run2.sh $RUN/merged q27b_mm_img_text_all --suites bench 2>&1 | tail -20
-echo "[$V] DONE"
diff --git a/finetune/scripts/run_27b_mm_eval.sh b/finetune/scripts/run_27b_mm_eval.sh
deleted file mode 100755
index 77a0928a..00000000
--- a/finetune/scripts/run_27b_mm_eval.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-# Score the 27B multimodal LoRA once its 4h16m single-GPU run finishes. It needs a card with room for a 27B
-# (~55 GB of weights), which on this box means a nearly empty one.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-RUN=runs/lf_qwen38_27b_mm_img_text
-[ -f $RUN/train_results.json ] || { echo "[27bmmeval] training has not finished — nothing to score"; exit 0; }
-if [ ! -d $RUN/merged ]; then
- sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_27b_mm.yaml
- scripts/lf_export.sh configs/lf/export_27b_mm.yaml > logs/export_27b_mm.log 2>&1 || { echo "[27bmmeval] EXPORT FAILED"; exit 0; }
-fi
-# 51 GB of weights will not sit on one shared card: single-GPU died in KV-cache profiling with 788 MB left.
-# Two-way tensor parallel puts 25.5 GB on each card, which fits what this box actually has free.
-G=${GPUS:-$(scripts/free_gpus.sh 45000 | cut -d, -f1,2)}
-TP=$(echo "$G" | awk -F, '{print NF}')
-[ -z "$G" ] || [ "$TP" -lt 2 ] && { echo "[27bmmeval] skipped: need two cards with 45 GB free, got [$G]"; exit 0; }
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$G
-OUT=eval/out/q27b_mm_img_text_bench; mkdir -p $OUT
-python eval/generate_vllm_img.py --model $RUN/merged --prompts eval/out/_img4text_bench_prompts.jsonl --out $OUT \
- --tp $TP --max_num_seqs 64 --max_new_tokens 32768 --max_model_len 40960 > logs/gen_27b_mm.log 2>&1; tail -3 logs/gen_27b_mm.log
-N=$(ls $OUT | grep -vc extract_stats.json || true)
-[ "${N:-0}" -lt 5 ] && { echo "[27bmmeval] GENERATION PRODUCED NOTHING — not scoring"; exit 0; }
-conda activate llmft
-python eval/run_bench.py --gen_dir $OUT --workers 24 --timeout 300 2>&1 | grep "status counts" | tail -1
-echo "[27bmmeval] DONE"
diff --git a/finetune/scripts/run_27b_think32k.sh b/finetune/scripts/run_27b_think32k.sh
deleted file mode 100755
index 80726ebb..00000000
--- a/finetune/scripts/run_27b_think32k.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-# Fair-budget rerun: 27B with thinking ON but a 32k output budget on 3DCodeBench (the 12k run truncated 204/212).
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-until grep -qE "\[9bmax\] (ALL DONE|TRAIN FAILED|EXPORT FAILED)" logs/run_md_max_9b.log 2>/dev/null; do sleep 120; done
-until [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i 0,1 | sort -n | tail -1)" -lt 8000 ]; do sleep 60; done
-echo "[27b32k] $(date) bench with thinking, 32k budget"
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=0,1
-python eval/generate_multi.py --model /wekafs/ict/hx_624/models/Qwen3.8-27B --tp 2 --max_new_tokens 30000 --max_model_len 34816 \
- --spec '[{"name":"bench","prompts":"data/sft_v1/bench_prompts.jsonl","out":"eval/out/q27b_think32k_bench","dialect":"blender"}]' 2>&1 | grep -E "gen-multi|extract\]" | tail -3
-conda activate llmft; eval/exec_suites.sh q27b_think32k bench
-echo "[27b32k] DONE"
diff --git a/finetune/scripts/run_27b_v2.sh b/finetune/scripts/run_27b_v2.sh
deleted file mode 100755
index 2d3121f8..00000000
--- a/finetune/scripts/run_27b_v2.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# 27B six-dialect LoRA, DDP @ cutoff 4096 (ZeRO-3 was 7.8x slower), then merge + full eval
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-echo "[27b] $(date) LoRA DDP train (md_27b_max4k, ~64M tok, 4 GPUs, ~5 h)"
-GPUS=0,1,2,3 scripts/lf_train.sh configs/lf/lora_27b_ddp.yaml > logs/train_27b_ddp.log 2>&1
-RUN=runs/lf_qwen38_27b_lora_md_max
-[ -f $RUN/train_results.json ] || { echo "[27b] TRAIN FAILED: $(grep -E 'OutOfMemory|Error' logs/train_27b_ddp.log | grep -v errors | tail -1 | cut -c1-200)"; exit 1; }
-echo "[27b] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-200)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B|" \
- -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" \
- -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_27b_max.yaml
-scripts/lf_export.sh configs/lf/export_27b_max.yaml > logs/export_27b_max.log 2>&1 || { echo "[27b] EXPORT FAILED"; exit 1; }
-echo "[27b] $(date) eval tuned 27B (TP=2)"
-GPUS=0,1 TP=2 eval/eval_all_run2.sh $RUN/merged q27b_ft --max_new 8192 2>&1 | grep -E "gen-multi|extract\]|status counts|dialect|DONE" | tail -30
-echo "[27b] ALL DONE"
diff --git a/finetune/scripts/run_27b_v2b.sh b/finetune/scripts/run_27b_v2b.sh
deleted file mode 100755
index ad5ff38f..00000000
--- a/finetune/scripts/run_27b_v2b.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-# After the 9B md_max run: 27B v2 — Blender-heavy mix (adds the 15.7k execution-verified bootstrapped samples,
-# Blender x2) to fix the 3DCodeBench regression; then merge + eval (greedy everywhere + T=0.7 for openscad/glsl).
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-# require the GPUs to stay idle for 3 consecutive checks (an eval between suites can look idle for a moment)
-IDLE=0
-while [ $IDLE -lt 3 ]; do
- if [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i 0,1,2,3 | sort -n | tail -1)" -lt 8000 ]; then IDLE=$((IDLE+1)); else IDLE=0; fi
- sleep 30
-done
-echo "[27bv2] $(date) train (104k pairs / 77M tok, blender-heavy, DDP@4096, 4 GPUs)"
-GPUS=0,1,2,3 scripts/lf_train.sh configs/lf/lora_27b_v2.yaml > logs/train_27b_v2.log 2>&1
-RUN=runs/lf_qwen38_27b_lora_v2
-[ -f $RUN/train_results.json ] || { echo "[27bv2] TRAIN FAILED: $(grep -E 'OutOfMemory|Error' logs/train_27b_v2.log | grep -v errors | tail -1 | cut -c1-200)"; exit 1; }
-echo "[27bv2] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-200)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_27b_v2.yaml
-scripts/lf_export.sh configs/lf/export_27b_v2.yaml > logs/export_27b_v2.log 2>&1 || { echo "[27bv2] EXPORT FAILED"; exit 1; }
-echo "[27bv2] $(date) eval greedy (TP=2)"
-GPUS=0,1 TP=2 eval/eval_all_run2.sh $RUN/merged q27b_v2 --max_new 8192 2>&1 | grep -E "gen-multi|extract\]|status counts|dialect|DONE" | tail -30
-echo "[27bv2] $(date) eval sampled (T=0.7) for the boilerplate-heavy dialects"
-GPUS=0,1 TP=2 eval/eval_all_run2.sh $RUN/merged q27b_v2_T07 --temp 0.7 --seed 1 --max_new 8192 --suites openscad glsl 2>&1 | grep -E "gen-multi|dialect|DONE" | tail -8
-echo "[27bv2] ALL DONE"
diff --git a/finetune/scripts/run_27b_v3.sh b/finetune/scripts/run_27b_v3.sh
deleted file mode 100755
index 0ed26c89..00000000
--- a/finetune/scripts/run_27b_v3.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# 27B v3: keep v2's Blender strength but restore CadQuery volume (45M tok) — can one model top both 3DCodeBench and CadQuery?
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-GPUS_USE=$(scripts/free_gpus.sh); NGPU=$(echo "$GPUS_USE" | awk -F, '{print NF}')
-echo "[27bv3] using GPUs $GPUS_USE ($NGPU cards)"
-echo "[27bv3] $(date) train"
-GPUS=$GPUS_USE scripts/lf_train.sh configs/lf/lora_27b_v3.yaml > logs/train_27b_v3.log 2>&1
-RUN=runs/lf_qwen38_27b_lora_v3
-[ -f $RUN/train_results.json ] || { echo "[27bv3] TRAIN FAILED"; exit 1; }
-echo "[27bv3] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-160)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_27b_v3.yaml
-scripts/lf_export.sh configs/lf/export_27b_v3.yaml > logs/export_27b_v3.log 2>&1 || { echo "[27bv3] EXPORT FAILED"; exit 1; }
-GPUS=$GPUS_USE TP=$NGPU eval/eval_all_run2.sh $RUN/merged q27b_v3 --max_new 8192 2>&1 | grep -E "gen-multi|status counts|dialect|DONE" | tail -20
-GPUS=$GPUS_USE TP=$NGPU eval/eval_all_run2.sh $RUN/merged q27b_v3_T07 --temp 0.7 --seed 1 --max_new 8192 --suites openscad glsl 2>&1 | grep -E "dialect|DONE" | tail -4
-echo "[27bv3] ALL DONE"
diff --git a/finetune/scripts/run_27b_v4.sh b/finetune/scripts/run_27b_v4.sh
deleted file mode 100755
index 4c9db177..00000000
--- a/finetune/scripts/run_27b_v4.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash
-# 27B v4: v2's winning blender-heavy core + CadQuery raised 33k -> 105k unique samples (one caption each).
-# Question: can a single 27B top both 3DCodeBench (v2: 93.4%) and CadQuery (9B md_xl: 97.5%)?
-#
-# 27B LoRA on 80 GB cards sits right at the memory edge — the identical recipe that trained v2 OOMs on other
-# days. So instead of guessing, try a ladder of settings (keeping lora_rank 64, the quality-relevant knob;
-# every sample in this mix is <=3400 tokens, so a smaller cutoff truncates nothing) and take the first that
-# survives 4 real steps.
-set -uo pipefail
-cd /wekafs/ict/hx_624/llm-ft
-GPUS_USE=$(scripts/free_gpus.sh); NGPU=$(echo "$GPUS_USE" | awk -F, '{print NF}')
-[ -z "$GPUS_USE" ] && { echo "[27bv4] no free GPUs"; exit 1; }
-RUN=runs/lf_qwen38_27b_lora_v4
-
-WIN=""
-for SPEC in "3584 5 adamw_torch" "3072 6 adamw_torch" "3072 6 adamw_8bit" "2560 8 adamw_8bit"; do
- set -- $SPEC; CUT=$1; ACC=$2; OPT=$3
- echo "[27bv4] $(date) probing cutoff=$CUT accum=$ACC optim=$OPT"
- EXTRA=""; [ "$OPT" = "adamw_8bit" ] && EXTRA="optim=adamw_8bit"
- GPUS=$GPUS_USE scripts/lf_train.sh configs/lf/lora_27b_v4.yaml max_steps=4 save_steps=100000 eval_steps=100000 \
- cutoff_len=$CUT gradient_accumulation_steps=$ACC $EXTRA \
- tokenized_path=/wekafs/ict/hx_624/llm-ft/data/lf/tok_v4_$CUT \
- output_dir=/wekafs/ict/hx_624/llm-ft/runs/_probe_v4 > logs/probe_v4_$CUT$OPT.log 2>&1
- rm -rf runs/_probe_v4
- if grep -q "train_runtime" logs/probe_v4_$CUT$OPT.log; then
- S=$(grep -oE "[0-9]/4 \[[0-9:]+<[0-9:]+, *[0-9.]+s/it" logs/probe_v4_$CUT$OPT.log | tail -1)
- echo "[27bv4] OK at cutoff=$CUT accum=$ACC optim=$OPT ($S)"; WIN="$CUT $ACC $OPT"; break
- fi
- ERR=$(grep -oE "torch.OutOfMemoryError[^\"]*|Triton Error \[CUDA\]: out of memory|RuntimeError: [^\"]{0,120}" logs/probe_v4_$CUT$OPT.log | tail -1)
- echo "[27bv4] FAILED at cutoff=$CUT accum=$ACC optim=$OPT -> ${ERR:-unknown error, see logs/probe_v4_$CUT$OPT.log}"
- case "$ERR" in *"Triton >= 3.4"*|*"tilelang"*) echo "[27bv4] ABORT: the lf env's triton was downgraded (Hopper needs 3.7.1) — fix the env, not the config"; exit 2;; esac
-done
-[ -z "$WIN" ] && { echo "[27bv4] every setting OOMed — needs more GPUs or a sharded optimizer"; exit 1; }
-set -- $WIN; CUT=$1; ACC=$2; OPT=$3
-EXTRA=""; [ "$OPT" = "adamw_8bit" ] && EXTRA="optim=adamw_8bit"
-
-echo "[27bv4] $(date) train (172.6k pairs / 114M tok, cutoff=$CUT accum=$ACC optim=$OPT, GPUs $GPUS_USE)"
-GPUS=$GPUS_USE scripts/lf_train.sh configs/lf/lora_27b_v4.yaml cutoff_len=$CUT gradient_accumulation_steps=$ACC $EXTRA \
- tokenized_path=/wekafs/ict/hx_624/llm-ft/data/lf/tok_v4_$CUT > logs/train_27b_v4.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[27bv4] TRAIN FAILED: $(grep -E 'out of memory|Error' logs/train_27b_v4.log | grep -v errors | tail -1 | cut -c1-160)"; exit 1; }
-echo "[27bv4] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-160)"
-
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B|" \
- -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" \
- -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_27b_v4.yaml
-scripts/lf_export.sh configs/lf/export_27b_v4.yaml > logs/export_27b_v4.log 2>&1 || { echo "[27bv4] EXPORT FAILED"; exit 1; }
-echo "[27bv4] $(date) eval greedy"
-GPUS=$GPUS_USE TP=2 eval/eval_all_run2.sh $RUN/merged q27b_v4 --max_new 8192 2>&1 | grep -E "gen-multi|status counts|dialect|DONE" | tail -20
-echo "[27bv4] $(date) eval sampled (openscad/glsl)"
-GPUS=$GPUS_USE TP=2 eval/eval_all_run2.sh $RUN/merged q27b_v4_T07 --temp 0.7 --seed 1 --max_new 8192 --suites openscad glsl 2>&1 | grep -E "dialect|DONE" | tail -4
-echo "[27bv4] ALL DONE"
diff --git a/finetune/scripts/run_27b_v5.sh b/finetune/scripts/run_27b_v5.sh
deleted file mode 100755
index 46e0feff..00000000
--- a/finetune/scripts/run_27b_v5.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash
-# 27B v4: v2's winning blender-heavy core + CadQuery raised 33k -> 105k unique samples (one caption each).
-# Question: can a single 27B top both 3DCodeBench (v2: 93.4%) and CadQuery (9B md_xl: 97.5%)?
-#
-# 27B LoRA on 80 GB cards sits right at the memory edge — the identical recipe that trained v2 OOMs on other
-# days. So instead of guessing, try a ladder of settings (keeping lora_rank 64, the quality-relevant knob;
-# every sample in this mix is <=3400 tokens, so a smaller cutoff truncates nothing) and take the first that
-# survives 4 real steps.
-set -uo pipefail
-cd /wekafs/ict/hx_624/llm-ft
-GPUS_USE=$(scripts/free_gpus.sh); NGPU=$(echo "$GPUS_USE" | awk -F, '{print NF}')
-[ -z "$GPUS_USE" ] && { echo "[27bv5] no free GPUs"; exit 1; }
-RUN=runs/lf_qwen38_27b_lora_v5
-
-WIN=""
-for SPEC in "3584 5 adamw_torch" "3072 6 adamw_torch" "3072 6 adamw_8bit" "2560 8 adamw_8bit"; do
- set -- $SPEC; CUT=$1; ACC=$2; OPT=$3
- echo "[27bv5] $(date) probing cutoff=$CUT accum=$ACC optim=$OPT"
- EXTRA=""; [ "$OPT" = "adamw_8bit" ] && EXTRA="optim=adamw_8bit"
- GPUS=$GPUS_USE scripts/lf_train.sh configs/lf/lora_27b_v5.yaml max_steps=4 save_steps=100000 eval_steps=100000 \
- cutoff_len=$CUT gradient_accumulation_steps=$ACC $EXTRA \
- tokenized_path=/wekafs/ict/hx_624/llm-ft/data/lf/tok_v5_$CUT \
- output_dir=/wekafs/ict/hx_624/llm-ft/runs/_probe_v4 > logs/probe_v4_$CUT$OPT.log 2>&1
- rm -rf runs/_probe_v4
- if grep -q "train_runtime" logs/probe_v4_$CUT$OPT.log; then
- S=$(grep -oE "[0-9]/4 \[[0-9:]+<[0-9:]+, *[0-9.]+s/it" logs/probe_v4_$CUT$OPT.log | tail -1)
- echo "[27bv5] OK at cutoff=$CUT accum=$ACC optim=$OPT ($S)"; WIN="$CUT $ACC $OPT"; break
- fi
- ERR=$(grep -oE "torch.OutOfMemoryError[^\"]*|Triton Error \[CUDA\]: out of memory|RuntimeError: [^\"]{0,120}" logs/probe_v4_$CUT$OPT.log | tail -1)
- echo "[27bv5] FAILED at cutoff=$CUT accum=$ACC optim=$OPT -> ${ERR:-unknown error, see logs/probe_v4_$CUT$OPT.log}"
- case "$ERR" in *"Triton >= 3.4"*|*"tilelang"*) echo "[27bv5] ABORT: the lf env's triton was downgraded (Hopper needs 3.7.1) — fix the env, not the config"; exit 2;; esac
-done
-[ -z "$WIN" ] && { echo "[27bv5] every setting OOMed — needs more GPUs or a sharded optimizer"; exit 1; }
-set -- $WIN; CUT=$1; ACC=$2; OPT=$3
-EXTRA=""; [ "$OPT" = "adamw_8bit" ] && EXTRA="optim=adamw_8bit"
-
-echo "[27bv5] $(date) train (183k pairs / 130M tok, cutoff=$CUT accum=$ACC optim=$OPT, GPUs $GPUS_USE)"
-GPUS=$GPUS_USE scripts/lf_train.sh configs/lf/lora_27b_v5.yaml cutoff_len=$CUT gradient_accumulation_steps=$ACC $EXTRA \
- tokenized_path=/wekafs/ict/hx_624/llm-ft/data/lf/tok_v5_$CUT > logs/train_27b_v4.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[27bv5] TRAIN FAILED: $(grep -E 'out of memory|Error' logs/train_27b_v4.log | grep -v errors | tail -1 | cut -c1-160)"; exit 1; }
-echo "[27bv5] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-160)"
-
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.8-27B|" \
- -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" \
- -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_27b_v5.yaml
-scripts/lf_export.sh configs/lf/export_27b_v5.yaml > logs/export_27b_v5.log 2>&1 || { echo "[27bv5] EXPORT FAILED"; exit 1; }
-echo "[27bv5] $(date) eval greedy"
-GPUS=$GPUS_USE TP=2 eval/eval_all_run2.sh $RUN/merged q27b_v5 --max_new 8192 2>&1 | grep -E "gen-multi|status counts|dialect|DONE" | tail -20
-echo "[27bv5] $(date) eval sampled (openscad/glsl)"
-GPUS=$GPUS_USE TP=2 eval/eval_all_run2.sh $RUN/merged q27b_v5_T07 --temp 0.7 --seed 1 --max_new 8192 --suites openscad glsl 2>&1 | grep -E "dialect|DONE" | tail -4
-echo "[27bv5] ALL DONE"
diff --git a/finetune/scripts/run_3dcb_pairs.sh b/finetune/scripts/run_3dcb_pairs.sh
deleted file mode 100755
index 44ff4e69..00000000
--- a/finetune/scripts/run_3dcb_pairs.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-# Build text->code, image->code and image+text->code for every 3DCodeBench subdirectory.
-# Renders come from a sequential scan of each tar, NOT from metadata's byte offsets: for instances_geo only 577
-# of 1,953 offsets point at a real tar header (the archives were repacked after the metadata was written), and
-# trusting them silently cost 70% of the image pairs.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate llmft
-OUT=/wekafs/ict/hx_624/hf_pairs
-for SUB in instances_tex instances_geo_full instances_tex_full; do
- # "the folder exists" is not the same as "it was built correctly": instances_tex was skipped by that test
- # while holding the 578-of-1,951 image pairs the broken byte offsets produced. Require the img rows to match
- # the source count before treating a subdir as done.
- Q="$OUT/${SUB}_llamafactory_img/qc.json"
- if [ -f "$Q" ] && python3 -c "import json,sys; q=json.load(open('$Q')); sys.exit(0 if q['rows'] >= 0.95*q['source_samples'] else 1)"; then
- echo "[3dcb] $SUB already built with full render coverage — skipping"; continue
- fi
- M=/wekafs/ict/hx_624/data/3dcodeverse_meta/3dcodebench/$SUB/metadata.parquet
- if [ ! -f "$M" ]; then
- echo "[3dcb] fetching metadata for $SUB"
- python - "$SUB" <<'PY'
-import os, sys, shutil
-from huggingface_hub import hf_hub_download
-sub = sys.argv[1]
-p = hf_hub_download("ilabai/3dcodeverse", f"3dcodebench/{sub}/metadata.parquet", repo_type="dataset", token=os.environ["HF_TOKEN"])
-d = f"/wekafs/ict/hx_624/data/3dcodeverse_meta/3dcodebench/{sub}"
-os.makedirs(d, exist_ok=True); shutil.copy(p, f"{d}/metadata.parquet")
-PY
- fi
- echo "[3dcb] $(date) building $SUB"
- python scripts/build_pairs_3dcodebench.py --subdir 3dcodebench/$SUB --out $OUT --workers 16 --views 4 2>&1 | tail -6
-done
-echo "[3dcb] ALL DONE"
diff --git a/finetune/scripts/run_9b_balanced.sh b/finetune/scripts/run_9b_balanced.sh
deleted file mode 100755
index 01153280..00000000
--- a/finetune/scripts/run_9b_balanced.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/bash
-# Fine-tuning has been destroying two of the six dialects: the base 9B scores 46% on OpenSCAD and 77.5% on
-# three.js without thinking, and every fine-tune so far lands at 2-6% and 32-52%. The training mix is why they
-# were suspected -- OpenSCAD is 0.6% of it and three.js 0.2%, against CadQuery's 53.6% -- but every mix tried so
-# far, large or small, gave the same 2-6%. So this runs the same balanced data at two learning rates: if only the
-# ratio mattered, both recover; if drift from the base is what breaks them, only the low rate does.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-for TAG in lr1e4 lr3e5; do
- RUN=runs/lf_qwen35_9b_bal_$TAG
- G=""; for _ in $(seq 1 90); do G=${GPUS:-$(scripts/free_gpus.sh)}; [ -n "$G" ] && break; sleep 60; done
- [ -z "$G" ] && { echo "[bal-$TAG] skipped: no GPU with room after 90 min"; continue; }
- echo "[bal-$TAG] $(date) train on GPUs $G"
- GPUS=$G scripts/lf_train.sh configs/lf/lora_9b_bal_$TAG.yaml > logs/train_bal_$TAG.log 2>&1
- [ -f $RUN/train_results.json ] || { echo "[bal-$TAG] TRAIN FAILED: $(grep -iE 'out of memory|Error|Traceback' logs/train_bal_$TAG.log | grep -v errors | tail -1 | cut -c1-190)"; continue; }
- echo "[bal-$TAG] train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-130)"
- sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_bal_$TAG.yaml
- scripts/lf_export.sh configs/lf/export_bal_$TAG.yaml > logs/export_bal_$TAG.log 2>&1 || { echo "[bal-$TAG] EXPORT FAILED"; continue; }
- G1=""; for _ in $(seq 1 60); do G1=$(scripts/free_gpus.sh 40000 | cut -d, -f1); [ -n "$G1" ] && break; sleep 30; done
- [ -z "$G1" ] && { echo "[bal-$TAG] eval skipped: no GPU with 40 GB free"; continue; }
- echo "[bal-$TAG] $(date) six suites on GPU $G1"
- # all six, because the point of this run is what happens to the dialects the earlier ones broke
- GPUS=$G1 TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_bal_${TAG}_all 2>&1 | tail -12
- echo "[bal-$TAG] DONE"
-done
-python - <<'PY'
-import json, os
-suites = ["bench", "blender", "cadquery", "openscad", "glsl", "threejs"]
-names = [("base (no-think)", "q9b_nothink"), ("mmmix2", "q9b_mmmix2_all"),
- ("balanced lr1e-4", "q9b_bal_lr1e4_all"), ("balanced lr3e-5", "q9b_bal_lr3e5_all")]
-print(f" {'model':18s}" + "".join(f"{s[:8]:>9s}" for s in suites))
-for label, n in names:
- p = f"eval/out/{n}_report.json"
- if not os.path.exists(p):
- print(f" {label:18s} (no report)"); continue
- d = {s["suite"]: s["exec_rate"] * 100 for s in json.load(open(p))["suites"]}
- print(f" {label:18s}" + "".join(f"{d[s]:9.1f}" if s in d else f"{'-':>9s}" for s in suites))
-PY
-echo "[bal] ALL DONE"
diff --git a/finetune/scripts/run_9b_clean.sh b/finetune/scripts/run_9b_clean.sh
deleted file mode 100755
index 06eeb13d..00000000
--- a/finetune/scripts/run_9b_clean.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# 9B on the cleaned corpus: compile-verified GLSL (flattened, Common merged), recovered URDF (7th dialect),
-# deduped per-subdir data, one caption per sample, plus the execution-verified bootstrapped Blender set.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-G=$(scripts/free_gpus.sh); N=$(echo "$G" | awk -F, '{print NF}')
-echo "[9bclean] $(date) train on GPUs $G (191.9k pairs / 177M tok, 7 dialects)"
-GPUS=$G scripts/lf_train.sh configs/lf/lora_9b_clean.yaml > logs/train_9b_clean.log 2>&1
-RUN=runs/lf_qwen35_9b_lora_clean
-[ -f $RUN/train_results.json ] || { echo "[9bclean] TRAIN FAILED: $(grep -E 'out of memory|Error' logs/train_9b_clean.log | grep -v errors | tail -1 | cut -c1-160)"; exit 1; }
-echo "[9bclean] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-160)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_9b_clean.yaml
-scripts/lf_export.sh configs/lf/export_9b_clean.yaml > logs/export_9b_clean.log 2>&1 || { echo "[9bclean] EXPORT FAILED"; exit 1; }
-GPUS=0 TP=1 eval/eval_all_run2.sh $RUN/merged q9b_clean --max_new 8192 2>&1 | grep -E "gen-multi|status counts|dialect|DONE" | tail -20
-GPUS=1 TP=1 eval/eval_all_run2.sh $RUN/merged q9b_clean_T07 --temp 0.7 --seed 1 --max_new 8192 --suites openscad glsl 2>&1 | grep -E "dialect|DONE" | tail -4
-echo "[9bclean] ALL DONE"
diff --git a/finetune/scripts/run_9b_full_dgx01.sh b/finetune/scripts/run_9b_full_dgx01.sh
deleted file mode 100755
index 10d78de6..00000000
--- a/finetune/scripts/run_9b_full_dgx01.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-# The proper 9B run, on the seven empty cards of dgx01 (dgx03 has every card shared and has been the source of
-# most of the OOMs). Recipe = mmmix2's, which is the best SFT so far, with 34% more distinct code: every dialect,
-# one caption per sample (caption augmentation is already known not to add anything), plus the image sets.
-# Scored under BOTH decodings, because greedy alone is what hid the runaway problem for the whole project.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-RUN=runs/lf_qwen35_9b_full
-GPUS_USE=${GPUS:-0,1,2,3,4,5,7}
-echo "[full9b] $(date) train on dgx01 GPUs $GPUS_USE"
-GPUS=$GPUS_USE scripts/lf_train.sh configs/lf/lora_9b_full.yaml > logs/train_9b_full.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[full9b] TRAIN FAILED: $(grep -iE 'out of memory|Error|Traceback' logs/train_9b_full.log | grep -v errors | tail -1 | cut -c1-190)"; exit 1; }
-echo "[full9b] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-150)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_9b_full.yaml
-scripts/lf_export.sh configs/lf/export_9b_full.yaml > logs/export_9b_full.log 2>&1 || { echo "[full9b] EXPORT FAILED"; exit 1; }
-echo "[full9b] $(date) exported"
-G1=$(echo $GPUS_USE | cut -d, -f1)
-GPUS=$G1 TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_full_greedy 2>&1 | tail -10
-GPUS=$G1 TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_full_t07 --temp 0.7 --seed 1 2>&1 | tail -10
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate llmft
-python - <<'PY'
-import json, os
-suites = ["bench", "blender", "cadquery", "openscad", "glsl", "threejs"]
-sets = [("mmmix2 greedy", "q9b_mmmix2_all"), ("mmmix2 T=0.7", "q9b_mmmix2_t07"),
- ("full9b greedy", "q9b_full_greedy"), ("full9b T=0.7", "q9b_full_t07")]
-for title, key in (("exec rate", "exec_rate"), ("mean output tokens", "mean_new_tokens")):
- print(f" --- {title} ---")
- print(f" {'model':16s}" + "".join(f"{s[:8]:>10s}" for s in suites))
- for label, n in sets:
- p = f"eval/out/{n}_report.json"
- if not os.path.exists(p): print(f" {label:16s} (missing)"); continue
- d = {x["suite"]: x for x in json.load(open(p))["suites"]}
- if key == "exec_rate":
- print(f" {label:16s}" + "".join(f"{d[s][key]*100:9.1f}%" if s in d else f"{'-':>10s}" for s in suites))
- else:
- print(f" {label:16s}" + "".join(f"{d[s].get(key,0):10,.0f}" if s in d else f"{'-':>10s}" for s in suites))
-PY
-echo "[full9b] ALL DONE"
diff --git a/finetune/scripts/run_9b_full_resume.sh b/finetune/scripts/run_9b_full_resume.sh
deleted file mode 100755
index 05523fd5..00000000
--- a/finetune/scripts/run_9b_full_resume.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-# Continue the 271k-sample 9B from checkpoint-4200 after dgx01 had to be given back. Four cards instead of seven,
-# with accumulation raised 4 -> 7 so samples-per-step stays 28 and the resumed step count still means the same
-# thing. Scored under both decodings, per section 13.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-RUN=runs/lf_qwen35_9b_full
-G=${GPUS:-$(scripts/free_gpus.sh 60000)}
-[ -z "$G" ] && { echo "[full9b] no cards with 60 GB free"; exit 1; }
-echo "[full9b] $(date) resuming from checkpoint-4200 on GPUs $G"
-GPUS=$G scripts/lf_train.sh configs/lf/lora_9b_full_resume.yaml > logs/train_9b_full_resume.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[full9b] TRAIN FAILED: $(grep -iE 'out of memory|Error|Traceback' logs/train_9b_full_resume.log | grep -v errors | tail -1 | cut -c1-190)"; exit 1; }
-echo "[full9b] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-150)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_9b_full.yaml
-scripts/lf_export.sh configs/lf/export_9b_full.yaml > logs/export_9b_full.log 2>&1 || { echo "[full9b] EXPORT FAILED"; exit 1; }
-G1=$(echo $G | cut -d, -f1)
-GPUS=$G1 TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_full_greedy 2>&1 | tail -9
-GPUS=$G1 TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_full_t07 --temp 0.7 --seed 1 2>&1 | tail -9
-echo "[full9b] ALL DONE"
diff --git a/finetune/scripts/run_9b_img.sh b/finetune/scripts/run_9b_img.sh
deleted file mode 100755
index b3a4f59e..00000000
--- a/finetune/scripts/run_9b_img.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-# Image-conditioned pilot: render -> code. The qwen3_5 template already carries the qwen3_vl multimodal plugin,
-# so this is the first run in the project that feeds the model what a caption cannot express — the target's shape.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-G=$(scripts/free_gpus.sh); N=$(echo "$G" | awk -F, '{print NF}')
-echo "[9bimg] $(date) smoke on GPUs $G"
-GPUS=$G scripts/lf_train.sh configs/lf/lora_9b_img.yaml max_steps=6 save_steps=100000 eval_steps=100000 \
- output_dir=/wekafs/ict/hx_624/llm-ft/runs/_smoke_img > logs/smoke_img.log 2>&1
-if ! grep -q train_runtime logs/smoke_img.log; then
- echo "[9bimg] SMOKE FAILED: $(grep -iE 'error|Traceback' logs/smoke_img.log | grep -v errors | tail -2 | head -1 | cut -c1-200)"; exit 1
-fi
-rm -rf runs/_smoke_img; echo "[9bimg] smoke ok: $(grep -oE "'train_runtime': [0-9.]+" logs/smoke_img.log | tail -1)"
-echo "[9bimg] $(date) train (7,997 render->code samples, 2 epochs)"
-GPUS=$G scripts/lf_train.sh configs/lf/lora_9b_img.yaml > logs/train_9b_img.log 2>&1
-RUN=runs/lf_qwen35_9b_img
-[ -f $RUN/train_results.json ] || { echo "[9bimg] TRAIN FAILED: $(grep -iE 'out of memory|error' logs/train_9b_img.log | grep -v errors | tail -1 | cut -c1-180)"; exit 1; }
-echo "[9bimg] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-160)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_9b_img.yaml
-scripts/lf_export.sh configs/lf/export_9b_img.yaml > logs/export_9b_img.log 2>&1 || { echo "[9bimg] EXPORT FAILED"; exit 1; }
-echo "[9bimg] ALL DONE"
diff --git a/finetune/scripts/run_9b_img4.sh b/finetune/scripts/run_9b_img4.sh
deleted file mode 100755
index 4a551eea..00000000
--- a/finetune/scripts/run_9b_img4.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-# Image-conditioned pilot: render -> code. The qwen3_5 template already carries the qwen3_vl multimodal plugin,
-# so this is the first run in the project that feeds the model what a caption cannot express — the target's shape.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-G=$(scripts/free_gpus.sh); N=$(echo "$G" | awk -F, '{print NF}')
-echo "[9bimg4] $(date) smoke on GPUs $G"
-GPUS=$G scripts/lf_train.sh configs/lf/lora_9b_img4.yaml max_steps=6 save_steps=100000 eval_steps=100000 \
- output_dir=/wekafs/ict/hx_624/llm-ft/runs/_smoke_img44 > logs/smoke_img4.log 2>&1
-if ! grep -q train_runtime logs/smoke_img4.log; then
- echo "[9bimg4] SMOKE FAILED: $(grep -iE 'error|Traceback' logs/smoke_img4.log | grep -v errors | tail -2 | head -1 | cut -c1-200)"; exit 1
-fi
-rm -rf runs/_smoke_img44; echo "[9bimg4] smoke ok: $(grep -oE "'train_runtime': [0-9.]+" logs/smoke_img4.log | tail -1)"
-echo "[9bimg4] $(date) train (7,997 4-view render->code samples, 2 epochs)"
-GPUS=$G scripts/lf_train.sh configs/lf/lora_9b_img4.yaml > logs/train_9b_img4.log 2>&1
-RUN=runs/lf_qwen35_9b_img4
-[ -f $RUN/train_results.json ] || { echo "[9bimg4] TRAIN FAILED: $(grep -iE 'out of memory|error' logs/train_9b_img4.log | grep -v errors | tail -1 | cut -c1-180)"; exit 1; }
-echo "[9bimg4] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-160)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_9b_img4.yaml
-scripts/lf_export.sh configs/lf/export_9b_img4.yaml > logs/export_9b_img4.log 2>&1 || { echo "[9bimg4] EXPORT FAILED"; exit 1; }
-echo "[9bimg4] ALL DONE"
diff --git a/finetune/scripts/run_9b_imgmix.sh b/finetune/scripts/run_9b_imgmix.sh
deleted file mode 100755
index 51fd3729..00000000
--- a/finetune/scripts/run_9b_imgmix.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-# Image-conditioned pilot: render -> code. The qwen3_5 template already carries the qwen3_vl multimodal plugin,
-# so this is the first run in the project that feeds the model what a caption cannot express — the target's shape.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-G=$(scripts/free_gpus.sh); N=$(echo "$G" | awk -F, '{print NF}')
-echo "[9bimgmix] $(date) smoke on GPUs $G"
-GPUS=$G scripts/lf_train.sh configs/lf/lora_9b_imgmix.yaml max_steps=6 save_steps=100000 eval_steps=100000 \
- output_dir=/wekafs/ict/hx_624/llm-ft/runs/_smoke_imgmix4 > logs/smoke_imgmix.log 2>&1
-if ! grep -q train_runtime logs/smoke_imgmix.log; then
- echo "[9bimgmix] SMOKE FAILED: $(grep -iE 'error|Traceback' logs/smoke_imgmix.log | grep -v errors | tail -2 | head -1 | cut -c1-200)"; exit 1
-fi
-rm -rf runs/_smoke_imgmix4; echo "[9bimgmix] smoke ok: $(grep -oE "'train_runtime': [0-9.]+" logs/smoke_imgmix.log | tail -1)"
-echo "[9bimgmix] $(date) train (7,997 4-view render->code samples, 2 epochs)"
-GPUS=$G scripts/lf_train.sh configs/lf/lora_9b_imgmix.yaml > logs/train_9b_imgmix.log 2>&1
-RUN=runs/lf_qwen35_9b_imgmix
-[ -f $RUN/train_results.json ] || { echo "[9bimgmix] TRAIN FAILED: $(grep -iE 'out of memory|error' logs/train_9b_imgmix.log | grep -v errors | tail -1 | cut -c1-180)"; exit 1; }
-echo "[9bimgmix] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-160)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_9b_imgmix.yaml
-scripts/lf_export.sh configs/lf/export_9b_imgmix.yaml > logs/export_9b_imgmix.log 2>&1 || { echo "[9bimgmix] EXPORT FAILED"; exit 1; }
-echo "[9bimgmix] ALL DONE"
diff --git a/finetune/scripts/run_9b_mm1.sh b/finetune/scripts/run_9b_mm1.sh
deleted file mode 100755
index 5bf6e1df..00000000
--- a/finetune/scripts/run_9b_mm1.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-# 12.8 found one reference view beats four at INFERENCE (64.6% vs 47.6%) on weights trained with four views.
-# Does it also hold when the model is TRAINED on one view? Same samples, same split, same everything but the
-# number of renders per sample -- so the comparison against mm_img_text (48.6%) is clean.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-V=mm1_img_text; RUN=runs/lf_qwen35_9b_$V
-G=""; for _ in $(seq 1 60); do G=${GPUS:-$(scripts/free_gpus.sh)}; [ -n "$G" ] && break; sleep 60; done
-[ -z "$G" ] && { echo "[$V] skipped: no GPU with room after 60 min"; exit 0; }
-echo "[$V] $(date) train on GPUs $G"
-GPUS=$G scripts/lf_train.sh configs/lf/lora_9b_$V.yaml > logs/train_9b_$V.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[$V] TRAIN FAILED: $(grep -iE 'out of memory|Error|Traceback' logs/train_9b_$V.log | grep -v errors | tail -1 | cut -c1-190)"; exit 0; }
-echo "[$V] train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-130)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_9b_$V.yaml
-scripts/lf_export.sh configs/lf/export_9b_$V.yaml > logs/export_9b_$V.log 2>&1 || { echo "[$V] EXPORT FAILED"; exit 0; }
-G1=""; for _ in $(seq 1 40); do G1=$(scripts/free_gpus.sh 40000 | cut -d, -f1); [ -n "$G1" ] && break; sleep 30; done
-[ -z "$G1" ] && { echo "[$V] eval skipped: no GPU with 40 GB free"; exit 0; }
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$G1
-OUT=eval/out/q9b_mm1_img_text_bench; mkdir -p $OUT
-# the SAME prompts and the SAME budget mm_img_text was scored with, so 12.7's cross-harness floor does not apply
-python eval/generate_vllm_img.py --model $RUN/merged --prompts eval/out/_img4text_bench_prompts.jsonl --out $OUT \
- --max_new_tokens 32768 --max_model_len 40960 2>&1 | tail -1
-N=$(ls $OUT | grep -vc extract_stats.json || true)
-[ "${N:-0}" -lt 5 ] && { echo "[$V] GENERATION PRODUCED NOTHING — not scoring"; exit 0; }
-conda activate llmft
-python eval/run_bench.py --gen_dir $OUT --workers 24 --timeout 300 2>&1 | grep "status counts" | tail -1
-python - "$OUT" <<'PY'
-import json, sys
-r=[json.loads(l) for l in open(f"{sys.argv[1]}/gens_shard0.jsonl")]
-print(f"[mm1] unfinished={sum(1 for x in r if not x.get('finished',True))}/{len(r)} mean_tok={sum(x.get('n_new_tokens',0) for x in r)/len(r):.0f}")
-PY
-echo "[$V] DONE"
diff --git a/finetune/scripts/run_9b_mmmix2.sh b/finetune/scripts/run_9b_mmmix2.sh
deleted file mode 100755
index fcc82eff..00000000
--- a/finetune/scripts/run_9b_mmmix2.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-# Image-conditioned pilot: render -> code. The qwen3_5 template already carries the qwen3_vl multimodal plugin,
-# so this is the first run in the project that feeds the model what a caption cannot express — the target's shape.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-G=${GPUS:-$(scripts/free_gpus.sh)}; N=$(echo "$G" | awk -F, '{print NF}')
-echo "[9bmmmix2] $(date) smoke on GPUs $G"
-GPUS=$G scripts/lf_train.sh configs/lf/lora_9b_mmmix2.yaml max_steps=6 save_steps=100000 eval_steps=100000 \
- output_dir=/wekafs/ict/hx_624/llm-ft/runs/_smoke_mmmix24 > logs/smoke_mmmix2.log 2>&1
-if ! grep -q train_runtime logs/smoke_mmmix2.log; then
- echo "[9bmmmix2] SMOKE FAILED: $(grep -iE 'error|Traceback' logs/smoke_mmmix2.log | grep -v errors | tail -2 | head -1 | cut -c1-200)"; exit 1
-fi
-rm -rf runs/_smoke_mmmix24; echo "[9bmmmix2] smoke ok: $(grep -oE "'train_runtime': [0-9.]+" logs/smoke_mmmix2.log | tail -1)"
-echo "[9bmmmix2] $(date) train (7,997 4-view render->code samples, 2 epochs)"
-GPUS=$G scripts/lf_train.sh configs/lf/lora_9b_mmmix2.yaml > logs/train_9b_mmmix2.log 2>&1
-RUN=runs/lf_qwen35_9b_mmmix2
-[ -f $RUN/train_results.json ] || { echo "[9bmmmix2] TRAIN FAILED: $(grep -iE 'out of memory|error' logs/train_9b_mmmix2.log | grep -v errors | tail -1 | cut -c1-180)"; exit 1; }
-echo "[9bmmmix2] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-160)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_9b_mmmix2.yaml
-scripts/lf_export.sh configs/lf/export_9b_mmmix2.yaml > logs/export_9b_mmmix2.log 2>&1 || { echo "[9bmmmix2] EXPORT FAILED"; exit 1; }
-echo "[9bmmmix2] ALL DONE"
diff --git a/finetune/scripts/run_9b_mmvis.sh b/finetune/scripts/run_9b_mmvis.sh
deleted file mode 100755
index 0a63522a..00000000
--- a/finetune/scripts/run_9b_mmvis.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-# Image-conditioned pilot: render -> code. The qwen3_5 template already carries the qwen3_vl multimodal plugin,
-# so this is the first run in the project that feeds the model what a caption cannot express — the target's shape.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-G=${GPUS:-$(scripts/free_gpus.sh)}; N=$(echo "$G" | awk -F, '{print NF}')
-echo "[9bmmvis] $(date) smoke on GPUs $G"
-GPUS=$G scripts/lf_train.sh configs/lf/lora_9b_mmvis.yaml max_steps=6 save_steps=100000 eval_steps=100000 \
- output_dir=/wekafs/ict/hx_624/llm-ft/runs/_smoke_mmvis4 > logs/smoke_mmvis.log 2>&1
-if ! grep -q train_runtime logs/smoke_mmvis.log; then
- echo "[9bmmvis] SMOKE FAILED: $(grep -iE 'error|Traceback' logs/smoke_mmvis.log | grep -v errors | tail -2 | head -1 | cut -c1-200)"; exit 1
-fi
-rm -rf runs/_smoke_mmvis4; echo "[9bmmvis] smoke ok: $(grep -oE "'train_runtime': [0-9.]+" logs/smoke_mmvis.log | tail -1)"
-echo "[9bmmvis] $(date) train (7,997 4-view render->code samples, 2 epochs)"
-GPUS=$G scripts/lf_train.sh configs/lf/lora_9b_mmvis.yaml > logs/train_9b_mmvis.log 2>&1
-RUN=runs/lf_qwen35_9b_mmvis
-[ -f $RUN/train_results.json ] || { echo "[9bmmvis] TRAIN FAILED: $(grep -iE 'out of memory|error' logs/train_9b_mmvis.log | grep -v errors | tail -1 | cut -c1-180)"; exit 1; }
-echo "[9bmmvis] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-160)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_9b_mmvis.yaml
-scripts/lf_export.sh configs/lf/export_9b_mmvis.yaml > logs/export_9b_mmvis.log 2>&1 || { echo "[9bmmvis] EXPORT FAILED"; exit 1; }
-echo "[9bmmvis] ALL DONE"
diff --git a/finetune/scripts/run_9b_noleak.sh b/finetune/scripts/run_9b_noleak.sh
deleted file mode 100755
index 27a51669..00000000
--- a/finetune/scripts/run_9b_noleak.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-# Leakage probe: identical to the md_9b_clean run except the 164 rows whose source is a 3DCodeBench factory.
-# Measures what that 0.09% of contamination is actually worth on the benchmark.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-G=$(scripts/free_gpus.sh)
-echo "[noleak] $(date) train on GPUs $G"
-GPUS=$G scripts/lf_train.sh configs/lf/lora_9b_noleak.yaml > logs/train_9b_noleak.log 2>&1
-RUN=runs/lf_qwen35_9b_lora_noleak
-[ -f $RUN/train_results.json ] || { echo "[noleak] TRAIN FAILED: $(grep -iE 'out of memory|error' logs/train_9b_noleak.log | grep -v errors | tail -1 | cut -c1-160)"; exit 1; }
-echo "[noleak] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-140)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_9b_noleak.yaml
-scripts/lf_export.sh configs/lf/export_9b_noleak.yaml > logs/export_9b_noleak.log 2>&1 || { echo "[noleak] EXPORT FAILED"; exit 1; }
-GPUS=0 TP=1 eval/eval_all_run2.sh $RUN/merged q9b_noleak --max_new 8192 --suites bench blender cadquery 2>&1 | grep -E "status counts|dialect|DONE" | tail -8
-echo "[noleak] ALL DONE"
diff --git a/finetune/scripts/run_9b_plus_eval.sh b/finetune/scripts/run_9b_plus_eval.sh
deleted file mode 100755
index 65210c42..00000000
--- a/finetune/scripts/run_9b_plus_eval.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-# md_9b_plus keeps every Blender sample the 93.9% model had (21,012) and adds 104k more CadQuery/GLSL.
-# The prediction it tests: bench returns to ~93%, because what decides a dialect's score is that dialect's
-# absolute sample count -- not the total, which full9b raised to 271k while cutting Blender to 6,590 and scoring 58.5%.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-RUN=runs/lf_qwen35_9b_plus
-[ -f $RUN/train_results.json ] || { echo "[plus] training did not finish"; exit 1; }
-if [ ! -d $RUN/merged ]; then
- sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_9b_plus.yaml
- scripts/lf_export.sh configs/lf/export_9b_plus.yaml > logs/export_9b_plus.log 2>&1 || { echo "[plus] EXPORT FAILED: $(grep -iE 'error' logs/export_9b_plus.log | tail -1 | cut -c1-140)"; exit 1; }
-fi
-echo "[plus] $(date) exported"
-G=""; for _ in $(seq 1 60); do G=${GPUS:-$(scripts/free_gpus.sh 40000 | cut -d, -f1)}; [ -n "$G" ] && break; sleep 30; done
-[ -z "$G" ] && { echo "[plus] no GPU with 40 GB free"; exit 1; }
-# both decodings, per the protocol the greedy-runaway finding forced
-GPUS=$G TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_plus_greedy 2>&1 | tail -10
-GPUS=$G TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_plus_t07 --temp 0.7 --seed 1 2>&1 | tail -10
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate llmft
-python - <<'PY'
-import json, os
-suites = ["bench", "blender", "cadquery", "openscad", "glsl", "threejs"]
-sets = [("mmmix2 (192k, Blender 21k)", "q9b_mmmix2_all"), ("full9b (271k, Blender 6.6k)", "q9b_full_greedy"),
- ("md_9b_plus (296k, Blender 21k)", "q9b_plus_greedy"), ("md_9b_plus T=0.7", "q9b_plus_t07")]
-print(f" {'model':32s}" + "".join(f"{s[:8]:>10s}" for s in suites))
-for label, n in sets:
- p = f"eval/out/{n}_report.json"
- if not os.path.exists(p): print(f" {label:32s} (missing)"); continue
- d = {x["suite"]: x for x in json.load(open(p))["suites"]}
- print(f" {label:32s}" + "".join(f"{d[s]['exec_rate']*100:9.1f}%" if s in d else f"{'-':>10s}" for s in suites))
-PY
-echo "[plus] DONE"
diff --git a/finetune/scripts/run_best_dual_decode.sh b/finetune/scripts/run_best_dual_decode.sh
deleted file mode 100755
index 9c790916..00000000
--- a/finetune/scripts/run_best_dual_decode.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/bash
-# Section 13 showed greedy understates every long-output dialect. The project's headline model was scored greedy
-# only, so its OpenSCAD/GLSL/three.js numbers are very likely wrong in the same direction. Re-score it under both
-# decodings so the report states what the best model can actually do, not what greedy lets it show.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-RUN=runs/lf_qwen35_9b_dpo_exec_v2
-# the DPO scripts delete their merged output to save disk, so the best model has to be rebuilt from its chain:
-# lora_v1/merged -> dpo_exec_v1/merged_r2 -> dpo_exec_v2/merged
-if [ ! -d $RUN/merged ]; then
- if [ ! -d runs/lf_qwen35_9b_dpo_exec_v1/merged_r2 ]; then
- echo "[bestdual] rebuilding dpo_exec_v1/merged_r2"
- scripts/lf_export.sh configs/lf/export_dpo_exec_v1_r2.yaml > logs/export_best_r2.log 2>&1 \
- || { echo "[bestdual] STAGE1 EXPORT FAILED: $(grep -iE 'error|OSError' logs/export_best_r2.log | tail -1 | cut -c1-160)"; exit 0; }
- fi
- echo "[bestdual] rebuilding dpo_exec_v2/merged"
- scripts/lf_export.sh configs/lf/export_dpo_exec_v2.yaml > logs/export_best_dual.log 2>&1 \
- || { echo "[bestdual] STAGE2 EXPORT FAILED: $(grep -iE 'error|OSError' logs/export_best_dual.log | tail -1 | cut -c1-160)"; exit 0; }
-fi
-G=""; for _ in $(seq 1 60); do G=${GPUS:-$(scripts/free_gpus.sh 40000 | cut -d, -f1)}; [ -n "$G" ] && break; sleep 30; done
-[ -z "$G" ] && { echo "[bestdual] no GPU with 40 GB free"; exit 0; }
-echo "[bestdual] $(date) on GPU $G"
-GPUS=$G TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_best_t07 --temp 0.7 --seed 1 2>&1 | tail -10
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate llmft
-python - <<'PY'
-import json, os
-suites = ["bench", "blender", "cadquery", "openscad", "glsl", "threejs"]
-for label, n in [("dpo_exec_v2 greedy", "qwen35_9b_dpo_exec_v2"), ("dpo_exec_v2 T=0.7", "q9b_best_t07")]:
- p = f"eval/out/{n}_report.json"
- if not os.path.exists(p):
- s = f"eval/out/{n}/summary.json"
- if os.path.exists(s):
- d = json.load(open(s)); print(f" {label:20s} bench only: {d['exec_ok']}/{d['n_tasks']} = {d['exec_ok_rate']*100:.1f}%")
- else: print(f" {label:20s} (no report)")
- continue
- d = {x["suite"]: x for x in json.load(open(p))["suites"]}
- print(f" {label:20s}" + "".join(f"{d[s]['exec_rate']*100:9.1f}%" if s in d else f"{'-':>10s}" for s in suites))
-PY
-echo "[bestdual] DONE"
diff --git a/finetune/scripts/run_decoding_dialects.sh b/finetune/scripts/run_decoding_dialects.sh
deleted file mode 100755
index 098e2561..00000000
--- a/finetune/scripts/run_decoding_dialects.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-# T=0.7 took the image-only model from 35.8% to 48.6% and cut unfinished generations from 93 to 21. Every
-# fine-tuned model's 2-6% on OpenSCAD and 32-52% on three.js was measured with GREEDY. If those collapses are the
-# same pathology, they are a decoding artifact and the training data was never the problem. Test it on the best
-# model we have before redesigning any mix.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-M=runs/lf_qwen35_9b_mmmix2/merged
-[ -d "$M" ] || { echo "[decdia] no model"; exit 0; }
-G=""; for _ in $(seq 1 60); do G=${GPUS:-$(scripts/free_gpus.sh 40000 | cut -d, -f1)}; [ -n "$G" ] && break; sleep 30; done
-[ -z "$G" ] && { echo "[decdia] no GPU with 40 GB free"; exit 0; }
-echo "[decdia] $(date) on GPU $G"
-# greedy numbers already exist as q9b_mmmix2_all; this adds the sampled counterpart, same harness, same suites
-GPUS=$G TP=1 bash eval/eval_all_run2.sh $M q9b_mmmix2_t07 --temp 0.7 --seed 1 \
- --suites openscad threejs glsl cadquery bench 2>&1 | tail -12
-python - <<'PY'
-import json, os
-suites = ["bench", "cadquery", "openscad", "glsl", "threejs"]
-g = f"eval/out/q9b_mmmix2_all_report.json"; t = f"eval/out/q9b_mmmix2_t07_report.json"
-if not (os.path.exists(g) and os.path.exists(t)):
- print("[decdia] missing a report"); raise SystemExit
-G = {s["suite"]: s for s in json.load(open(g))["suites"]}
-T = {s["suite"]: s for s in json.load(open(t))["suites"]}
-print(f" {'suite':10s} {'greedy':>8s} {'T=0.7':>8s} {'delta':>8s} {'greedy tok':>11s} {'T=0.7 tok':>10s}")
-for s in suites:
- if s not in G or s not in T: continue
- a, b = G[s]["exec_rate"] * 100, T[s]["exec_rate"] * 100
- print(f" {s:10s} {a:7.1f}% {b:7.1f}% {b-a:+7.1f}pp {G[s].get('mean_new_tokens',0):11.0f} {T[s].get('mean_new_tokens',0):10.0f}")
-PY
-echo "[decdia] DONE"
diff --git a/finetune/scripts/run_dpo_exec.sh b/finetune/scripts/run_dpo_exec.sh
deleted file mode 100755
index 4b7f69cf..00000000
--- a/finetune/scripts/run_dpo_exec.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft; GPU=${GPUS:-2,3}; NAME=dpo_exec_v1; RUN=runs/lf_qwen35_9b_$NAME
-echo "[dpo] $(date) export v1 merged"; [ -d runs/lf_qwen35_9b_lora_v1/merged ] || scripts/lf_export.sh configs/lf/export_v1.yaml > logs/export_v1_dpo.log 2>&1 || { echo "[dpo] EXPORT FAILED"; exit 1; }
-echo "[dpo] $(date) train on GPUs $GPU"; GPUS=$GPU scripts/lf_train.sh configs/lf/$NAME.yaml > logs/train_$NAME.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[dpo] TRAIN FAILED"; grep -E "Error|error" logs/train_$NAME.log | tail -5 | cut -c1-200; exit 1; }
-echo "[dpo] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_v1/merged|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_$NAME.yaml
-scripts/lf_export.sh configs/lf/export_$NAME.yaml > logs/export_$NAME.log 2>&1 || { echo "[dpo] EXPORT2 FAILED"; exit 1; }
-echo "[dpo] $(date) merged"; G1=$(echo $GPU | cut -d, -f1)
-GPUS=$G1 eval/run_eval_vllm.sh $RUN/merged eval/out/qwen35_9b_$NAME --no_think --max_new_tokens 6144 > logs/eval_$NAME.log 2>&1
-echo "[dpo] $(date) eval done"; cat eval/out/qwen35_9b_$NAME/summary.json; rm -rf $RUN/merged; echo "[dpo] DONE"
diff --git a/finetune/scripts/run_exp.sh b/finetune/scripts/run_exp.sh
deleted file mode 100755
index 042f5554..00000000
--- a/finetune/scripts/run_exp.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# run_exp.sh <GPU(s)> <NAME>: train LoRA (configs/lf/lora_<NAME>.yaml) -> merge -> vLLM generation (GPU) ; Blender exec + metrics run in the background (CPU)
-set -uo pipefail
-GPU=$1; NAME=$2
-NGPU=$(echo $GPU | tr ',' '\n' | wc -l); ACC=$((8 / NGPU))
-cd /wekafs/ict/hx_624/llm-ft
-RUN=/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_$NAME; OUT=/wekafs/ict/hx_624/llm-ft/eval/out/qwen35_9b_lora_$NAME
-echo "[exp $NAME] $(date) train on GPU(s) $GPU (grad_accum=$ACC)"
-GPUS=$GPU scripts/lf_train.sh configs/lf/lora_$NAME.yaml gradient_accumulation_steps=$ACC > logs/train_$NAME.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[exp $NAME] TRAIN FAILED"; exit 1; }
-echo "[exp $NAME] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-sed -e "s|adapter_name_or_path:.*|adapter_name_or_path: $RUN|" -e "s|export_dir:.*|export_dir: $RUN/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_$NAME.yaml
-scripts/lf_export.sh configs/lf/export_$NAME.yaml > logs/export_$NAME.log 2>&1 || { echo "[exp $NAME] EXPORT FAILED"; exit 1; }
-echo "[exp $NAME] $(date) merged"
-# --- generation on GPU (vLLM), then free the GPU
-( source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm; export HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING TOKENIZERS_PARALLELISM=false CUDA_VISIBLE_DEVICES=$GPU
- mkdir -p $OUT; python eval/generate_vllm.py --model $RUN/merged --prompts data/sft_v1/bench_prompts.jsonl --out $OUT --tp $NGPU --no_think --max_new_tokens 6144 2>&1 | grep -E "gen-vllm|Error|Traceback" | tail -5 ) > logs/eval_$NAME.log 2>&1
-cp $OUT/gens_shard0.jsonl $OUT/gens.jsonl 2>/dev/null || { echo "[exp $NAME] GEN FAILED"; cat logs/eval_$NAME.log | tail -5; exit 1; }
-echo "[exp $NAME] $(date) gen done: $(grep gen-vllm logs/eval_$NAME.log | tail -1)"
-rm -rf $RUN/merged
-# --- Blender exec + metrics in background (CPU only) so the GPU queue can continue
-nohup bash -c "source /wekafs/ict/hx_624/llm-ft/env.sh; cd /wekafs/ict/hx_624/llm-ft; python eval/run_bench.py --gen_dir $OUT --workers 32 --timeout 300 > $OUT/exec.log 2>&1; python eval/metrics.py --gen_dir $OUT > $OUT/metrics.log 2>&1; echo \"[exp $NAME] \$(date) eval done\"; cat $OUT/summary.json; echo \"[exp $NAME] DONE\"" >> logs/exp_$NAME.log 2>&1 &
-echo "[exp $NAME] exec+metrics running in background"
diff --git a/finetune/scripts/run_exp_4b.sh b/finetune/scripts/run_exp_4b.sh
deleted file mode 100755
index d925bd02..00000000
--- a/finetune/scripts/run_exp_4b.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-# like run_exp.sh but merges onto Qwen3.5-4B
-set -uo pipefail; GPU=$1; NAME=$2; cd /wekafs/ict/hx_624/llm-ft
-RUN=/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_$NAME; OUT=/wekafs/ict/hx_624/llm-ft/eval/out/qwen35_9b_lora_$NAME
-echo "[exp $NAME] $(date) train on GPU(s) $GPU"
-GPUS=$GPU scripts/lf_train.sh configs/lf/lora_$NAME.yaml > logs/train_$NAME.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[exp $NAME] TRAIN FAILED"; exit 1; }
-echo "[exp $NAME] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-4B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $RUN|" -e "s|export_dir:.*|export_dir: $RUN/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_$NAME.yaml
-scripts/lf_export.sh configs/lf/export_$NAME.yaml > logs/export_$NAME.log 2>&1 || { echo "[exp $NAME] EXPORT FAILED"; exit 1; }
-echo "[exp $NAME] $(date) merged"
-GPUS=$GPU eval/run_eval_vllm.sh $RUN/merged $OUT --no_think --max_new_tokens 6144 > logs/eval_$NAME.log 2>&1
-echo "[exp $NAME] $(date) eval done"; cat $OUT/summary.json; rm -rf $RUN/merged; echo "[exp $NAME] DONE"
diff --git a/finetune/scripts/run_exp_qwen3.sh b/finetune/scripts/run_exp_qwen3.sh
deleted file mode 100755
index 7eaf8223..00000000
--- a/finetune/scripts/run_exp_qwen3.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-# like run_exp.sh but merges onto Qwen3.5-4B
-set -uo pipefail; GPU=$1; NAME=$2; cd /wekafs/ict/hx_624/llm-ft
-RUN=/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_$NAME; OUT=/wekafs/ict/hx_624/llm-ft/eval/out/qwen35_9b_lora_$NAME
-echo "[exp $NAME] $(date) train on GPU(s) $GPU"
-GPUS=$GPU scripts/lf_train.sh configs/lf/lora_$NAME.yaml > logs/train_$NAME.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[exp $NAME] TRAIN FAILED"; exit 1; }
-echo "[exp $NAME] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3-8B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $RUN|" -e "s|export_dir:.*|export_dir: $RUN/merged|" configs/lf/export_lora_template.yaml | sed "s/^template: qwen3_5/template: qwen3/" > configs/lf/export_$NAME.yaml
-scripts/lf_export.sh configs/lf/export_$NAME.yaml > logs/export_$NAME.log 2>&1 || { echo "[exp $NAME] EXPORT FAILED"; exit 1; }
-echo "[exp $NAME] $(date) merged"
-GPUS=$GPU eval/run_eval_vllm.sh $RUN/merged $OUT --no_think --max_new_tokens 6144 > logs/eval_$NAME.log 2>&1
-echo "[exp $NAME] $(date) eval done"; cat $OUT/summary.json; rm -rf $RUN/merged; echo "[exp $NAME] DONE"
diff --git a/finetune/scripts/run_full_3gpu.sh b/finetune/scripts/run_full_3gpu.sh
deleted file mode 100755
index dad87edd..00000000
--- a/finetune/scripts/run_full_3gpu.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# wait for self-train sampling to finish (GPU0 free), stop the self-train script (its training would collide), then full FT on GPUs 0,1,3 (ZeRO-3, no offload), then eval.
-cd /wekafs/ict/hx_624/llm-ft
-until grep -q "\[self\] .*sampling done" logs/self_train_round1.log 2>/dev/null; do sleep 20; done
-for p in $(pgrep -u hx_624 -f "scripts/self_train_round.s[h]"); do kill $p; done; echo "[full3] self-train script stopped after sampling (exec/build/train to be run manually)"
-sleep 20
-until [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i 0,1,3 | sort -n | tail -1)" -lt 10000 ]; do sleep 15; done
-RUN=/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_full_v2_3gpu
-echo "[full3] $(date) start full FT on GPUs 0,1,3 (ZeRO-3 no offload, grad_accum=3)"
-GPUS=0,1,3 scripts/lf_train.sh configs/lf/qwen35_9b_full_sft_3gpu.yaml > logs/train_full_v2_3gpu.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[full3] TRAIN FAILED"; grep -E "Error|error" logs/train_full_v2_3gpu.log | tail -5 | cut -c1-200; exit 1; }
-echo "[full3] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-for f in preprocessor_config.json video_preprocessor_config.json vocab.json merges.txt; do [ -f $RUN/$f ] || cp /wekafs/ict/hx_624/models/Qwen3.5-9B/$f $RUN/; done
-GPUS=1 eval/run_eval_vllm.sh $RUN eval/out/qwen35_9b_full_v2_3gpu --no_think --max_new_tokens 6144 > logs/eval_full_v2_3gpu.log 2>&1
-echo "[full3] $(date) eval done"; cat eval/out/qwen35_9b_full_v2_3gpu/summary.json; echo FULL3_DONE
diff --git a/finetune/scripts/run_full_ft.sh b/finetune/scripts/run_full_ft.sh
deleted file mode 100755
index 8bb43da6..00000000
--- a/finetune/scripts/run_full_ft.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-# Full-parameter SFT (ZeRO-3) on GPUs 0,1,2 after all LoRA queues finish, then eval.
-cd /wekafs/ict/hx_624/llm-ft
-until grep -q "QUEUE_DONE gpu=0" logs/queue_gpu0.log 2>/dev/null && grep -q "QUEUE_DONE gpu=1" logs/queue_gpu1.log 2>/dev/null && grep -q "QUEUE_DONE gpu=2" logs/queue_gpu2.log 2>/dev/null; do sleep 60; done
-until [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i 0,1,2 | sort -n | tail -1)" -lt 10000 ]; do sleep 30; done
-RUN=/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_full_v1
-echo "[full] $(date) start full FT on GPUs 0,1,2"
-GPUS=0,1,2 scripts/lf_train.sh configs/lf/qwen35_9b_full_sft.yaml > logs/train_full_v1.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[full] TRAIN FAILED"; exit 1; }
-echo "[full] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-if [ -f eval/.vllm_ok ]; then GPUS=0 eval/run_eval_vllm.sh $RUN eval/out/qwen35_9b_full_v1 --no_think --max_new_tokens 6144 > logs/eval_full_v1.log 2>&1
-else GPUS=0,1,2 eval/run_eval.sh $RUN eval/out/qwen35_9b_full_v1 --no_think --batch_size 48 --max_new_tokens 6144 > logs/eval_full_v1.log 2>&1; fi
-echo "[full] $(date) eval done"; cat eval/out/qwen35_9b_full_v1/summary.json; echo FULL_FT_DONE
diff --git a/finetune/scripts/run_img_decoding.sh b/finetune/scripts/run_img_decoding.sh
deleted file mode 100755
index eff16e55..00000000
--- a/finetune/scripts/run_img_decoding.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-# mm_img scores 36.8% while writing 15,445 tokens per task and leaving 97 of 212 unfinished. Is that a capability
-# gap, or the same non-termination pathology the three.js LoRA had (where T=0.7 recovered 30% -> 50%)?
-# Four decoding settings on the SAME model answer it. If a decoding change alone moves the score, the model can
-# build these objects and simply does not know when to stop.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh
-RUN=runs/lf_qwen35_9b_mm_img/merged
-[ -d "$RUN" ] || { echo "[imgdec] no merged model"; exit 0; }
-G=""; for _ in $(seq 1 60); do G=${GPUS:-$(scripts/free_gpus.sh 40000 | cut -d, -f1)}; [ -n "$G" ] && break; sleep 30; done
-[ -z "$G" ] && { echo "[imgdec] no GPU with 40 GB free"; exit 0; }
-run () { # name, extra flags
- local NAME=$1; shift
- local OUT=eval/out/q9b_mm_img_dec_$NAME; mkdir -p $OUT
- echo "[imgdec] $NAME: $* "
- conda activate vllm
- export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$G
- python eval/generate_vllm_img.py --model $RUN --prompts eval/out/_img4_bench_prompts.jsonl --out $OUT \
- --max_new_tokens 32768 --max_model_len 40960 "$@" 2>&1 | tail -1
- local N=$(ls $OUT | grep -vc extract_stats.json || true)
- [ "${N:-0}" -lt 5 ] && { echo "[imgdec] $NAME PRODUCED NOTHING — not scoring"; return; }
- conda activate llmft
- python eval/run_bench.py --gen_dir $OUT --workers 24 --timeout 300 2>&1 | grep "status counts" | tail -1
- python - "$OUT" <<'PY'
-import json, sys
-rows = [json.loads(l) for l in open(f"{sys.argv[1]}/gens_shard0.jsonl")]
-tr = sum(1 for r in rows if not r.get("finished", True))
-print(f"[imgdec] unfinished={tr}/{len(rows)} mean_tok={sum(r.get('n_new_tokens',0) for r in rows)/len(rows):.0f}")
-PY
-}
-# every setting is compared against the SAME harness, so 12.7's cross-harness noise floor does not apply here
-run greedy
-run temp07 --temperature 0.7 --seed 1
-run presence --presence_penalty 0.5
-run reppen --repetition_penalty 1.05
-echo "[imgdec] ALL DONE"
diff --git a/finetune/scripts/run_md_exp.sh b/finetune/scripts/run_md_exp.sh
deleted file mode 100755
index e0c8f8a8..00000000
--- a/finetune/scripts/run_md_exp.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-# run_md_exp.sh <GPU(s)> <NAME>: LoRA train (configs/lf/lora_<NAME>.yaml) -> merge -> 3DCodeBench eval + 4-dialect eval -> rm merged
-set -uo pipefail; GPU=$1; NAME=$2; NGPU=$(echo $GPU | tr ',' '\n' | wc -l); ACC=$((8 / NGPU)); cd /wekafs/ict/hx_624/llm-ft
-RUN=/wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_lora_$NAME
-echo "[md $NAME] $(date) train on GPU(s) $GPU"
-GPUS=$GPU scripts/lf_train.sh configs/lf/lora_$NAME.yaml gradient_accumulation_steps=$ACC > logs/train_$NAME.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[md $NAME] TRAIN FAILED"; exit 1; }
-echo "[md $NAME] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-sed -e "s|adapter_name_or_path:.*|adapter_name_or_path: $RUN|" -e "s|export_dir:.*|export_dir: $RUN/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_$NAME.yaml
-scripts/lf_export.sh configs/lf/export_$NAME.yaml > logs/export_$NAME.log 2>&1 || { echo "[md $NAME] EXPORT FAILED"; exit 1; }
-G1=$(echo $GPU | cut -d, -f1)
-GPUS=$G1 eval/run_eval_vllm.sh $RUN/merged eval/out/qwen35_9b_lora_$NAME --no_think --max_new_tokens 6144 > logs/eval_$NAME.log 2>&1
-echo "[md $NAME] $(date) 3DCodeBench: $(python3 -c "import json; s=json.load(open('eval/out/qwen35_9b_lora_$NAME/summary.json')); print(s['exec_ok'], round(s['[email protected]_mean_all(fail=0)'],3))")"
-GPUS=$G1 eval/run_dialect_eval.sh $RUN/merged $NAME > logs/mdeval_$NAME.log 2>&1
-for D in cadquery openscad glsl blender; do echo "[md $NAME] $D: $(cat eval/out/md_${NAME}_$D/summary.json 2>/dev/null | tr -d '\n ' | cut -c1-200)"; done
-rm -rf $RUN/merged; echo "[md $NAME] DONE"
diff --git a/finetune/scripts/run_md_max_9b.sh b/finetune/scripts/run_md_max_9b.sh
deleted file mode 100755
index bff9edc9..00000000
--- a/finetune/scripts/run_md_max_9b.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# After the 27B pipeline: 9B on the caption-augmented full corpus at the SAME token budget as md_xl (~300M)
-# -> answers "does using ALL sources + 3 captions/sample beat 270k single-caption pairs at equal compute?"
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-until grep -qE "\[27b\] (ALL DONE|TRAIN FAILED|SMOKE FAILED|EXPORT FAILED)" logs/run_27b.log 2>/dev/null; do sleep 120; done
-until [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i 0,1,2,3 | sort -n | tail -1)" -lt 8000 ]; do sleep 60; done
-echo "[9bmax] $(date) train 9B on md_max_9b (364k pairs / ~304M tok, 6 dialects, 3 captions/sample)"
-GPUS=0,1,2,3 scripts/lf_train.sh configs/lf/lora_md_max_9b.yaml > logs/train_md_max_9b.log 2>&1
-RUN=runs/lf_qwen35_9b_lora_md_max
-[ -f $RUN/train_results.json ] || { echo "[9bmax] TRAIN FAILED"; exit 1; }
-echo "[9bmax] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-200)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_md_max_9b.yaml
-scripts/lf_export.sh configs/lf/export_md_max_9b.yaml > logs/export_md_max_9b.log 2>&1 || { echo "[9bmax] EXPORT FAILED"; exit 1; }
-GPUS=0 TP=1 eval/eval_all_run2.sh $RUN/merged q9b_md_max --max_new 8192 2>&1 | grep -E "gen-multi|extract\]|status counts|dialect|DONE" | tail -30
-echo "[9bmax] ALL DONE"
diff --git a/finetune/scripts/run_md_v3.sh b/finetune/scripts/run_md_v3.sh
deleted file mode 100755
index f6147ccf..00000000
--- a/finetune/scripts/run_md_v3.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-# Control for the md_max regression: same sources & token budget, but 1 caption per sample + all bootstrapped Blender.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-until grep -qE "\[27bv2\] (ALL DONE|TRAIN FAILED|EXPORT FAILED)" logs/run_27b_v2.log 2>/dev/null; do sleep 120; done
-IDLE=0; while [ $IDLE -lt 3 ]; do
- if [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i 0,1,2,3 | sort -n | tail -1)" -lt 8000 ]; then IDLE=$((IDLE+1)); else IDLE=0; fi; sleep 30; done
-echo "[v3] $(date) train 9B on md_v3 (1 caption/sample + bootstrapped blender)"
-GPUS=0,1,2,3 scripts/lf_train.sh configs/lf/lora_md_v3.yaml > logs/train_md_v3.log 2>&1
-RUN=runs/lf_qwen35_9b_lora_md_v3
-[ -f $RUN/train_results.json ] || { echo "[v3] TRAIN FAILED"; exit 1; }
-echo "[v3] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-160)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_md_v3.yaml
-scripts/lf_export.sh configs/lf/export_md_v3.yaml > logs/export_md_v3.log 2>&1 || { echo "[v3] EXPORT FAILED"; exit 1; }
-GPUS=0 TP=1 eval/eval_all_run2.sh $RUN/merged q9b_v3 --max_new 8192 2>&1 | grep -E "gen-multi|status counts|dialect|DONE" | tail -20
-GPUS=1 TP=1 eval/eval_all_run2.sh $RUN/merged q9b_v3_T07 --temp 0.7 --seed 1 --max_new 8192 --suites openscad glsl 2>&1 | grep -E "dialect|DONE" | tail -4
-echo "[v3] ALL DONE"
diff --git a/finetune/scripts/run_mm_ablation.sh b/finetune/scripts/run_mm_ablation.sh
deleted file mode 100755
index d6bcbf4f..00000000
--- a/finetune/scripts/run_mm_ablation.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-# Three-way ablation on identical samples and an identical val split: image only vs image+instruction vs text only.
-# Answers what a reference render is actually worth on top of the caption we already have.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-for V in img_text img text; do
- G=""; for _ in $(seq 1 60); do G=$(scripts/free_gpus.sh); [ -n "$G" ] && break; sleep 60; done
- [ -z "$G" ] && { echo "[mm-$V] skipped: no GPU with enough free memory after 60 min"; continue; }
- RUN=runs/lf_qwen35_9b_mm_$V
- echo "[mm-$V] $(date) train on GPUs $G"
- GPUS=$G scripts/lf_train.sh configs/lf/lora_9b_mm_$V.yaml > logs/train_mm_$V.log 2>&1
- if [ ! -f $RUN/train_results.json ]; then
- echo "[mm-$V] TRAIN FAILED: $(grep -iE 'out of memory|error' logs/train_mm_$V.log | grep -v errors | tail -1 | cut -c1-160)"; continue; fi
- echo "[mm-$V] $(date) train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-130)"
- sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_mm_$V.yaml
- scripts/lf_export.sh configs/lf/export_mm_$V.yaml > logs/export_mm_$V.log 2>&1 || { echo "[mm-$V] EXPORT FAILED"; continue; }
- # a trainer takes a while to hand its memory back; wait for it instead of failing the eval
- G1=""; for _ in $(seq 1 20); do G1=$(scripts/free_gpus.sh 30000 | cut -d, -f1); [ -n "$G1" ] && break; sleep 30; done
- [ -z "$G1" ] && { echo "[mm-$V] eval skipped: no GPU with 30 GB free after 10 min — $(nvidia-smi --query-gpu=index,memory.used --format=csv,noheader -i 0,1,2,3 | tr '\n' ' ')"; continue; }
- source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
- export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$G1
- OUT=eval/out/q9b_mm_${V}_bench; mkdir -p $OUT
- # every variant is evaluated on the SAME 212 tasks, each fed the input its training used
- case $V in
- text) python eval/generate_vllm.py --model $RUN/merged --prompts data/sft_v1/bench_prompts.jsonl --out $OUT --tp 1 --no_think --dialect blender --max_new_tokens 32768 2>&1 | tail -1;;
- img) python eval/generate_vllm_img.py --model $RUN/merged --prompts eval/out/_img4_bench_prompts.jsonl --out $OUT --max_new_tokens 32768 2>&1 | tail -1;;
- img_text) python eval/generate_vllm_img.py --model $RUN/merged --prompts eval/out/_img4text_bench_prompts.jsonl --out $OUT --max_new_tokens 32768 2>&1 | tail -1;;
- esac
- conda activate llmft
- python eval/run_bench.py --gen_dir $OUT --workers 24 --timeout 300 2>&1 | grep "status counts" | tail -1
- python eval/metrics.py --gen_dir $OUT 2>&1 | tail -1
- echo "[mm-$V] EVAL DONE"
-done
-echo "[mm] ALL DONE"
diff --git a/finetune/scripts/run_mm_eval_fixed.sh b/finetune/scripts/run_mm_eval_fixed.sh
deleted file mode 100755
index a43b72d4..00000000
--- a/finetune/scripts/run_mm_eval_fixed.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-# Re-evaluate the three mm_ablation variants under one honest setting.
-# The first pass was invalid twice over: a 6144-token output cap turned long-but-correct programs into syntax
-# errors, and the pre-eval wait demanded a trainer's 60 GB free, so on this shared box it either skipped or
-# launched vLLM into memory another user already held. Both are fixed here; results from this script supersede
-# whatever logs/sup_mm_ablation.log reported.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh
-for V in img_text img text; do
- RUN=runs/lf_qwen35_9b_mm_$V
- [ -d "$RUN/merged" ] || { echo "[mmeval-$V] no merged model at $RUN/merged — skipping"; continue; }
- # an eval needs room for a 9B plus its KV cache, not a trainer's working set
- G1=""; for _ in $(seq 1 40); do G1=$(scripts/free_gpus.sh 40000 | cut -d, -f1); [ -n "$G1" ] && break; sleep 30; done
- [ -z "$G1" ] && { echo "[mmeval-$V] skipped: no GPU with 40 GB free after 20 min — $(nvidia-smi --query-gpu=index,memory.used --format=csv,noheader -i 0,1,2,3 | tr '\n' ' ')"; continue; }
- OUT=eval/out/q9b_mm_${V}_bench_fix; mkdir -p $OUT
- echo "[mmeval-$V] $(date) generating on GPU $G1 -> $OUT"
- conda activate vllm
- export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$G1
- case $V in
- text) python eval/generate_vllm.py --model $RUN/merged --prompts data/sft_v1/bench_prompts.jsonl --out $OUT --tp 1 --no_think --dialect blender --max_new_tokens 32768 --max_model_len 40960 2>&1 | tail -3;;
- img) python eval/generate_vllm_img.py --model $RUN/merged --prompts eval/out/_img4_bench_prompts.jsonl --out $OUT --max_new_tokens 32768 --max_model_len 40960 2>&1 | tail -3;;
- img_text) python eval/generate_vllm_img.py --model $RUN/merged --prompts eval/out/_img4text_bench_prompts.jsonl --out $OUT --max_new_tokens 32768 --max_model_len 40960 2>&1 | tail -3;;
- esac
- N=$(ls $OUT 2>/dev/null | grep -vc extract_stats.json || true)
- # zero generations means the engine never came up; say so instead of scoring an empty directory as 0%
- [ "${N:-0}" -lt 5 ] && { echo "[mmeval-$V] GENERATION PRODUCED NOTHING ($N dirs) — not scoring"; continue; }
- conda activate llmft
- python eval/run_bench.py --gen_dir $OUT --workers 24 --timeout 300 2>&1 | grep "status counts" | tail -1
- python eval/metrics.py --gen_dir $OUT 2>&1 | tail -1
- echo "[mmeval-$V] truncated=$(python -c "import json;print(json.load(open('$OUT/extract_stats.json')).get('truncated'))" 2>/dev/null)"
- echo "[mmeval-$V] DONE"
-done
-echo "[mmeval] ALL DONE"
diff --git a/finetune/scripts/run_mm_multisuite.sh b/finetune/scripts/run_mm_multisuite.sh
deleted file mode 100755
index e32d5781..00000000
--- a/finetune/scripts/run_mm_multisuite.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-# Does training on reference images change what the model can do in dialects that had NO image data?
-# mm_img_text and mm_text were trained on identical samples and the identical split, differing only in whether a
-# render was shown — so any gap on the five held-out dialect suites is attributable to the images alone.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-for V in img_text text; do
- RUN=runs/lf_qwen35_9b_mm_$V
- [ -d "$RUN/merged" ] || { echo "[multisuite-$V] no merged model — skipping"; continue; }
- G=""; for _ in $(seq 1 40); do G=$(scripts/free_gpus.sh 40000 | cut -d, -f1); [ -n "$G" ] && break; sleep 30; done
- [ -z "$G" ] && { echo "[multisuite-$V] skipped: no GPU with 40 GB free after 20 min"; continue; }
- echo "[multisuite-$V] $(date) all six suites on GPU $G"
- GPUS=$G TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_mm_${V}_all 2>&1 | tail -25
- echo "[multisuite-$V] DONE"
-done
-echo "[multisuite] ALL DONE"
diff --git a/finetune/scripts/run_mmmix2_eval.sh b/finetune/scripts/run_mmmix2_eval.sh
deleted file mode 100755
index d4ac4c9c..00000000
--- a/finetune/scripts/run_mmmix2_eval.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-# mmmix2 mixes image+text, image-only and the full text corpus into one model. It trained but was never scored.
-# Two questions: does mixing image data cost the TEXT path anything (compare against md_9b_noleak, 84.9%), and
-# does one model handle both input types? Text suites and image paths are all run here so the numbers are
-# comparable within this one harness (12.7).
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-RUN=runs/lf_qwen35_9b_mmmix2/merged
-[ -d "$RUN" ] || { echo "[mmmix2eval] no merged model"; exit 0; }
-G=""; for _ in $(seq 1 60); do G=${GPUS:-$(scripts/free_gpus.sh 40000 | cut -d, -f1)}; [ -n "$G" ] && break; sleep 30; done
-[ -z "$G" ] && { echo "[mmmix2eval] no GPU with 40 GB free after 30 min"; exit 0; }
-echo "[mmmix2eval] $(date) six text suites on GPU $G"
-GPUS=$G TP=1 bash eval/eval_all_run2.sh $RUN q9b_mmmix2_all 2>&1 | tail -20
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh
-for SPEC in "_img4text_bench_prompts img_text" "_img4_bench_prompts img"; do
- set -- $SPEC
- OUT=eval/out/q9b_mmmix2_$2; mkdir -p $OUT
- echo "[mmmix2eval] image path: $2"
- conda activate vllm
- export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$G
- python eval/generate_vllm_img.py --model $RUN --prompts eval/out/$1.jsonl --out $OUT \
- --max_new_tokens 32768 --max_model_len 40960 2>&1 | tail -1
- N=$(ls $OUT | grep -vc extract_stats.json || true)
- [ "${N:-0}" -lt 5 ] && { echo "[mmmix2eval] $2 PRODUCED NOTHING — not scoring"; continue; }
- conda activate llmft
- python eval/run_bench.py --gen_dir $OUT --workers 24 --timeout 300 2>&1 | grep "status counts" | tail -1
- python - "$OUT" <<'PY'
-import json, sys
-r=[json.loads(l) for l in open(f"{sys.argv[1]}/gens_shard0.jsonl")]
-print(f"[mmmix2eval] unfinished={sum(1 for x in r if not x.get('finished',True))}/{len(r)} mean_tok={sum(x.get('n_new_tokens',0) for x in r)/len(r):.0f}")
-PY
-done
-echo "[mmmix2eval] ALL DONE"
diff --git a/finetune/scripts/run_mmvis_eval.sh b/finetune/scripts/run_mmvis_eval.sh
deleted file mode 100755
index 26c0de17..00000000
--- a/finetune/scripts/run_mmvis_eval.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-# mmvis unfreezes the vision tower; it trained but was never scored. Both decodings, because section 13.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-RUN=runs/lf_qwen35_9b_mmvis
-[ -f $RUN/train_results.json ] || { echo "[mmviseval] training never finished"; exit 0; }
-if [ ! -d $RUN/merged ]; then
- sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/models/Qwen3.5-9B|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_mmvis.yaml
- scripts/lf_export.sh configs/lf/export_mmvis.yaml > logs/export_mmvis.log 2>&1 || { echo "[mmviseval] EXPORT FAILED: $(grep -iE 'error' logs/export_mmvis.log | tail -1 | cut -c1-150)"; exit 0; }
-fi
-G=""; for _ in $(seq 1 60); do G=${GPUS:-$(scripts/free_gpus.sh 40000 | cut -d, -f1)}; [ -n "$G" ] && break; sleep 30; done
-[ -z "$G" ] && { echo "[mmviseval] no GPU with 40 GB free"; exit 0; }
-echo "[mmviseval] $(date) on GPU $G"
-GPUS=$G TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_mmvis_greedy 2>&1 | tail -9
-GPUS=$G TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_mmvis_t07 --temp 0.7 --seed 1 2>&1 | tail -9
-# the image path is the point of unfreezing the vision tower, so score it too
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$G
-OUT=eval/out/q9b_mmvis_img; mkdir -p $OUT
-python eval/generate_vllm_img.py --model $RUN/merged --prompts eval/out/_img4text_bench_prompts.jsonl --out $OUT \
- --max_new_tokens 32768 --max_model_len 40960 > logs/gen_mmvis_img.log 2>&1; tail -2 logs/gen_mmvis_img.log
-N=$(ls $OUT | grep -vc extract_stats.json || true)
-[ "${N:-0}" -lt 5 ] && { echo "[mmviseval] image path PRODUCED NOTHING — not scoring"; exit 0; }
-conda activate llmft
-python eval/run_bench.py --gen_dir $OUT --workers 24 --timeout 300 2>&1 | grep "status counts" | tail -1
-echo "[mmviseval] DONE"
diff --git a/finetune/scripts/run_noise_profile.sh b/finetune/scripts/run_noise_profile.sh
deleted file mode 100755
index bfbe27ef..00000000
--- a/finetune/scripts/run_noise_profile.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-# OpenSCAD moved 40.0% -> 30.0% between two runs of the SAME model through the SAME harness, ten times the
-# +-2pp floor I estimated from 3DCodeBench. So the floor is not one number: it differs per suite, and long-output
-# dialects swing hardest. Run one model through all six suites three times and report the per-suite spread, so
-# every future comparison can be read against the right threshold instead of a guessed one.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-M=runs/lf_qwen35_9b_mm_text/merged
-[ -d "$M" ] || { echo "[noise] no model"; exit 0; }
-for R in 1 2 3; do
- G=""; for _ in $(seq 1 60); do G=${GPUS:-$(scripts/free_gpus.sh 40000 | cut -d, -f1)}; [ -n "$G" ] && break; sleep 30; done
- [ -z "$G" ] && { echo "[noise] run $R skipped: no GPU with 40 GB free"; continue; }
- echo "[noise] $(date) repeat $R of 3 on GPU $G"
- GPUS=$G TP=1 bash eval/eval_all_run2.sh $M q9b_noise_r$R 2>&1 | tail -3
-done
-python - <<'PY'
-import json, os, statistics as st
-suites = ["bench", "blender", "cadquery", "openscad", "glsl", "threejs"]
-runs = []
-for r in (1, 2, 3):
- p = f"eval/out/q9b_noise_r{r}_report.json"
- if os.path.exists(p):
- runs.append({s["suite"]: s["exec_rate"] for s in json.load(open(p))["suites"]})
-if len(runs) < 2:
- print("[noise] fewer than two runs completed — cannot estimate a spread"); raise SystemExit
-print(f"[noise] {len(runs)} repeats of an IDENTICAL model+harness")
-print(f" {'suite':10s} " + " ".join(f"run{i+1:>6}" for i in range(len(runs))) + f" {'spread':>9s}")
-for s in suites:
- v = [r[s] * 100 for r in runs if s in r]
- if len(v) < 2: continue
- print(f" {s:10s} " + " ".join(f"{x:9.1f}" for x in v) + f" {max(v)-min(v):8.1f}pp")
-PY
-echo "[noise] DONE"
diff --git a/finetune/scripts/run_other_pairs.sh b/finetune/scripts/run_other_pairs.sh
deleted file mode 100755
index 7e1b20cf..00000000
--- a/finetune/scripts/run_other_pairs.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-# The remaining parquet-backed sources. deepcad and bioinspired3d have renders, so they get all three pair types;
-# articraft (URDF) and thingiverse have none, so only text->code is produced and the img/imgtext folders are
-# simply not written -- an empty image dataset would be worse than an absent one.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate llmft
-OUT=/wekafs/ict/hx_624/hf_pairs_other
-mkdir -p $OUT
-build () {
- local SUB=$1 DIA=$2
- local Q="$OUT/$(basename $SUB)_llamafactory_text/qc.json"
- [ -f "$Q" ] && { echo "[oth] $SUB already built"; return; }
- python scripts/build_pairs_3dcodebench.py --subdir "$SUB" --dialect "$DIA" --out $OUT \
- --workers 12 --views 4 --img_root /wekafs/ict/hx_624/data/pair_images > logs/pairs_oth_$(basename $SUB).log 2>&1
- echo "[oth] $(date +%H:%M) $SUB $(grep -E '^\[pairs\] (text|img|imgtext)' logs/pairs_oth_$(basename $SUB).log | tr '\n' ' ' | tr -s ' ' | cut -c1-110)"
-}
-export -f build; export OUT
-LIST=""
-for d in /wekafs/ict/hx_624/data/3dcodeverse_meta/deepcad/*/metadata.parquet; do LIST="$LIST deepcad/$(basename $(dirname $d)):cadquery"; done
-for d in /wekafs/ict/hx_624/data/3dcodeverse_meta/bioinspired3d/*/metadata.parquet; do LIST="$LIST bioinspired3d/$(basename $(dirname $d)):blender"; done
-for d in /wekafs/ict/hx_624/data/3dcodeverse_meta/articraft/*/metadata.parquet; do LIST="$LIST articraft/$(basename $(dirname $d)):cadquery"; done
-for d in /wekafs/ict/hx_624/data/3dcodeverse_meta/thingiverse/*/metadata.parquet; do LIST="$LIST thingiverse/$(basename $(dirname $d)):openscad"; done
-echo "[oth] $(echo $LIST | wc -w) subdirs"
-echo $LIST | tr ' ' '\n' | xargs -P ${PAR:-8} -I{} bash -c 'IFS=: read -r s d <<< "$1"; build "$s" "$d"' _ {}
-echo "[oth] ALL DONE"
diff --git a/finetune/scripts/run_plus_stop_eval.sh b/finetune/scripts/run_plus_stop_eval.sh
deleted file mode 100755
index 40268e2c..00000000
--- a/finetune/scripts/run_plus_stop_eval.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/bash
-# Same base, same hyper-parameters, only the pair source differs: mmmix2's pairs (transfer) vs md_9b_plus's own.
-# Answers whether the 2.5 hours of per-model pair generation buys anything over reusing an existing set.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh
-BASE=$(readlink -f runs/lf_qwen35_9b_plus/merged)
-for SPEC in "lf_qwen35_9b_plus_stop:q9b_plus_stop:transfer" "lf_qwen35_9b_plus_stopown:q9b_plus_stopown:own"; do
- IFS=: read -r RUNDIR NAME TAG <<< "$SPEC"
- RUN=runs/$RUNDIR
- for _ in $(seq 1 90); do [ -f $RUN/train_results.json ] && break; sleep 60; done
- [ -f $RUN/train_results.json ] || { echo "[pstop-$TAG] training never finished"; continue; }
- if [ ! -d $RUN/merged ]; then
- sed -e "s|model_name_or_path:.*|model_name_or_path: $BASE|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_$RUNDIR.yaml
- scripts/lf_export.sh configs/lf/export_$RUNDIR.yaml > logs/export_$RUNDIR.log 2>&1 || { echo "[pstop-$TAG] EXPORT FAILED"; continue; }
- fi
- G=""; for _ in $(seq 1 60); do G=$(scripts/free_gpus.sh 40000 | cut -d, -f1); [ -n "$G" ] && break; sleep 30; done
- [ -z "$G" ] && { echo "[pstop-$TAG] no GPU"; continue; }
- echo "[pstop-$TAG] $(date) evaluating on GPU $G"
- GPUS=$G TP=1 bash eval/eval_all_run2.sh $RUN/merged ${NAME}_greedy 2>&1 | tail -9
- GPUS=$G TP=1 bash eval/eval_all_run2.sh $RUN/merged ${NAME}_t07 --temp 0.7 --seed 1 2>&1 | tail -9
- echo "[pstop-$TAG] DONE"
-done
-conda activate llmft
-python - <<'PY'
-import json, os
-suites = ["bench", "blender", "cadquery", "openscad", "glsl", "threejs"]
-sets = [("md_9b_plus greedy", "q9b_plus_greedy"), ("md_9b_plus T=0.7", "q9b_plus_t07"),
- ("+transfer pairs greedy", "q9b_plus_stop_greedy"), ("+transfer pairs T=0.7", "q9b_plus_stop_t07"),
- ("+own pairs greedy", "q9b_plus_stopown_greedy"), ("+own pairs T=0.7", "q9b_plus_stopown_t07")]
-for title, key in (("exec rate", "exec_rate"), ("mean output tokens", "mean_new_tokens")):
- print(f" --- {title} ---")
- print(f" {'model':26s}" + "".join(f"{s[:8]:>10s}" for s in suites))
- for label, n in sets:
- p = f"eval/out/{n}_report.json"
- if not os.path.exists(p): print(f" {label:26s} (missing)"); continue
- d = {x["suite"]: x for x in json.load(open(p))["suites"]}
- if key == "exec_rate":
- print(f" {label:26s}" + "".join(f"{d[s][key]*100:9.1f}%" if s in d else f"{'-':>10s}" for s in suites))
- else:
- print(f" {label:26s}" + "".join(f"{d[s].get(key,0):10,.0f}" if s in d else f"{'-':>10s}" for s in suites))
-PY
-echo "[pstop] ALL DONE"
diff --git a/finetune/scripts/run_rescore_sampled.sh b/finetune/scripts/run_rescore_sampled.sh
deleted file mode 100755
index 228aea01..00000000
--- a/finetune/scripts/run_rescore_sampled.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-# Every dialect number in the report was measured greedy, and section 13 showed that understates the long-output
-# dialects badly (9B OpenSCAD 6% vs 44%, 27B 34% vs 80%). Re-score the models whose merged weights still exist,
-# one after another in a single session so the numbers are comparable to each other (13.7).
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-for SPEC in "runs/lf_qwen35_9b_lora_md_xl:q9b_md_xl_t07" "runs/lf_qwen35_9b_imgmix:q9b_imgmix_t07" "runs/lf_qwen35_9b_lora_v1:q9b_v1_t07"; do
- M="${SPEC%%:*}"; NAME="${SPEC##*:}"
- [ -d "$M/merged" ] || { echo "[rescore] $M has no merged weights — skipping (the DPO scripts delete them)"; continue; }
- G=""; for _ in $(seq 1 90); do G=${GPUS:-$(scripts/free_gpus.sh 40000 | cut -d, -f1)}; [ -n "$G" ] && break; sleep 60; done
- [ -z "$G" ] && { echo "[rescore] no GPU with 40 GB free"; exit 0; }
- echo "[rescore] $(date) $NAME on GPU $G"
- GPUS=$G TP=1 bash eval/eval_all_run2.sh $M/merged $NAME --temp 0.7 --seed 1 2>&1 | tail -9
-done
-echo "[rescore] DONE"
diff --git a/finetune/scripts/run_shadertoy_pairs.sh b/finetune/scripts/run_shadertoy_pairs.sh
deleted file mode 100755
index b24896b9..00000000
--- a/finetune/scripts/run_shadertoy_pairs.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-# All three pair types for every shadertoy shard. Renders come from scanning each shard's tars (the byte offsets
-# in metadata are not reliable), and the code comes from whichever verified parquet exists for that shard --
-# *_llamafactory_flat for the 68 that could be flattened, the separately verified tree for the other 44 -- so the
-# pairs carry a compiles column instead of being unverified GLSL.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate llmft
-OUT=/wekafs/ict/hx_624/hf_pairs_shadertoy
-VER="/wekafs/ict/hx_624/hf_subdirs/shadertoy,/wekafs/ict/hx_624/hf_subdirs_verified/shadertoy"
-PAR=${PAR:-4}
-mkdir -p $OUT
-build () {
- local SUB=$1
- local Q="$OUT/${SUB}_llamafactory_img/qc.json"
- if [ -f "$Q" ]; then echo "[st] $SUB already built — skipping"; return; fi
- python scripts/build_pairs_3dcodebench.py --subdir shadertoy/$SUB --dialect glsl \
- --out $OUT --workers 12 --views 4 --verified_from "$VER" > logs/pairs_st_$SUB.log 2>&1
- local line=$(grep -E "^\[pairs\] (text|img|imgtext)" logs/pairs_st_$SUB.log | tr '\n' ' ' | tr -s ' ')
- echo "[st] $(date +%H:%M) $SUB ${line:-FAILED: $(grep -iE 'error|Traceback' logs/pairs_st_$SUB.log | tail -1 | cut -c1-90)}"
-}
-export -f build; export OUT VER
-SHARDS=$(ls -d /wekafs/ict/hx_624/data/3dcodeverse_meta/shadertoy/*/ | xargs -n1 basename)
-echo "[st] $(echo "$SHARDS" | wc -l) shards, $PAR at a time"
-echo "$SHARDS" | xargs -P $PAR -I{} bash -c 'build "$@"' _ {}
-echo "[st] ALL DONE"
diff --git a/finetune/scripts/run_stop_dpo_r2.sh b/finetune/scripts/run_stop_dpo_r2.sh
deleted file mode 100755
index f3b208da..00000000
--- a/finetune/scripts/run_stop_dpo_r2.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/bash
-# Round 2 of the same idea, but generated from the round-1 model. The first attempt at this reused round 1's
-# directories because of a "skip if it exists" guard and rebuilt an identical pair set in nine seconds while
-# reporting success -- a real round has to see what the CURRENT model still gets wrong.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-W=data/stop_dpo_r2; BASE=runs/lf_qwen35_9b_stopdpo/merged
-[ -d "$BASE" ] || { echo "[stop2] round-1 model missing"; exit 0; }
-mkdir -p $W; cp data/stop_dpo/prompts.jsonl $W/prompts.jsonl
-G=""; for _ in $(seq 1 60); do G=${GPUS:-$(scripts/free_gpus.sh 40000 | cut -d, -f1)}; [ -n "$G" ] && break; sleep 30; done
-[ -z "$G" ] && { echo "[stop2] no GPU with 40 GB free"; exit 0; }
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$G
-echo "[stop2] $(date) sampling round-1 model on GPU $G"
-python eval/generate_vllm.py --model $BASE --prompts $W/prompts.jsonl --out $W/gen_greedy --tp 1 --no_think \
- --max_new_tokens 16384 --max_model_len 20480 2>&1 | tail -1
-for i in 1 2; do
- python eval/generate_vllm.py --model $BASE --prompts $W/prompts.jsonl --out $W/gen_s$i --tp 1 --no_think \
- --max_new_tokens 16384 --max_model_len 20480 --temperature 0.8 --seed $((900+i)) 2>&1 | tail -1
-done
-conda activate llmft
-python - "$W" <<'PY'
-import json, os, sys, random, collections
-random.seed(9); W = sys.argv[1]
-prompts = {json.loads(l)["task"]: json.loads(l) for l in open(f"{W}/prompts.jsonl")}
-def load(d):
- out = {}; p = f"{d}/gens_shard0.jsonl"
- if not os.path.exists(p): return out
- for l in open(p):
- r = json.loads(l); t = r["task"]; cp = f"{d}/{t}/code.py"
- if os.path.exists(cp):
- out[t] = {"finished": r.get("finished", True), "ntok": r.get("n_new_tokens", 0),
- "code": open(cp, encoding="utf-8", errors="replace").read().strip()}
- return out
-greedy = load(f"{W}/gen_greedy"); samples = [load(f"{W}/gen_s{i}") for i in (1, 2)]
-pairs, why = [], collections.Counter()
-for t, g in greedy.items():
- if not ((not g["finished"]) or g["ntok"] > 8192): why["greedy_was_fine"] += 1; continue
- cands = [s[t] for s in samples if t in s and s[t]["finished"] and s[t]["ntok"] <= 8192 and len(s[t]["code"]) > 60]
- if not cands: why["no_clean_sample"] += 1; continue
- good = min(cands, key=lambda c: c["ntok"])
- if good["code"] == g["code"]: why["identical"] += 1; continue
- p = prompts[t]
- pairs.append({"conversations": [{"from": "human", "value": p["messages"][1]["content"]}],
- "system": p["messages"][0]["content"],
- "chosen": {"from": "gpt", "value": good["code"]},
- "rejected": {"from": "gpt", "value": g["code"][:60000]}, "dialect": p["dialect"]})
- why["paired"] += 1
-random.shuffle(pairs)
-json.dump(pairs, open("data/lf/stop_dpo_pairs_r2.json", "w"), ensure_ascii=False)
-info = json.load(open("data/lf/dataset_info.json"))
-info["stop_dpo_pairs_r2"] = {"file_name": "stop_dpo_pairs_r2.json", "ranking": True, "formatting": "sharegpt",
- "columns": {"messages": "conversations", "system": "system", "chosen": "chosen", "rejected": "rejected"}}
-json.dump(info, open("data/lf/dataset_info.json", "w"), indent=2)
-print("[stop2] pairs:", len(pairs), dict(why))
-print("[stop2] by dialect:", dict(collections.Counter(p["dialect"] for p in pairs)))
-PY
-N=$(python3 -c "import json;print(len(json.load(open('data/lf/stop_dpo_pairs_r2.json'))))" 2>/dev/null || echo 0)
-# round 1 fixed most of the runaways; if few remain there is nothing left to train on, and that is the result
-[ "${N:-0}" -lt 100 ] && { echo "[stop2] only $N pairs left after round 1 — the behaviour is largely gone, stopping here"; exit 0; }
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" -e "s|dataset: stop_dpo_pairs|dataset: stop_dpo_pairs_r2|" \
- -e "s|^output_dir:.*|output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_stopdpo_r2|" configs/lf/dpo_stop.yaml > configs/lf/dpo_stop_r2.yaml
-RUN=runs/lf_qwen35_9b_stopdpo_r2
-GPUS=$G scripts/lf_train.sh configs/lf/dpo_stop_r2.yaml > logs/train_stopdpo_r2.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[stop2] TRAIN FAILED: $(grep -iE 'out of memory|Error' logs/train_stopdpo_r2.log | grep -v errors | tail -1 | cut -c1-180)"; exit 0; }
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_stopdpo_r2.yaml
-scripts/lf_export.sh configs/lf/export_stopdpo_r2.yaml > logs/export_stopdpo_r2.log 2>&1 || { echo "[stop2] EXPORT FAILED"; exit 0; }
-GPUS=$G TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_stopdpo_r2_greedy 2>&1 | tail -9
-GPUS=$G TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_stopdpo_r2_t07 --temp 0.7 --seed 1 2>&1 | tail -9
-echo "[stop2] DONE"
diff --git a/finetune/scripts/run_stop_dpo_train.sh b/finetune/scripts/run_stop_dpo_train.sh
deleted file mode 100755
index 76385ada..00000000
--- a/finetune/scripts/run_stop_dpo_train.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/bash
-# Train the runaway out of the 9B, then score it under BOTH decodings. Reporting only greedy is what hid this
-# problem for the whole project: OpenSCAD read as 6% (a "forgotten dialect") when the same weights sampled give
-# 44%, against a 46% base. From here every long-output dialect gets both numbers.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-[ -f data/lf/stop_dpo_pairs.json ] || { echo "[stoptrain] pairs not built yet"; exit 0; }
-N=$(python3 -c "import json;print(len(json.load(open('data/lf/stop_dpo_pairs.json'))))")
-[ "$N" -lt 100 ] && { echo "[stoptrain] only $N pairs — too few to train on"; exit 0; }
-echo "[stoptrain] $(date) $N preference pairs"
-RUN=runs/lf_qwen35_9b_stopdpo
-G=""; for _ in $(seq 1 90); do G=${GPUS:-$(scripts/free_gpus.sh)}; [ -n "$G" ] && break; sleep 60; done
-[ -z "$G" ] && { echo "[stoptrain] no GPU with room"; exit 0; }
-echo "[stoptrain] train on GPUs $G"
-GPUS=$G scripts/lf_train.sh configs/lf/dpo_stop.yaml > logs/train_stopdpo.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[stoptrain] TRAIN FAILED: $(grep -iE 'out of memory|Error|Traceback' logs/train_stopdpo.log | grep -v errors | tail -1 | cut -c1-190)"; exit 0; }
-echo "[stoptrain] train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-130)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_mmmix2/merged|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_stopdpo.yaml
-scripts/lf_export.sh configs/lf/export_stopdpo.yaml > logs/export_stopdpo.log 2>&1 || { echo "[stoptrain] EXPORT FAILED"; exit 0; }
-G1=""; for _ in $(seq 1 60); do G1=$(scripts/free_gpus.sh 40000 | cut -d, -f1); [ -n "$G1" ] && break; sleep 30; done
-[ -z "$G1" ] && { echo "[stoptrain] eval skipped: no GPU with 40 GB free"; exit 0; }
-GPUS=$G1 TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_stopdpo_greedy 2>&1 | tail -10
-GPUS=$G1 TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_stopdpo_t07 --temp 0.7 --seed 1 2>&1 | tail -10
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate llmft
-python - <<'PY'
-import json, os
-suites = ["bench", "blender", "cadquery", "openscad", "glsl", "threejs"]
-sets = [("mmmix2 greedy", "q9b_mmmix2_all"), ("mmmix2 T=0.7", "q9b_mmmix2_t07"),
- ("stopDPO greedy", "q9b_stopdpo_greedy"), ("stopDPO T=0.7", "q9b_stopdpo_t07")]
-print(f" {'model':16s}" + "".join(f"{s[:8]:>10s}" for s in suites))
-for label, n in sets:
- p = f"eval/out/{n}_report.json"
- if not os.path.exists(p): print(f" {label:16s} (missing)"); continue
- d = {s["suite"]: s for s in json.load(open(p))["suites"]}
- print(f" {label:16s}" + "".join(f"{d[s]['exec_rate']*100:9.1f}%" if s in d else f"{'-':>10s}" for s in suites))
-print(" mean output tokens (the behaviour being trained)")
-for label, n in sets:
- p = f"eval/out/{n}_report.json"
- if not os.path.exists(p): continue
- d = {s["suite"]: s for s in json.load(open(p))["suites"]}
- print(f" {label:16s}" + "".join(f"{d[s].get('mean_new_tokens',0):10,.0f}" if s in d else f"{'-':>10s}" for s in suites))
-PY
-echo "[stoptrain] DONE"
diff --git a/finetune/scripts/run_stopdpo_transfer.sh b/finetune/scripts/run_stopdpo_transfer.sh
deleted file mode 100755
index c1eec24f..00000000
--- a/finetune/scripts/run_stopdpo_transfer.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-# dpo_exec_v2 generates NO runaway pairs of its own (3,247 of 3,687 greedy generations terminate cleanly) -- its
-# execution-feedback DPO on Blender prompts already taught termination, which is very likely why it is the best
-# model. So it cannot bootstrap its own stop-DPO. Instead transfer the pairs mmmix2 produced: the lesson they
-# carry ("stop here, not there") is not specific to the model that generated them. If bench holds at ~96% while
-# OpenSCAD/GLSL climb, that combination is the best model in the project.
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
-BASE=runs/lf_qwen35_9b_dpo_exec_v2/merged; RUN=runs/lf_qwen35_9b_best_stop
-[ -d "$BASE" ] || { echo "[transfer] best model not exported"; exit 0; }
-G=""; for _ in $(seq 1 90); do G=${GPUS:-$(scripts/free_gpus.sh 40000 | cut -d, -f1)}; [ -n "$G" ] && break; sleep 60; done
-[ -z "$G" ] && { echo "[transfer] no GPU with 40 GB free"; exit 0; }
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" \
- -e "s|^output_dir:.*|output_dir: /wekafs/ict/hx_624/llm-ft/runs/lf_qwen35_9b_best_stop|" configs/lf/dpo_stop.yaml > configs/lf/dpo_best_stop.yaml
-echo "[transfer] $(date) train on GPU $G"
-GPUS=$G scripts/lf_train.sh configs/lf/dpo_best_stop.yaml > logs/train_best_stop.log 2>&1
-[ -f $RUN/train_results.json ] || { echo "[transfer] TRAIN FAILED: $(grep -iE 'out of memory|Error' logs/train_best_stop.log | grep -v errors | tail -1 | cut -c1-180)"; exit 0; }
-echo "[transfer] train done: $(tr -d '\n' < $RUN/train_results.json | cut -c1-130)"
-sed -e "s|model_name_or_path:.*|model_name_or_path: $(readlink -f $BASE)|" -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_best_stop.yaml
-scripts/lf_export.sh configs/lf/export_best_stop.yaml > logs/export_best_stop.log 2>&1 || { echo "[transfer] EXPORT FAILED"; exit 0; }
-GPUS=$G TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_best_stop_greedy 2>&1 | tail -9
-GPUS=$G TP=1 bash eval/eval_all_run2.sh $RUN/merged q9b_best_stop_t07 --temp 0.7 --seed 1 2>&1 | tail -9
-echo "[transfer] DONE"
diff --git a/finetune/scripts/sample_mix.py b/finetune/scripts/sample_mix.py
deleted file mode 100644
index 548d8489..00000000
--- a/finetune/scripts/sample_mix.py
+++ /dev/null
@@ -1,80 +0,0 @@
-"""Sample a training mix out of the md_max corpus with a per-dialect TOKEN budget.
-
-md_max is ~0.77M pairs / ~0.9B tokens and 97% CadQuery+GLSL; every real run wants a different slice of it.
-
- python scripts/sample_mix.py --out data/md_27b_max \
- --budget blender=all,openscad=all,threejs=all,web=all,cadquery=25M,glsl=25M \
- [--src data/md_max] [--captions_per_sample 2] [--seed 5]
-
---captions_per_sample caps how many prompt variants of the SAME code may be kept (1 = no augmentation,
-2 = instruction+detailed, 3 = everything) so you can ablate caption augmentation at a fixed token budget.
-"""
-import argparse
-import collections
-import json
-import os
-import random
-
-
-def parse_budget(s):
- out = {}
- for part in s.split(","):
- if not part.strip():
- continue
- k, v = part.split("=")
- v = v.strip().lower()
- out[k.strip()] = None if v == "all" else int(float(v.rstrip("mk")) * (1e6 if v.endswith("m") else 1e3 if v.endswith("k") else 1))
- return out
-
-
-def main():
- ap = argparse.ArgumentParser()
- ap.add_argument("--src", default="/wekafs/ict/hx_624/llm-ft/data/md_max")
- ap.add_argument("--out", required=True)
- ap.add_argument("--budget", required=True, help="dialect=tokens|all, comma separated")
- ap.add_argument("--captions_per_sample", type=int, default=3)
- ap.add_argument("--seed", type=int, default=5)
- a = ap.parse_args()
- random.seed(a.seed)
- budget = parse_budget(a.budget)
-
- rows = [json.loads(l) for l in open(f"{a.src}/train.jsonl")]
- # estimate tokens per row: chars/3.4 is close enough for budgeting (exact counts live in md_max/report.json)
- for r in rows:
- r["_ntok"] = int(sum(len(m["content"]) for m in r["messages"]) / 3.4)
- by = collections.defaultdict(list)
- for r in rows:
- by[r["dialect"]].append(r)
-
- kept, stats = [], {}
- for dia, pool in by.items():
- if dia not in budget:
- continue
- random.shuffle(pool)
- per_sample = collections.Counter()
- take, tok = [], 0
- for r in pool:
- if per_sample[r["id"]] >= a.captions_per_sample:
- continue
- if budget[dia] is not None and tok + r["_ntok"] > budget[dia]:
- continue
- per_sample[r["id"]] += 1
- take.append(r)
- tok += r["_ntok"]
- if budget[dia] is not None and tok >= budget[dia]:
- break
- kept += take
- stats[dia] = {"n": len(take), "Mtok_est": round(tok / 1e6, 1), "uniq_samples": len(per_sample)}
- random.shuffle(kept)
- os.makedirs(a.out, exist_ok=True)
- with open(f"{a.out}/train.jsonl", "w") as f:
- for r in kept:
- f.write(json.dumps({k: v for k, v in r.items() if k != "_ntok"}, ensure_ascii=False) + "\n")
- os.system(f"cp {a.src}/val.jsonl {a.out}/val.jsonl")
- json.dump(stats, open(f"{a.out}/mix.json", "w"), indent=2)
- print(json.dumps(stats, indent=1))
- print(f"[mix] {len(kept)} pairs | ~{sum(v['Mtok_est'] for v in stats.values()):.1f}M tokens -> {a.out}")
-
-
-if __name__ == "__main__":
- main()
diff --git a/finetune/scripts/self_train_finish.sh b/finetune/scripts/self_train_finish.sh
deleted file mode 100755
index 2d24b1cd..00000000
--- a/finetune/scripts/self_train_finish.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-# Finish the self-training round after its script was stopped post-sampling: exec (CPU) -> build data -> (after 3-GPU full FT) train on GPUs 0,3 -> eval. Then re-run Qwen3-8B on GPU 1.
-cd /wekafs/ict/hx_624/llm-ft; W=data/selftrain_round1; K=2
-until grep -q "self-train script stopped" logs/exp_full_v2_3gpu.log 2>/dev/null; do sleep 30; done
-source /wekafs/ict/hx_624/llm-ft/env.sh
-for i in $(seq 1 $K); do [ -f $W/gen_s$i/exec_results.jsonl ] || python eval/run_bench.py --gen_dir $W/gen_s$i --workers 48 --timeout 120 > $W/gen_s$i/exec.log 2>&1; grep "status counts" $W/gen_s$i/exec.log; done
-echo "[self] $(date) exec done"
-python - <<PY
-import json, hashlib, os, random, shutil
-random.seed(0); W="$W"; K=$K; SRC="data/sft_v1"
-prompts={json.loads(l)["task"]: json.loads(l) for l in open(f"{W}/prompts.jsonl")}
-base=[json.loads(l) for l in open(f"{SRC}/train.jsonl")]
-seen={hashlib.sha1(r["messages"][-1]["content"].encode()).hexdigest() for r in base}
-new=[]; n_ok=0
-for i in range(1,K+1):
- for l in open(f"{W}/gen_s{i}/exec_results.jsonl"):
- r=json.loads(l)
- if r["status"]!="OK": continue
- n_ok+=1
- code=open(f"{W}/gen_s{i}/{r['task']}/code.py").read().strip()
- if code.count("\n")<4: continue
- h=hashlib.sha1(("```python\n"+code+"\n```").encode()).hexdigest()
- if h in seen: continue
- seen.add(h); p=prompts[r["task"]]
- new.append({"messages": p["messages"]+[{"role":"assistant","content":"```python\n"+code+"\n```"}], "source":"selftrain", "id":r["task"], "prompt_kind":"self"})
-print(f"verified OK generations: {n_ok}, new unique samples: {len(new)}")
-out="data/sft_v11_selftrain"; os.makedirs(out, exist_ok=True)
-allrows=base+new; random.shuffle(allrows)
-with open(f"{out}/train.jsonl","w") as f:
- for r in allrows: f.write(json.dumps(r, ensure_ascii=False)+"\n")
-shutil.copy(f"{SRC}/val.jsonl", f"{out}/val.jsonl")
-json.dump({"n_train":len(allrows),"n_new":len(new),"n_ok_generations":n_ok}, open(f"{out}/stats.json","w"), indent=1)
-PY
-python scripts/to_llamafactory.py --data_dir data/sft_v11_selftrain --name v11_selftrain >/dev/null && python scripts/make_lora_cfg.py v11_selftrain v11_selftrain >/dev/null
-cat data/sft_v11_selftrain/stats.json; echo "[self] $(date) data built"
-until grep -q "FULL3_DONE\|TRAIN FAILED" logs/exp_full_v2_3gpu.log 2>/dev/null; do sleep 30; done
-until [ "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i 0,3 | sort -n | tail -1)" -lt 10000 ]; do sleep 15; done
-scripts/run_exp.sh 0,3 v11_selftrain 2>&1 | tee -a logs/exp_v11_selftrain.log
-echo "[self] DONE"
diff --git a/finetune/scripts/self_train_round.sh b/finetune/scripts/self_train_round.sh
deleted file mode 100755
index d8da9ff5..00000000
--- a/finetune/scripts/self_train_round.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/bash
-# One round of execution-verified self-training:
-# LoRA-v1 merged model -> sample K completions (T) for every training prompt -> run all in Blender -> keep OK -> v1 data + verified samples -> LoRA -> eval
-# usage: GPUS=0 scripts/self_train_round.sh <K> <T> (default K=2, T=0.8)
-set -uo pipefail
-K=${1:-2}; T=${2:-0.8}; GPU=${GPUS:-0}
-cd /wekafs/ict/hx_624/llm-ft
-NAME=v11_selftrain; SRC=data/sft_v1; WORK=data/selftrain_round1; mkdir -p $WORK
-echo "[self] $(date) start (K=$K T=$T GPU=$GPU)"
-# 0) prompts file from train.jsonl (system+user only)
-source /wekafs/ict/hx_624/llm-ft/env.sh
-python - <<PY
-import json
-rows=[json.loads(l) for l in open("$SRC/train.jsonl")]
-with open("$WORK/prompts.jsonl","w") as f:
- for i,r in enumerate(rows):
- f.write(json.dumps({"task": f"t{i:05d}", "messages": r["messages"][:2], "source": r.get("source")})+"\n")
-print("prompts:", len(rows))
-PY
-# 1) merged LoRA-v1
-[ -d runs/lf_qwen35_9b_lora_v1/merged ] || scripts/lf_export.sh configs/lf/export_v1.yaml > logs/export_v1_self.log 2>&1 || { echo "[self] EXPORT FAILED"; exit 1; }
-# 2) sample K completions
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$GPU
-for i in $(seq 1 $K); do
- python eval/generate_vllm.py --model runs/lf_qwen35_9b_lora_v1/merged --prompts $WORK/prompts.jsonl --out $WORK/gen_s$i --tp 1 --no_think --max_new_tokens 4096 --temperature $T --seed $((100+i)) 2>&1 | grep -E "gen-vllm|Error|Traceback" | tail -3
-done
-rm -rf runs/lf_qwen35_9b_lora_v1/merged
-echo "[self] $(date) sampling done"
-# 3) execute everything in Blender (CPU)
-conda activate llmft
-for i in $(seq 1 $K); do python eval/run_bench.py --gen_dir $WORK/gen_s$i --workers 48 --timeout 120 > $WORK/gen_s$i/exec.log 2>&1; grep "status counts" $WORK/gen_s$i/exec.log; done
-echo "[self] $(date) exec done"
-# 4) build v11 = v1 + verified samples (dedup by code hash); val = v1 val
-python - <<PY
-import json, hashlib, os, random
-random.seed(0)
-W="$WORK"; K=$K
-prompts={json.loads(l)["task"]: json.loads(l) for l in open(f"{W}/prompts.jsonl")}
-base=[json.loads(l) for l in open("$SRC/train.jsonl")]
-seen={hashlib.sha1(r["messages"][-1]["content"].encode()).hexdigest() for r in base}
-new=[]; n_ok=0
-for i in range(1,K+1):
- for l in open(f"{W}/gen_s{i}/exec_results.jsonl"):
- r=json.loads(l)
- if r["status"]!="OK": continue
- n_ok+=1
- code=open(f"{W}/gen_s{i}/{r['task']}/code.py").read().strip()
- if code.count("\n")<4: continue
- h=hashlib.sha1(("```python\n"+code+"\n```").encode()).hexdigest()
- if h in seen: continue
- seen.add(h)
- p=prompts[r["task"]]
- new.append({"messages": p["messages"]+[{"role":"assistant","content":"```python\n"+code+"\n```"}], "source":"selftrain", "id":r["task"], "prompt_kind":"self"})
-print(f"verified OK generations: {n_ok}, new unique samples: {len(new)}")
-out="data/sft_v11_selftrain"; os.makedirs(out, exist_ok=True)
-allrows=base+new; random.shuffle(allrows)
-with open(f"{out}/train.jsonl","w") as f:
- for r in allrows: f.write(json.dumps(r, ensure_ascii=False)+"\n")
-import shutil; shutil.copy("$SRC/val.jsonl", f"{out}/val.jsonl")
-json.dump({"n_train":len(allrows),"n_new":len(new),"n_ok_generations":n_ok}, open(f"{out}/stats.json","w"), indent=1)
-PY
-python scripts/to_llamafactory.py --data_dir data/sft_v11_selftrain --name v11_selftrain >/dev/null && python scripts/make_lora_cfg.py $NAME v11_selftrain >/dev/null
-cat data/sft_v11_selftrain/stats.json
-echo "[self] $(date) data built -> train"
-# 5) train + eval (run_exp)
-scripts/run_exp.sh $GPU $NAME 2>&1 | tee -a logs/exp_$NAME.log
-echo "[self] DONE"
diff --git a/finetune/scripts/self_train_round2.sh b/finetune/scripts/self_train_round2.sh
deleted file mode 100755
index cfa58f2c..00000000
--- a/finetune/scripts/self_train_round2.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/bash
-# Round 2 (novel prompts): LoRA-v1 samples K completions for 9.9k articraft/deepcad-derived Blender prompts on 4 GPUs -> Blender filter -> v13 = v1 + verified -> LoRA (4-GPU DDP) -> eval
-set -uo pipefail; K=${1:-2}; T=${2:-0.8}; W=data/selftrain_round2; NAME=v13_boot; cd /wekafs/ict/hx_624/llm-ft
-echo "[r2] $(date) start K=$K T=$T"
-[ -d runs/lf_qwen35_9b_lora_v1/merged ] || scripts/lf_export.sh configs/lf/export_v1.yaml > logs/export_v1_r2.log 2>&1 || { echo "[r2] EXPORT FAILED"; exit 1; }
-source /wekafs/ict/hx_624/llm-ft/env.sh
-python - <<PY
-import json
-rows=[json.loads(l) for l in open("$W/prompts.jsonl")]
-for g in range(4):
- with open(f"$W/prompts_g{g}.jsonl","w") as f:
- for r in rows[g::4]: f.write(json.dumps(r)+"\n")
-print("sharded", len(rows))
-PY
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING
-for i in $(seq 1 $K); do
- for g in 0 1 2 3; do
- CUDA_VISIBLE_DEVICES=$g python eval/generate_vllm.py --model runs/lf_qwen35_9b_lora_v1/merged --prompts $W/prompts_g$g.jsonl --out $W/gen_s${i}_g$g --tp 1 --no_think --max_new_tokens 4096 --temperature $T --seed $((200+i*10+g)) > $W/gen_s${i}_g$g.log 2>&1 &
- done; wait
- for g in 0 1 2 3; do grep -E "gen-vllm|Error" $W/gen_s${i}_g$g.log | tail -1; done
-done
-rm -rf runs/lf_qwen35_9b_lora_v1/merged; echo "[r2] $(date) sampling done"
-conda activate llmft
-for d in $W/gen_s*_g*/; do python eval/run_bench.py --gen_dir $d --workers 56 --timeout 120 > $d/exec.log 2>&1; grep "status counts" $d/exec.log; done
-echo "[r2] $(date) exec done"
-python - <<PY
-import json, hashlib, os, random, shutil, glob
-random.seed(0); W="$W"; SRC="data/sft_v1"
-prompts={}
-for f in glob.glob(f"{W}/prompts_g*.jsonl"):
- for l in open(f): r=json.loads(l); prompts[r["task"]]=r
-base=[json.loads(l) for l in open(f"{SRC}/train.jsonl")]
-seen={hashlib.sha1(r["messages"][-1]["content"].encode()).hexdigest() for r in base}
-new=[]; n_ok=0; per_src={}
-for d in sorted(glob.glob(f"{W}/gen_s*_g*/")):
- if not os.path.exists(d+"exec_results.jsonl"): continue
- for l in open(d+"exec_results.jsonl"):
- r=json.loads(l)
- if r["status"]!="OK": continue
- n_ok+=1
- code=open(f"{d}/{r['task']}/code.py").read().strip()
- if code.count("\n")<4: continue
- h=hashlib.sha1(("```python\n"+code+"\n```").encode()).hexdigest()
- if h in seen: continue
- seen.add(h); p=prompts[r["task"]]; per_src[p["src"]]=per_src.get(p["src"],0)+1
- new.append({"messages": p["messages"]+[{"role":"assistant","content":"```python\n"+code+"\n```"}], "source":"boot_"+p["src"], "id":r["task"], "prompt_kind":"boot"})
-print(f"verified OK generations: {n_ok}, new unique samples: {len(new)}, by source: {per_src}")
-out="data/sft_v13_boot"; os.makedirs(out, exist_ok=True)
-allrows=base+new; random.shuffle(allrows)
-with open(f"{out}/train.jsonl","w") as f:
- for r in allrows: f.write(json.dumps(r, ensure_ascii=False)+"\n")
-shutil.copy(f"{SRC}/val.jsonl", f"{out}/val.jsonl")
-json.dump({"n_train":len(allrows),"n_new":len(new),"n_ok_generations":n_ok,"by_source":per_src}, open(f"{out}/stats.json","w"), indent=1)
-PY
-python scripts/to_llamafactory.py --data_dir data/sft_v13_boot --name v13_boot >/dev/null && python scripts/make_lora_cfg.py $NAME v13_boot >/dev/null
-cat data/sft_v13_boot/stats.json; echo "[r2] $(date) data built -> train on 4 GPUs"
-scripts/run_exp.sh 0,1,2,3 $NAME 2>&1 | tee -a logs/exp_$NAME.log
-echo "[r2] DONE"
diff --git a/finetune/scripts/smoke_27b.sh b/finetune/scripts/smoke_27b.sh
deleted file mode 100755
index e10005c4..00000000
--- a/finetune/scripts/smoke_27b.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-# 8-step smoke test of a 27B LoRA config to pick DDP vs ZeRO-3 before committing hours
-set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft; CFG=$1; TAG=$2
-GPUS=0,1,2,3 scripts/lf_train.sh $CFG max_steps=8 num_train_epochs=1.0 save_steps=100000 eval_steps=100000 \
- tokenized_path=/wekafs/ict/hx_624/llm-ft/data/lf/tokenized_md_27b_len8192_packed \
- output_dir=/wekafs/ict/hx_624/llm-ft/runs/_smoke_$TAG > logs/smoke_$TAG.log 2>&1
-if grep -q "train_runtime" logs/smoke_$TAG.log; then
- echo "[smoke $TAG] OK $(grep -oE '[0-9]+/8 \[[0-9:]+<[0-9:]+, *[0-9.]+s/it' logs/smoke_$TAG.log | tail -1)"
- grep -oE "'train_runtime': [0-9.]+" logs/smoke_$TAG.log | tail -1
-else
- echo "[smoke $TAG] FAILED: $(grep -E 'OutOfMemoryError|Error|RuntimeError' logs/smoke_$TAG.log | grep -v errors | tail -1 | cut -c1-160)"
-fi
-rm -rf runs/_smoke_$TAG
diff --git a/finetune/scripts/run_stop_dpo.sh b/finetune/scripts/stop_dpo_pairs.sh
similarity index 100%
rename from finetune/scripts/run_stop_dpo.sh
rename to finetune/scripts/stop_dpo_pairs.sh
diff --git a/finetune/scripts/stop_dpo_round.sh b/finetune/scripts/stop_dpo_round.sh
new file mode 100755
index 00000000..58790c51
--- /dev/null
+++ b/finetune/scripts/stop_dpo_round.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+# One full stop-DPO round: sample the model, pair its runaway greedy output against its own terminating
+# sampled output, train, merge. Termination pairs transfer across models, so a round is worth running on any
+# new SFT model. Replaces run_stop_dpo{,_r2,_train}.sh and run_stopdpo_{r2_plus,transfer}.sh, which differed
+# only in which model and tag they hardcoded.
+# scripts/stop_dpo_round.sh <base_model_dir> <tag>
+set -uo pipefail; cd /wekafs/ict/hx_624/llm-ft
+BASE=$(readlink -f "$1"); TAG=$2; RUN=runs/lf_${TAG}
+[ -d "$BASE" ] || { echo "[stopdpo] base model $BASE missing"; exit 1; }
+export TAG BASE_MODEL="$BASE"
+source /wekafs/ict/hx_624/.secrets/hf.env 2>/dev/null || true
+bash scripts/stop_dpo_pairs.sh
+PAIRS=data/lf/stop_dpo_pairs_${TAG}.json
+N=$(python3 -c "import json;print(len(json.load(open('$PAIRS'))))" 2>/dev/null || echo 0)
+echo "[stopdpo] $N pairs"
+# Round 1 removes most runaways; too few left means the behaviour is gone, and that is the result.
+[ "${N:-0}" -lt 100 ] && { echo "[stopdpo] only $N pairs left — stopping here"; exit 0; }
+CFG=configs/lf/_gen_dpo_${TAG}.yaml
+sed -e "s|^model_name_or_path:.*|model_name_or_path: $BASE|" \
+ -e "s|^dataset:.*|dataset: stop_dpo_pairs_${TAG}|" \
+ -e "s|^output_dir:.*|output_dir: $(pwd)/$RUN|" configs/lf/dpo_9b_lora16_lr5e-6_len2k_stop-r1.yaml > "$CFG"
+scripts/train_when_free.sh "$CFG" 60000 "logs/train_${TAG}.log" || exit 1
+scripts/export_lora.sh "$RUN" "$BASE" > "logs/export_${TAG}.log" 2>&1
+echo "[stopdpo] DONE -> $RUN/merged"
diff --git a/finetune/scripts/strip_thingi_fallback.py b/finetune/scripts/strip_thingi_fallback.py
deleted file mode 100644
index c06155ee..00000000
--- a/finetune/scripts/strip_thingi_fallback.py
+++ /dev/null
@@ -1,26 +0,0 @@
-"""Strip the embedded reference-mesh fallback from thingiverse-openscad-blender-5-0 'native_csg_generated' scripts.
-Writes <out>/<sample>/code.py (+ copies captions.json) for samples whose stripped script still parses."""
-import ast, glob, json, os, re, shutil, sys
-SRC = "/wekafs/ict/hx_624/data/thingiverse_5_0"; OUT = "/wekafs/ict/hx_624/data/thingiverse_5_0_native"
-os.makedirs(OUT, exist_ok=True); kept = dropped = 0
-for cp in sorted(glob.glob(f"{SRC}/*/code.py")):
- d = os.path.dirname(cp); rep = os.path.join(d, "reports/translation_report.json")
- st = json.load(open(rep)).get("status", "") if os.path.exists(rep) else ""
- if st != "native_csg_generated": continue
- code = open(cp).read()
- # 1) remove the fallback function definition
- code2 = re.sub(r"\ndef load_mesh_fallback\(\):.*?(?=\n(?:def |if __name__|[A-Za-z_])|\Z)", "\n", code, flags=re.S)
- # 2) rewrite 'try: <native> except ...: load_mesh_fallback()' -> just the native call (common pattern)
- code2 = re.sub(r"try:\n(\s+)(.*?)\n\s*except [^\n]*:\n\s+(?:[^\n]*\n)*?\s*(?:obj\s*=\s*)?load_mesh_fallback\(\)[^\n]*\n", lambda m: m.group(1) + m.group(2) + "\n", code2, flags=re.S)
- code2 = re.sub(r"^.*load_mesh_fallback\(\).*$", "", code2, flags=re.M)
- code2 = re.sub(r"^MESH_REFERENCE_ASSET\s*=.*$", "", code2, flags=re.M)
- if "load_mesh_fallback" in code2 or "reference_mesh" in code2:
- dropped += 1; continue
- try: ast.parse(code2)
- except SyntaxError: dropped += 1; continue
- od = os.path.join(OUT, os.path.basename(d)); os.makedirs(od, exist_ok=True)
- open(os.path.join(od, "code.py"), "w").write(code2)
- for f in ["captions.json", "meta.json"]:
- if os.path.exists(os.path.join(d, f)): shutil.copy(os.path.join(d, f), od)
- kept += 1
-print(f"kept {kept} dropped {dropped} -> {OUT}")
diff --git a/finetune/scripts/threejs_check.sh b/finetune/scripts/threejs_check.sh
deleted file mode 100755
index ab20f345..00000000
--- a/finetune/scripts/threejs_check.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-# three.js pipeline: wait Playwright -> reference runner check -> base eval (GPU) -> LoRA (300 samples, cutoff 16k) -> eval -> open the md_big gate
-set -uo pipefail; GPU=${GPUS:-2}; cd /wekafs/ict/hx_624/llm-ft; source /wekafs/ict/hx_624/llm-ft/env.sh; export PLAYWRIGHT_BROWSERS_PATH=/wekafs/ict/hx_624/cache/ms-playwright
-until grep -q PW_INSTALL_DONE /wekafs/ict/hx_624/tools/playwright_install.log 2>/dev/null; do sleep 15; done
-echo "[3js] $(date) runner check on 6 reference samples"
-python - <<'PY'
-import json, sys, re; sys.path.insert(0,"eval"); from threejs_runner import run_threejs
-rows=[json.loads(l) for l in open("data/multidialect/threejs/test.jsonl")][:6]
-ok=0
-for i,r in enumerate(rows):
- code=re.findall(r"```html\n(.*?)```", r["messages"][-1]["content"], flags=re.S)[0]
- rep=run_threejs(code, f"eval/out/_3js_refcheck/{i}"); ok+=rep["status"]=="OK"; print(i, rep["status"], (rep["error"] or "")[:120], rep["latency_s"], "s")
-print("REFCHECK_OK", ok, "/", len(rows))
-PY
-echo "[3js] $(date) base eval"
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm; export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=$GPU
-python - <<'PY'
-import json
-with open("eval/out/_3js_prompts.jsonl","w") as f:
- for l in open("data/multidialect/threejs/test.jsonl"):
- r=json.loads(l); f.write(json.dumps({"task": r["id"].replace("/","__"), "messages": r["messages"][:2]})+"\n")
-PY
-mkdir -p eval/out/md_base_threejs; python eval/generate_vllm.py --model /wekafs/ict/hx_624/models/Qwen3.5-9B --prompts eval/out/_3js_prompts.jsonl --out eval/out/md_base_threejs --tp 1 --no_think --max_new_tokens 12288 2>&1 | grep -E "gen-vllm|Error" | tail -1
-conda activate llmft; python eval/threejs_eval.py --gen_dir eval/out/md_base_threejs 2>&1 | tail -2
-echo "[3js] $(date) LoRA train (300 samples, cutoff 16k, 3 epochs) on GPU $GPU"
-GPUS=$GPU scripts/lf_train.sh configs/lf/lora_md_threejs.yaml > logs/train_md_threejs.log 2>&1
-RUN=runs/lf_qwen35_9b_lora_md_threejs; [ -f $RUN/train_results.json ] || { echo "[3js] TRAIN FAILED"; touch logs/.gate_threejs; exit 1; }
-echo "[3js] $(date) train done: $(tr -d '\n' < $RUN/train_results.json)"
-sed -e "s|adapter_name_or_path:.*|adapter_name_or_path: $(readlink -f $RUN)|" -e "s|export_dir:.*|export_dir: $(readlink -f $RUN)/merged|" configs/lf/export_lora_template.yaml > configs/lf/export_md_threejs.yaml
-scripts/lf_export.sh configs/lf/export_md_threejs.yaml > logs/export_md_threejs.log 2>&1 || { echo "[3js] EXPORT FAILED"; touch logs/.gate_threejs; exit 1; }
-conda activate vllm; mkdir -p eval/out/md_md_threejs_threejs; python eval/generate_vllm.py --model $RUN/merged --prompts eval/out/_3js_prompts.jsonl --out eval/out/md_md_threejs_threejs --tp 1 --no_think --max_new_tokens 12288 2>&1 | grep -E "gen-vllm|Error" | tail -1
-touch logs/.gate_threejs; echo "[3js] gate opened for md_big"
-conda activate llmft; python eval/threejs_eval.py --gen_dir eval/out/md_md_threejs_threejs 2>&1 | tail -2
-rm -rf $RUN/merged; echo "[3js] DONE"
diff --git a/finetune/scripts/threejs_regen32k.sh b/finetune/scripts/threejs_regen32k.sh
deleted file mode 100755
index 8845d6fc..00000000
--- a/finetune/scripts/threejs_regen32k.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-# re-merge the three.js LoRA (merged dir was cleaned up), re-generate with a 32k budget on GPU 2, evaluate
-cd /wekafs/ict/hx_624/llm-ft
-RUN=runs/lf_qwen35_9b_lora_md_threejs
-[ -f $RUN/merged/config.json ] || scripts/lf_export.sh configs/lf/export_md_threejs.yaml > logs/export_md_threejs_2.log 2>&1 || { echo "[3js32k] EXPORT FAILED"; exit 1; }
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=2 PLAYWRIGHT_BROWSERS_PATH=/wekafs/ict/hx_624/cache/ms-playwright
-echo "[3js32k] $(date) gen LoRA 32k"
-mkdir -p eval/out/md_md_threejs_threejs_32k
-python eval/generate_vllm.py --model $RUN/merged --prompts eval/out/_3js_prompts.jsonl --out eval/out/md_md_threejs_threejs_32k --tp 1 --no_think --max_new_tokens 30000 --max_model_len 32768 2>&1 | grep -E "gen-vllm|Error" | tail -1
-conda activate llmft
-python eval/threejs_eval.py --gen_dir eval/out/md_md_threejs_threejs_32k 2>&1 | tail -2
-echo "[3js32k] done2"
diff --git a/finetune/scripts/threejs_t07.sh b/finetune/scripts/threejs_t07.sh
deleted file mode 100755
index 5029b0c9..00000000
--- a/finetune/scripts/threejs_t07.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-cd /wekafs/ict/hx_624/llm-ft; RUN=runs/lf_qwen35_9b_lora_md_threejs
-source /wekafs/ict/hx_624/anaconda3/etc/profile.d/conda.sh; conda activate vllm
-export VLLM_CACHE_ROOT=/wekafs/ict/hx_624/cache/vllm HF_HOME=/wekafs/ict/hx_624/cache/huggingface VLLM_LOGGING_LEVEL=WARNING CUDA_VISIBLE_DEVICES=2 PLAYWRIGHT_BROWSERS_PATH=/wekafs/ict/hx_624/cache/ms-playwright
-for M in "$RUN/merged md_md_threejs_T07_threejs" "/wekafs/ict/hx_624/models/Qwen3.5-9B md_base_T07_threejs"; do set -- $M
- mkdir -p eval/out/$2; python eval/generate_vllm.py --model $1 --prompts eval/out/_3js_prompts.jsonl --out eval/out/$2 --tp 1 --no_think --max_new_tokens 12288 --temperature 0.7 --seed 1 2>&1 | grep -E "gen-vllm|Error" | tail -1
-done
-conda activate llmft
-for N in md_md_threejs_T07_threejs md_base_T07_threejs; do echo "== $N"; python eval/threejs_eval.py --gen_dir eval/out/$N 2>&1 | tail -2; done
-echo "[3jsT07] done"
diff --git a/finetune/scripts/to_llamafactory.py b/finetune/scripts/to_llamafactory.py
deleted file mode 100644
index 6d7248e9..00000000
--- a/finetune/scripts/to_llamafactory.py
+++ /dev/null
@@ -1,26 +0,0 @@
-"""Convert our messages-jsonl (system/user/assistant) into LLaMA-Factory sharegpt json + dataset_info.json entries."""
-import argparse, json, os
-ap = argparse.ArgumentParser()
-ap.add_argument("--data_dir", default="/wekafs/ict/hx_624/llm-ft/data/sft_v1")
-ap.add_argument("--out_dir", default="/wekafs/ict/hx_624/llm-ft/data/lf")
-ap.add_argument("--name", default="blender3d_v1")
-a = ap.parse_args()
-os.makedirs(a.out_dir, exist_ok=True)
-info_path = os.path.join(a.out_dir, "dataset_info.json")
-info = json.load(open(info_path)) if os.path.exists(info_path) else {}
-for split in ["train", "val"]:
- rows = []
- for l in open(os.path.join(a.data_dir, f"{split}.jsonl")):
- m = json.loads(l)["messages"]
- sys_msg = next((x["content"] for x in m if x["role"] == "system"), None)
- conv = []
- for x in m:
- if x["role"] == "user": conv.append({"from": "human", "value": x["content"]})
- elif x["role"] == "assistant": conv.append({"from": "gpt", "value": x["content"]})
- rows.append({"conversations": conv, "system": sys_msg})
- fn = f"{a.name}_{split}.json"
- json.dump(rows, open(os.path.join(a.out_dir, fn), "w"), ensure_ascii=False)
- info[f"{a.name}_{split}"] = {"file_name": fn, "formatting": "sharegpt", "columns": {"messages": "conversations", "system": "system"}}
- print(split, len(rows), "->", fn)
-json.dump(info, open(info_path, "w"), indent=2)
-print("dataset_info:", list(info.keys()))
diff --git a/finetune/scripts/train_sft.py b/finetune/scripts/train_sft.py
deleted file mode 100644
index f13e3b32..00000000
--- a/finetune/scripts/train_sft.py
+++ /dev/null
@@ -1,129 +0,0 @@
-"""SFT (full or LoRA) of a causal LM on chat-format jsonl using TRL SFTTrainer.
-
-Data: jsonl rows with {"messages":[system,user,assistant]} -> converted to conversational prompt/completion
-so that the loss is computed on the assistant completion only.
-"""
-import argparse, json, os, sys, time
-import torch
-from datasets import load_dataset
-from transformers import AutoTokenizer, AutoModelForCausalLM
-from trl import SFTConfig, SFTTrainer
-
-def parse():
- ap = argparse.ArgumentParser()
- ap.add_argument("--model", required=True)
- ap.add_argument("--data_dir", required=True)
- ap.add_argument("--output_dir", required=True)
- ap.add_argument("--max_length", type=int, default=8192)
- ap.add_argument("--epochs", type=float, default=2.0)
- ap.add_argument("--lr", type=float, default=1e-5)
- ap.add_argument("--warmup_ratio", type=float, default=0.03)
- ap.add_argument("--per_device_bs", type=int, default=1)
- ap.add_argument("--grad_accum", type=int, default=8)
- ap.add_argument("--eval_bs", type=int, default=2)
- ap.add_argument("--lora", action="store_true")
- ap.add_argument("--lora_r", type=int, default=64)
- ap.add_argument("--lora_alpha", type=int, default=128)
- ap.add_argument("--lora_dropout", type=float, default=0.05)
- ap.add_argument("--packing", action="store_true")
- ap.add_argument("--no_liger", action="store_true")
- ap.add_argument("--attn", default="auto", help="auto|flash_attention_2|sdpa|eager")
- ap.add_argument("--grad_ckpt", action="store_true", default=True)
- ap.add_argument("--deepspeed", default=None)
- ap.add_argument("--save_steps", type=int, default=200)
- ap.add_argument("--eval_steps", type=int, default=100)
- ap.add_argument("--logging_steps", type=int, default=5)
- ap.add_argument("--seed", type=int, default=42)
- ap.add_argument("--max_train_samples", type=int, default=None)
- ap.add_argument("--report_to", default="tensorboard")
- ap.add_argument("--run_name", default=None)
- ap.add_argument("--weight_decay", type=float, default=0.0)
- ap.add_argument("--neftune", type=float, default=None)
- return ap.parse_args()
-
-def to_prompt_completion(ex):
- msgs = ex["messages"]
- return {"prompt": msgs[:-1], "completion": [msgs[-1]]}
-
-def main():
- a = parse()
- torch.manual_seed(a.seed)
- attn = a.attn
- if attn == "auto":
- try:
- import flash_attn # noqa
- attn = "flash_attention_2"
- except Exception:
- attn = "sdpa"
- tok = AutoTokenizer.from_pretrained(a.model)
- if tok.pad_token is None:
- tok.pad_token = tok.eos_token
-
- ds = load_dataset("json", data_files={"train": f"{a.data_dir}/train.jsonl", "val": f"{a.data_dir}/val.jsonl"})
- keep = ["messages"]
- ds = ds.map(to_prompt_completion, remove_columns=[c for c in ds["train"].column_names if c not in keep])
- ds = ds.remove_columns(["messages"])
- if a.max_train_samples:
- ds["train"] = ds["train"].select(range(min(a.max_train_samples, len(ds["train"]))))
- print(f"[data] train={len(ds['train'])} val={len(ds['val'])} attn={attn}", flush=True)
-
- model_kwargs = dict(dtype=torch.bfloat16, attn_implementation=attn)
- model = AutoModelForCausalLM.from_pretrained(a.model, **model_kwargs)
- model.config.use_cache = False
-
- peft_config = None
- if a.lora:
- from peft import LoraConfig
- peft_config = LoraConfig(r=a.lora_r, lora_alpha=a.lora_alpha, lora_dropout=a.lora_dropout, bias="none",
- task_type="CAUSAL_LM",
- target_modules=["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"])
-
- cfg_kwargs = dict(
- output_dir=a.output_dir, run_name=a.run_name or os.path.basename(a.output_dir.rstrip("/")),
- num_train_epochs=a.epochs, learning_rate=a.lr, lr_scheduler_type="cosine", warmup_ratio=a.warmup_ratio,
- weight_decay=a.weight_decay,
- per_device_train_batch_size=a.per_device_bs, per_device_eval_batch_size=a.eval_bs,
- gradient_accumulation_steps=a.grad_accum,
- bf16=True, tf32=True,
- gradient_checkpointing=a.grad_ckpt, gradient_checkpointing_kwargs={"use_reentrant": False},
- logging_steps=a.logging_steps, eval_strategy="steps", eval_steps=a.eval_steps,
- save_strategy="steps", save_steps=a.save_steps, save_total_limit=2,
- report_to=a.report_to, seed=a.seed,
- max_length=a.max_length, packing=a.packing,
- completion_only_loss=True,
- use_liger_kernel=not a.no_liger,
- dataloader_num_workers=2, remove_unused_columns=True,
- deepspeed=a.deepspeed,
- ddp_find_unused_parameters=False,
- save_only_model=True,
- )
- if a.neftune: cfg_kwargs["neftune_noise_alpha"] = a.neftune
- cfg = SFTConfig(**cfg_kwargs)
-
- trainer = SFTTrainer(model=model, args=cfg, train_dataset=ds["train"], eval_dataset=ds["val"],
- processing_class=tok, peft_config=peft_config)
- if trainer.accelerator.is_main_process:
- n_tr = sum(p.numel() for p in trainer.model.parameters() if p.requires_grad)
- n_all = sum(p.numel() for p in trainer.model.parameters())
- print(f"[model] trainable={n_tr/1e6:.1f}M / total={n_all/1e6:.1f}M ({100*n_tr/max(n_all,1):.2f}%)", flush=True)
- # show one tokenized example length
- ex = trainer.train_dataset[0]
- print("[data] example keys:", list(ex.keys()), "| input_ids len:", len(ex.get("input_ids", [])), flush=True)
- t0 = time.time()
- trainer.train()
- if trainer.accelerator.is_main_process:
- print(f"[done] train time {(time.time()-t0)/60:.1f} min", flush=True)
- trainer.save_model(os.path.join(a.output_dir, "final"))
- tok.save_pretrained(os.path.join(a.output_dir, "final"))
- if a.lora and trainer.accelerator.is_main_process:
- # also save a merged full model for easy eval
- try:
- merged = trainer.model.merge_and_unload()
- merged.save_pretrained(os.path.join(a.output_dir, "final_merged"), safe_serialization=True)
- tok.save_pretrained(os.path.join(a.output_dir, "final_merged"))
- print("[done] merged model saved", flush=True)
- except Exception as e:
- print("merge failed:", e)
-
-if __name__ == "__main__":
- main()
diff --git a/finetune/scripts/train_when_free.sh b/finetune/scripts/train_when_free.sh
new file mode 100755
index 00000000..a2ad2723
--- /dev/null
+++ b/finetune/scripts/train_when_free.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+# Launch a LLaMA-Factory config as soon as a card is genuinely free, and survive losing the race.
+# free_gpus.sh can name a card that another user fills during the ~2 min of model loading; that
+# surfaces as a CUDA OOM minutes later, which is how the round-2 stop-DPO run died.
+# scripts/train_when_free.sh <config.yaml> [need_free_mib] [logfile]
+set -u
+CFG=$1; NEED=${2:-60000}; LOG=${3:-logs/$(basename "${CFG%.yaml}").log}
+for attempt in $(seq 1 200); do
+ G=$(scripts/free_gpus.sh "$NEED" | cut -d, -f1)
+ if [ -n "$G" ]; then
+ sleep 45 # let any competing job finish allocating
+ STILL=$(scripts/free_gpus.sh "$NEED" "$G" | cut -d, -f1) # ...and confirm the card is still free
+ if [ -n "$STILL" ]; then
+ echo "[twf] attempt $attempt: GPU $G <- $(basename "$CFG")"
+ GPUS=$G scripts/lf_train.sh "$CFG" > "$LOG" 2>&1 && { echo "[twf] DONE"; exit 0; }
+ if grep -qi "OutOfMemory" "$LOG"; then
+ echo "[twf] lost GPU $G to another user; will retry"; cp "$LOG" "$LOG.oom.$attempt"; sleep 300; continue
+ fi
+ echo "[twf] FAILED (not OOM) — see $LOG"; exit 1
+ fi
+ fi
+ sleep 120
+done