Ouzhang commited on
Commit
b2632a6
·
verified ·
1 Parent(s): 8b501b0

Upload folder using huggingface_hub

Browse files
10_paper_strengthening/README.md ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Paper Strengthening Experiments
2
+
3
+ These scripts add the experiments needed to make the project closer to a
4
+ defensible paper rather than only a working demo.
5
+
6
+ Run them after `01_data`, `02_predictor`, and the first `04_diffusion`
7
+ conditioned model are complete.
8
+
9
+ Before running any script on the GPU server, set the project-local paths:
10
+
11
+ ```bash
12
+ cd /inspire/hdd/project/intelligentcreativedesign/dangshengqi-253114050252/z-anna/genrl-enhancer-diffusion
13
+
14
+ export PROJECT_ROOT=$(pwd)
15
+ export RUN_ROOT=${PROJECT_ROOT}/paper_runs
16
+ export HF_ENDPOINT=https://hf-mirror.com
17
+ export TRANSFORMERS_NO_TF=1
18
+ export USE_TF=0
19
+ export TOKENIZERS_PARALLELISM=false
20
+
21
+ source scripts/00_setup/env.sh
22
+
23
+ export DEEPSTARR_DIR=${PROJECT_ROOT}/datas/DeepSTARR-enhancer-activity
24
+ export DEEPSTARR_DATASET_ID=${DEEPSTARR_DIR}
25
+ export GENERATOR_BASE_MODEL=${PROJECT_ROOT}/models/GENERator-eukaryote-1.2b-base
26
+ export GENERANNO_BASE_MODEL=${PROJECT_ROOT}/models/GENERanno-eukaryote-0.5b-base
27
+ export PREDICTOR_DIR=${PROJECT_ROOT}/paper_runs/results/deepstarr_regression
28
+ export PREDICTOR_MODEL=${PREDICTOR_DIR}/best_model
29
+ export DIFFUSION_MODEL=${PROJECT_ROOT}/saved_model/deepstarr_discrete_diffusion
30
+ ```
31
+
32
+ ## Priority Order
33
+
34
+ ### P0: Minimum paper closure
35
+
36
+ Run AR baselines, score them with the same predictor, score diffusion with the
37
+ same predictor, then build tables and figures.
38
+
39
+ ```bash
40
+ nohup bash scripts/10_paper_strengthening/p0_minimum_paper_closure.sh > p0_minimum_paper_closure.log 2>&1 &
41
+ tail -f p0_minimum_paper_closure.log
42
+ ```
43
+
44
+ This is the minimum set for a paper-style comparison:
45
+
46
+ - Reference DeepSTARR sequences.
47
+ - GC-matched random baseline.
48
+ - AR unconditional generation.
49
+ - AR bucket-conditioned generation.
50
+ - Masked diffusion bucket-conditioned generation.
51
+ - Shared predictor scoring.
52
+ - Sequence quality and distribution metrics.
53
+
54
+ ### P1: Core ablations
55
+
56
+ Mask-ratio ablation:
57
+
58
+ ```bash
59
+ nohup bash scripts/10_paper_strengthening/p1_mask_ratio_ablation.sh > p1_mask_ratio_ablation.log 2>&1 &
60
+ tail -f p1_mask_ratio_ablation.log
61
+ ```
62
+
63
+ Conditioning ablation:
64
+
65
+ ```bash
66
+ nohup bash scripts/10_paper_strengthening/p1_conditioning_ablation.sh > p1_conditioning_ablation.log 2>&1 &
67
+ tail -f p1_conditioning_ablation.log
68
+ ```
69
+
70
+ These directly support the paper claim that mask-controlled diffusion is a
71
+ mutation-budget design method and that conditioning improves controllability.
72
+
73
+ ### P2: Final split and efficiency analysis
74
+
75
+ Evaluate the best diffusion model on the test split:
76
+
77
+ ```bash
78
+ nohup bash scripts/10_paper_strengthening/p2_test_split_diffusion.sh > p2_test_split_diffusion.log 2>&1 &
79
+ tail -f p2_test_split_diffusion.log
80
+ ```
81
+
82
+ Evaluate different denoising step counts:
83
+
84
+ ```bash
85
+ nohup bash scripts/10_paper_strengthening/p2_diffusion_steps_ablation.sh > p2_diffusion_steps_ablation.log 2>&1 &
86
+ tail -f p2_diffusion_steps_ablation.log
87
+ ```
88
+
89
+ ### P3: Seed robustness
90
+
91
+ Run generation/evaluation with several seeds:
92
+
93
+ ```bash
94
+ nohup bash scripts/10_paper_strengthening/p3_seed_repeats_diffusion.sh > p3_seed_repeats_diffusion.log 2>&1 &
95
+ tail -f p3_seed_repeats_diffusion.log
96
+ ```
97
+
98
+ Use the resulting means and standard deviations in the final tables.
99
+
10_paper_strengthening/p0_minimum_paper_closure.sh ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+ source "${SCRIPT_DIR}/../00_setup/env.sh"
6
+
7
+ : "${DEEPSTARR_DIR:?Set DEEPSTARR_DIR to the local DeepSTARR parquet directory.}"
8
+ : "${GENERATOR_BASE_MODEL:?Set GENERATOR_BASE_MODEL to the local GENERator model.}"
9
+ : "${GENERANNO_BASE_MODEL:?Set GENERANNO_BASE_MODEL to the local GENERanno model.}"
10
+ : "${PREDICTOR_MODEL:?Set PREDICTOR_MODEL to the trained predictor best_model directory.}"
11
+ : "${DIFFUSION_MODEL:?Set DIFFUSION_MODEL to the trained diffusion saved model directory.}"
12
+
13
+ export NUM_PER_BUCKET="${NUM_PER_BUCKET:-128}"
14
+ export NUM_DIFFUSION_STEPS="${NUM_DIFFUSION_STEPS:-64}"
15
+ export DIFFUSION_EVAL_BATCH_SIZE="${DIFFUSION_EVAL_BATCH_SIZE:-512}"
16
+ export PREDICTOR_SCORE_BATCH_SIZE="${PREDICTOR_SCORE_BATCH_SIZE:-64}"
17
+ export DIFFUSION_SCORE_BATCH_SIZE="${DIFFUSION_SCORE_BATCH_SIZE:-64}"
18
+ export PLL_CHUNK_SIZE="${PLL_CHUNK_SIZE:-64}"
19
+
20
+ bash "${SCRIPT_DIR}/../02_predictor/plot_predictor_validation.sh"
21
+
22
+ bash "${SCRIPT_DIR}/../03_ar_generation/train_ar_unconditional.sh"
23
+ bash "${SCRIPT_DIR}/../03_ar_generation/train_ar_conditioned.sh"
24
+ bash "${SCRIPT_DIR}/../03_ar_generation/evaluate_ar_unconditional.sh"
25
+ bash "${SCRIPT_DIR}/../03_ar_generation/evaluate_ar_conditioned.sh"
26
+
27
+ bash "${SCRIPT_DIR}/../05_scoring/score_ar_unconditional.sh"
28
+ bash "${SCRIPT_DIR}/../05_scoring/score_ar_conditioned.sh"
29
+
30
+ bash "${SCRIPT_DIR}/../04_diffusion/evaluate_diffusion_with_predictor.sh"
31
+
32
+ bash "${SCRIPT_DIR}/../06_sequence_metrics/compute_sequence_metrics.sh"
33
+ bash "${SCRIPT_DIR}/../08_visualization/make_paper_figures.sh"
34
+
35
+ echo "P0 minimum paper closure completed under ${RUN_ROOT}"
36
+
10_paper_strengthening/p1_conditioning_ablation.sh ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+ source "${SCRIPT_DIR}/../00_setup/env.sh"
6
+
7
+ : "${DEEPSTARR_DIR:?Set DEEPSTARR_DIR to the local DeepSTARR parquet directory.}"
8
+ : "${GENERANNO_BASE_MODEL:?Set GENERANNO_BASE_MODEL to the local GENERanno model.}"
9
+ : "${PREDICTOR_MODEL:?Set PREDICTOR_MODEL to the trained predictor best_model directory.}"
10
+
11
+ export DIFFUSION_ABLATION_EPOCHS="${DIFFUSION_ABLATION_EPOCHS:-1}"
12
+ export DIFFUSION_ABLATION_BATCH_SIZE="${DIFFUSION_ABLATION_BATCH_SIZE:-128}"
13
+ export DIFFUSION_ABLATION_GRAD_ACCUM="${DIFFUSION_ABLATION_GRAD_ACCUM:-1}"
14
+ export DIFFUSION_ABLATION_LR="${DIFFUSION_ABLATION_LR:-5e-5}"
15
+ export DIFFUSION_EVAL_BATCH_SIZE="${DIFFUSION_EVAL_BATCH_SIZE:-512}"
16
+ export PREDICTOR_SCORE_BATCH_SIZE="${PREDICTOR_SCORE_BATCH_SIZE:-64}"
17
+ export NUM_PER_BUCKET="${NUM_PER_BUCKET:-128}"
18
+ export NUM_DIFFUSION_STEPS="${NUM_DIFFUSION_STEPS:-64}"
19
+
20
+ mkdir -p "${MODEL_ROOT}/ablations" "${RESULT_ROOT}/ablations"
21
+
22
+ cd "${GENERANNO_DIR}"
23
+
24
+ UNCOND_MODEL="${MODEL_ROOT}/ablations/diffusion_unconditioned"
25
+ UNCOND_CKPT="${RESULT_ROOT}/checkpoints/diffusion_unconditioned"
26
+ UNCOND_RESULT="${RESULT_ROOT}/ablations/diffusion_unconditioned_valid_predictor"
27
+
28
+ python3 src/tasks/downstream/discrete_diffusion_train.py \
29
+ --model_name "${GENERANNO_BASE_MODEL}" \
30
+ --dataset_dir "${DEEPSTARR_DIR}" \
31
+ --output_dir "${UNCOND_CKPT}" \
32
+ --saved_model_dir "${UNCOND_MODEL}" \
33
+ --sequence_col sequence \
34
+ --label_col label \
35
+ --score_mode sum \
36
+ --max_length "${DIFFUSION_MAX_LENGTH:-256}" \
37
+ --num_train_epochs "${DIFFUSION_ABLATION_EPOCHS}" \
38
+ --batch_size "${DIFFUSION_ABLATION_BATCH_SIZE}" \
39
+ --gradient_accumulation_steps "${DIFFUSION_ABLATION_GRAD_ACCUM}" \
40
+ --learning_rate "${DIFFUSION_ABLATION_LR}" \
41
+ --num_diffusion_steps "${NUM_DIFFUSION_STEPS}" \
42
+ --bf16 \
43
+ --gradient_checkpointing \
44
+ --report_to none \
45
+ --run_name diffusion_unconditioned
46
+
47
+ python3 src/tasks/downstream/discrete_diffusion_evaluate.py \
48
+ --diffusion_model "${UNCOND_MODEL}" \
49
+ --base_model_for_code "${GENERANNO_BASE_MODEL}" \
50
+ --dataset_dir "${DEEPSTARR_DIR}" \
51
+ --predictor_model "${PREDICTOR_MODEL}" \
52
+ --split valid \
53
+ --num_per_bucket "${NUM_PER_BUCKET}" \
54
+ --sequence_length "${SEQUENCE_LENGTH:-246}" \
55
+ --num_diffusion_steps "${NUM_DIFFUSION_STEPS}" \
56
+ --batch_size "${DIFFUSION_EVAL_BATCH_SIZE}" \
57
+ --predictor_batch_size "${PREDICTOR_SCORE_BATCH_SIZE}" \
58
+ --max_length "${DIFFUSION_MAX_LENGTH:-256}" \
59
+ --temperature "${DIFFUSION_TEMPERATURE:-1.0}" \
60
+ --bf16 \
61
+ --attn_implementation "${ATTN_IMPLEMENTATION:-sdpa}" \
62
+ --output_dir "${UNCOND_RESULT}"
63
+
64
+ echo "P1 conditioning ablation completed under ${UNCOND_RESULT}"
65
+
10_paper_strengthening/p1_mask_ratio_ablation.sh ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+ source "${SCRIPT_DIR}/../00_setup/env.sh"
6
+
7
+ : "${DEEPSTARR_DIR:?Set DEEPSTARR_DIR to the local DeepSTARR parquet directory.}"
8
+ : "${GENERANNO_BASE_MODEL:?Set GENERANNO_BASE_MODEL to the local GENERanno model.}"
9
+ : "${PREDICTOR_MODEL:?Set PREDICTOR_MODEL to the trained predictor best_model directory.}"
10
+
11
+ export DIFFUSION_ABLATION_EPOCHS="${DIFFUSION_ABLATION_EPOCHS:-1}"
12
+ export DIFFUSION_ABLATION_BATCH_SIZE="${DIFFUSION_ABLATION_BATCH_SIZE:-1024}"
13
+ export DIFFUSION_ABLATION_GRAD_ACCUM="${DIFFUSION_ABLATION_GRAD_ACCUM:-1}"
14
+ export DIFFUSION_ABLATION_LR="${DIFFUSION_ABLATION_LR:-5e-5}"
15
+ export DIFFUSION_EVAL_BATCH_SIZE="${DIFFUSION_EVAL_BATCH_SIZE:-1024}"
16
+ export PREDICTOR_SCORE_BATCH_SIZE="${PREDICTOR_SCORE_BATCH_SIZE:-1024}"
17
+ export NUM_PER_BUCKET="${NUM_PER_BUCKET:-128}"
18
+ export NUM_DIFFUSION_STEPS="${NUM_DIFFUSION_STEPS:-64}"
19
+
20
+ mkdir -p "${MODEL_ROOT}/ablations" "${RESULT_ROOT}/ablations"
21
+
22
+ cd "${GENERANNO_DIR}"
23
+
24
+ run_mask_ablation() {
25
+ local name="$1"
26
+ local mask_min="$2"
27
+ local mask_max="$3"
28
+ local ckpt_dir="${RESULT_ROOT}/checkpoints/diffusion_mask_${name}"
29
+ local model_dir="${MODEL_ROOT}/ablations/diffusion_mask_${name}"
30
+ local result_dir="${RESULT_ROOT}/ablations/diffusion_mask_${name}_valid_predictor"
31
+
32
+ python3 src/tasks/downstream/discrete_diffusion_train.py \
33
+ --model_name "${GENERANNO_BASE_MODEL}" \
34
+ --dataset_dir "${DEEPSTARR_DIR}" \
35
+ --output_dir "${ckpt_dir}" \
36
+ --saved_model_dir "${model_dir}" \
37
+ --conditioned \
38
+ --sequence_col sequence \
39
+ --label_col label \
40
+ --score_mode sum \
41
+ --max_length "${DIFFUSION_MAX_LENGTH:-256}" \
42
+ --num_train_epochs "${DIFFUSION_ABLATION_EPOCHS}" \
43
+ --batch_size "${DIFFUSION_ABLATION_BATCH_SIZE}" \
44
+ --gradient_accumulation_steps "${DIFFUSION_ABLATION_GRAD_ACCUM}" \
45
+ --learning_rate "${DIFFUSION_ABLATION_LR}" \
46
+ --mask_prob_min "${mask_min}" \
47
+ --mask_prob_max "${mask_max}" \
48
+ --num_diffusion_steps "${NUM_DIFFUSION_STEPS}" \
49
+ --bf16 \
50
+ --gradient_checkpointing \
51
+ --report_to none \
52
+ --run_name "diffusion_mask_${name}"
53
+
54
+ python3 src/tasks/downstream/discrete_diffusion_evaluate.py \
55
+ --diffusion_model "${model_dir}" \
56
+ --base_model_for_code "${GENERANNO_BASE_MODEL}" \
57
+ --dataset_dir "${DEEPSTARR_DIR}" \
58
+ --predictor_model "${PREDICTOR_MODEL}" \
59
+ --split valid \
60
+ --conditioned \
61
+ --num_per_bucket "${NUM_PER_BUCKET}" \
62
+ --sequence_length "${SEQUENCE_LENGTH:-246}" \
63
+ --num_diffusion_steps "${NUM_DIFFUSION_STEPS}" \
64
+ --batch_size "${DIFFUSION_EVAL_BATCH_SIZE}" \
65
+ --predictor_batch_size "${PREDICTOR_SCORE_BATCH_SIZE}" \
66
+ --max_length "${DIFFUSION_MAX_LENGTH:-256}" \
67
+ --temperature "${DIFFUSION_TEMPERATURE:-1.0}" \
68
+ --bf16 \
69
+ --attn_implementation "${ATTN_IMPLEMENTATION:-sdpa}" \
70
+ --output_dir "${result_dir}"
71
+ }
72
+
73
+ run_mask_ablation "015_030" 0.15 0.30
74
+ run_mask_ablation "030_050" 0.30 0.50
75
+ run_mask_ablation "050_070" 0.50 0.70
76
+ run_mask_ablation "070_090" 0.70 0.90
77
+
78
+ echo "P1 mask-ratio ablation completed under ${RESULT_ROOT}/ablations"
79
+
10_paper_strengthening/p2_diffusion_steps_ablation.sh ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+ source "${SCRIPT_DIR}/../00_setup/env.sh"
6
+
7
+ : "${DEEPSTARR_DIR:?Set DEEPSTARR_DIR to the local DeepSTARR parquet directory.}"
8
+ : "${DIFFUSION_MODEL:?Set DIFFUSION_MODEL to the trained diffusion saved model directory.}"
9
+ : "${GENERANNO_BASE_MODEL:?Set GENERANNO_BASE_MODEL to the local GENERanno model.}"
10
+ : "${PREDICTOR_MODEL:?Set PREDICTOR_MODEL to the trained predictor best_model directory.}"
11
+
12
+ export NUM_PER_BUCKET="${NUM_PER_BUCKET:-128}"
13
+ export DIFFUSION_EVAL_BATCH_SIZE="${DIFFUSION_EVAL_BATCH_SIZE:-512}"
14
+ export PREDICTOR_SCORE_BATCH_SIZE="${PREDICTOR_SCORE_BATCH_SIZE:-64}"
15
+
16
+ mkdir -p "${RESULT_ROOT}/ablations"
17
+
18
+ cd "${GENERANNO_DIR}"
19
+
20
+ for steps in 16 32 64 128; do
21
+ python3 src/tasks/downstream/discrete_diffusion_evaluate.py \
22
+ --diffusion_model "${DIFFUSION_MODEL}" \
23
+ --base_model_for_code "${GENERANNO_BASE_MODEL}" \
24
+ --dataset_dir "${DEEPSTARR_DIR}" \
25
+ --predictor_model "${PREDICTOR_MODEL}" \
26
+ --split valid \
27
+ --conditioned \
28
+ --num_per_bucket "${NUM_PER_BUCKET}" \
29
+ --sequence_length "${SEQUENCE_LENGTH:-246}" \
30
+ --num_diffusion_steps "${steps}" \
31
+ --batch_size "${DIFFUSION_EVAL_BATCH_SIZE}" \
32
+ --predictor_batch_size "${PREDICTOR_SCORE_BATCH_SIZE}" \
33
+ --max_length "${DIFFUSION_MAX_LENGTH:-256}" \
34
+ --temperature "${DIFFUSION_TEMPERATURE:-1.0}" \
35
+ --bf16 \
36
+ --attn_implementation "${ATTN_IMPLEMENTATION:-sdpa}" \
37
+ --output_dir "${RESULT_ROOT}/ablations/diffusion_steps_${steps}_valid_predictor"
38
+ done
39
+
40
+ echo "P2 diffusion step ablation completed under ${RESULT_ROOT}/ablations"
41
+
10_paper_strengthening/p2_test_split_diffusion.sh ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+ source "${SCRIPT_DIR}/../00_setup/env.sh"
6
+
7
+ : "${DEEPSTARR_DIR:?Set DEEPSTARR_DIR to the local DeepSTARR parquet directory.}"
8
+ : "${DIFFUSION_MODEL:?Set DIFFUSION_MODEL to the trained diffusion saved model directory.}"
9
+ : "${GENERANNO_BASE_MODEL:?Set GENERANNO_BASE_MODEL to the local GENERanno model.}"
10
+ : "${PREDICTOR_MODEL:?Set PREDICTOR_MODEL to the trained predictor best_model directory.}"
11
+
12
+ export NUM_PER_BUCKET="${NUM_PER_BUCKET:-128}"
13
+ export NUM_DIFFUSION_STEPS="${NUM_DIFFUSION_STEPS:-64}"
14
+ export DIFFUSION_EVAL_BATCH_SIZE="${DIFFUSION_EVAL_BATCH_SIZE:-512}"
15
+ export PREDICTOR_SCORE_BATCH_SIZE="${PREDICTOR_SCORE_BATCH_SIZE:-64}"
16
+
17
+ cd "${GENERANNO_DIR}"
18
+ python3 src/tasks/downstream/discrete_diffusion_evaluate.py \
19
+ --diffusion_model "${DIFFUSION_MODEL}" \
20
+ --base_model_for_code "${GENERANNO_BASE_MODEL}" \
21
+ --dataset_dir "${DEEPSTARR_DIR}" \
22
+ --predictor_model "${PREDICTOR_MODEL}" \
23
+ --split test \
24
+ --conditioned \
25
+ --num_per_bucket "${NUM_PER_BUCKET}" \
26
+ --sequence_length "${SEQUENCE_LENGTH:-246}" \
27
+ --num_diffusion_steps "${NUM_DIFFUSION_STEPS}" \
28
+ --batch_size "${DIFFUSION_EVAL_BATCH_SIZE}" \
29
+ --predictor_batch_size "${PREDICTOR_SCORE_BATCH_SIZE}" \
30
+ --max_length "${DIFFUSION_MAX_LENGTH:-256}" \
31
+ --temperature "${DIFFUSION_TEMPERATURE:-1.0}" \
32
+ --bf16 \
33
+ --attn_implementation "${ATTN_IMPLEMENTATION:-sdpa}" \
34
+ --output_dir "${RESULT_ROOT}/diffusion_test_predictor"
35
+
36
+ echo "P2 test split diffusion evaluation completed under ${RESULT_ROOT}/diffusion_test_predictor"
37
+
10_paper_strengthening/p3_seed_repeats_diffusion.sh ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+ source "${SCRIPT_DIR}/../00_setup/env.sh"
6
+
7
+ : "${DEEPSTARR_DIR:?Set DEEPSTARR_DIR to the local DeepSTARR parquet directory.}"
8
+ : "${DIFFUSION_MODEL:?Set DIFFUSION_MODEL to the trained diffusion saved model directory.}"
9
+ : "${GENERANNO_BASE_MODEL:?Set GENERANNO_BASE_MODEL to the local GENERanno model.}"
10
+ : "${PREDICTOR_MODEL:?Set PREDICTOR_MODEL to the trained predictor best_model directory.}"
11
+
12
+ export NUM_PER_BUCKET="${NUM_PER_BUCKET:-128}"
13
+ export NUM_DIFFUSION_STEPS="${NUM_DIFFUSION_STEPS:-64}"
14
+ export DIFFUSION_EVAL_BATCH_SIZE="${DIFFUSION_EVAL_BATCH_SIZE:-512}"
15
+ export PREDICTOR_SCORE_BATCH_SIZE="${PREDICTOR_SCORE_BATCH_SIZE:-64}"
16
+ export DIFFUSION_SEEDS="${DIFFUSION_SEEDS:-11 22 33}"
17
+
18
+ mkdir -p "${RESULT_ROOT}/seed_repeats"
19
+
20
+ cd "${GENERANNO_DIR}"
21
+
22
+ for seed in ${DIFFUSION_SEEDS}; do
23
+ python3 src/tasks/downstream/discrete_diffusion_evaluate.py \
24
+ --diffusion_model "${DIFFUSION_MODEL}" \
25
+ --base_model_for_code "${GENERANNO_BASE_MODEL}" \
26
+ --dataset_dir "${DEEPSTARR_DIR}" \
27
+ --predictor_model "${PREDICTOR_MODEL}" \
28
+ --split valid \
29
+ --conditioned \
30
+ --num_per_bucket "${NUM_PER_BUCKET}" \
31
+ --sequence_length "${SEQUENCE_LENGTH:-246}" \
32
+ --num_diffusion_steps "${NUM_DIFFUSION_STEPS}" \
33
+ --batch_size "${DIFFUSION_EVAL_BATCH_SIZE}" \
34
+ --predictor_batch_size "${PREDICTOR_SCORE_BATCH_SIZE}" \
35
+ --max_length "${DIFFUSION_MAX_LENGTH:-256}" \
36
+ --temperature "${DIFFUSION_TEMPERATURE:-1.0}" \
37
+ --seed "${seed}" \
38
+ --bf16 \
39
+ --attn_implementation "${ATTN_IMPLEMENTATION:-sdpa}" \
40
+ --output_dir "${RESULT_ROOT}/seed_repeats/diffusion_seed_${seed}_valid_predictor"
41
+ done
42
+
43
+ echo "P3 diffusion seed repeats completed under ${RESULT_ROOT}/seed_repeats"
44
+
evaluate_ar_conditioned.sh ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+ source "${SCRIPT_DIR}/../00_setup/env.sh"
6
+
7
+ for filename in modeling_generator.py tokenizer.py; do
8
+ if [[ -f "${GENERATOR_BASE_MODEL}/${filename}" && ! -f "${AR_COND_MODEL}/${filename}" ]]; then
9
+ cp "${GENERATOR_BASE_MODEL}/${filename}" "${AR_COND_MODEL}/${filename}"
10
+ fi
11
+ done
12
+
13
+ cd "${GENERATOR_DIR}"
14
+ python3 src/tasks/downstream/generation_validation.py \
15
+ --model_name "${AR_COND_MODEL}" \
16
+ --parquet_path "${CONDITIONED_DEEPSTARR_DIR}/valid.parquet" \
17
+ --sequence_col conditioned_sequence \
18
+ --conditioned_input \
19
+ --output_dir "${RESULT_ROOT}/ar_conditioned_valid" \
20
+ --num_samples "${NUM_GENERATION_SAMPLES:-384}" \
21
+ --prompt_bp_length "${PROMPT_BP_LENGTH:-120}" \
22
+ --continuation_bp_length "${CONTINUATION_BP_LENGTH:-126}" \
23
+ --batch_size "${GEN_BATCH_SIZE:-512}" \
24
+ --attn_implementation "${ATTN_IMPLEMENTATION:-sdpa}" \
25
+ --bf16 \
26
+ --report_to none \
27
+ --run_name ar_conditioned_valid
evaluate_ar_unconditional.sh ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+ source "${SCRIPT_DIR}/../00_setup/env.sh"
6
+
7
+ for filename in modeling_generator.py tokenizer.py; do
8
+ if [[ -f "${GENERATOR_BASE_MODEL}/${filename}" && ! -f "${AR_UNCOND_MODEL}/${filename}" ]]; then
9
+ cp "${GENERATOR_BASE_MODEL}/${filename}" "${AR_UNCOND_MODEL}/${filename}"
10
+ fi
11
+ done
12
+
13
+ cd "${GENERATOR_DIR}"
14
+ python3 src/tasks/downstream/generation_validation.py \
15
+ --model_name "${AR_UNCOND_MODEL}" \
16
+ --parquet_path "${DEEPSTARR_DIR}/valid.parquet" \
17
+ --sequence_col sequence \
18
+ --output_dir "${RESULT_ROOT}/ar_unconditional_valid" \
19
+ --num_samples "${NUM_GENERATION_SAMPLES:-384}" \
20
+ --prompt_bp_length "${PROMPT_BP_LENGTH:-120}" \
21
+ --continuation_bp_length "${CONTINUATION_BP_LENGTH:-126}" \
22
+ --batch_size "${GEN_BATCH_SIZE:-512}" \
23
+ --attn_implementation "${ATTN_IMPLEMENTATION:-sdpa}" \
24
+ --bf16 \
25
+ --report_to none \
26
+ --run_name ar_unconditional_valid
train_ar_conditioned.sh ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+ source "${SCRIPT_DIR}/../00_setup/env.sh"
6
+
7
+ cd "${GENERATOR_DIR}"
8
+ python3 src/tasks/downstream/fine_tuning.py \
9
+ --model_name "${GENERATOR_BASE_MODEL}" \
10
+ --parquet_path "${CONDITIONED_DEEPSTARR_DIR}/train.parquet" \
11
+ --sequence_col conditioned_sequence \
12
+ --conditioned_input \
13
+ --output_dir "${RESULT_ROOT}/checkpoints/deepstarr_sft_conditioned" \
14
+ --saved_model_dir "${AR_COND_MODEL}" \
15
+ --tmp_dir "${RUN_ROOT}/tmp/deepstarr_sft_conditioned" \
16
+ --epochs "${AR_EPOCHS:-3}" \
17
+ --batch_size "${AR_BATCH_SIZE:-4}" \
18
+ --gradient_accumulation "${AR_GRAD_ACCUM:-1}" \
19
+ --lr "${AR_LR:-5e-5}" \
20
+ --max_token_length "${AR_MAX_TOKEN_LENGTH:-256}" \
21
+ --attn_implementation "${ATTN_IMPLEMENTATION:-sdpa}" \
22
+ --bf16 \
23
+ --report_to none \
24
+ --run_name deepstarr_sft_conditioned
25
+
26
+ for filename in modeling_generator.py tokenizer.py; do
27
+ if [[ -f "${GENERATOR_BASE_MODEL}/${filename}" && ! -f "${AR_COND_MODEL}/${filename}" ]]; then
28
+ cp "${GENERATOR_BASE_MODEL}/${filename}" "${AR_COND_MODEL}/${filename}"
29
+ fi
30
+ done
train_ar_unconditional.sh ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+ source "${SCRIPT_DIR}/../00_setup/env.sh"
6
+
7
+ cd "${GENERATOR_DIR}"
8
+ python3 src/tasks/downstream/fine_tuning.py \
9
+ --model_name "${GENERATOR_BASE_MODEL}" \
10
+ --parquet_path "${DEEPSTARR_DIR}/train.parquet" \
11
+ --sequence_col sequence \
12
+ --output_dir "${RESULT_ROOT}/checkpoints/deepstarr_sft" \
13
+ --saved_model_dir "${AR_UNCOND_MODEL}" \
14
+ --tmp_dir "${RUN_ROOT}/tmp/deepstarr_sft" \
15
+ --epochs "${AR_EPOCHS:-3}" \
16
+ --batch_size "${AR_BATCH_SIZE:-4}" \
17
+ --gradient_accumulation "${AR_GRAD_ACCUM:-1}" \
18
+ --lr "${AR_LR:-5e-5}" \
19
+ --max_token_length "${AR_MAX_TOKEN_LENGTH:-256}" \
20
+ --attn_implementation "${ATTN_IMPLEMENTATION:-sdpa}" \
21
+ --bf16 \
22
+ --report_to none \
23
+ --run_name deepstarr_sft_unconditional
24
+
25
+ for filename in modeling_generator.py tokenizer.py; do
26
+ if [[ -f "${GENERATOR_BASE_MODEL}/${filename}" && ! -f "${AR_UNCOND_MODEL}/${filename}" ]]; then
27
+ cp "${GENERATOR_BASE_MODEL}/${filename}" "${AR_UNCOND_MODEL}/${filename}"
28
+ fi
29
+ done