liuliu2333 commited on
Commit
e72be62
·
verified ·
1 Parent(s): 4e59ea9

Upload config.yaml with huggingface_hub

Browse files
Files changed (1) hide show
  1. config.yaml +75 -0
config.yaml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ============================================================
2
+ # miRNA-target prediction model — default training configuration
3
+ # ============================================================
4
+ # This file controls all hyperparameters for the training pipeline.
5
+ # Modify this file to tune parameters without changing the code.
6
+ #
7
+ # Usage:
8
+ # python insect_mirna_target/training/train.py --config insect_mirna_target/configs/default.yaml
9
+ # python insect_mirna_target/training/train.py --config insect_mirna_target/configs/default.yaml --fast-dev-run
10
+ # ============================================================
11
+
12
+ # ---- Model architecture ----
13
+ model:
14
+ freeze_backbone: true # Whether to freeze the RNA-FM backbone (Phase 1 frozen, Phase 2 unfrozen)
15
+ cross_attn_heads: 8 # Number of Cross-Attention heads (8 heads x 80 dim = 640)
16
+ cross_attn_layers: 2 # Number of stacked Cross-Attention layers (Mimosa uses 16, our lightweight version uses 2)
17
+ classifier_hidden: # MLP classifier head hidden layer dimensions
18
+ - 256 # First layer: 640->256
19
+ - 64 # Second layer: 256->64, final output 64->1
20
+ dropout: 0.3 # Dropout rate (0.2-0.5 range, 0.3 is a common default)
21
+
22
+ # ---- Data loading ----
23
+ data:
24
+ data_dir: "insect_mirna_target/data/training" # Training data directory (contains train.csv, val.csv, test.csv)
25
+ batch_size: 128 # Batch size (128-256 recommended, reduce to 64 if GPU memory is insufficient)
26
+ num_workers: 8 # DataLoader worker processes (typically set to 1/4 of CPU cores)
27
+ pin_memory: true # Pinned memory (recommended true for GPU training, accelerates CPU->GPU data transfer)
28
+
29
+ # ---- Training hyperparameters ----
30
+ training:
31
+ lr: 1.0e-4 # Base learning rate (used for classifier head; backbone is multiplied by 0.01)
32
+ weight_decay: 1.0e-5 # L2 regularization coefficient (prevents overfitting, 1e-5 to 1e-4 range)
33
+ scheduler: "cosine" # Learning rate scheduler: cosine | onecycle | none
34
+ max_epochs: 30 # Maximum training epochs (typically 20-50, combined with early stopping)
35
+ gradient_clip_val: 1.0 # Gradient clipping threshold (prevents gradient explosion, 1.0 is standard)
36
+ accumulate_grad_batches: 1 # Gradient accumulation steps (set to 2-4 to simulate larger batch if GPU memory is insufficient)
37
+ precision: "16-mixed" # Mixed precision training (reduces GPU memory, speeds up computation, with negligible precision loss)
38
+
39
+ # ---- Progressive unfreezing ----
40
+ unfreezing:
41
+ enabled: false # Whether to enable progressive unfreezing (Phase 1 set false, Phase 2 set true)
42
+ unfreeze_at_epoch: 5 # Epoch at which to unfreeze the first layer (typically after classifier head converges)
43
+ num_layers: 3 # Total number of top RNA-FM layers to unfreeze (3 layers = layers 10, 11, 12)
44
+ unfreeze_interval: 3 # Unfreeze the next layer every N epochs (epoch 5->L12, 8->L11, 11->L10)
45
+ warmup_epochs: 1 # Number of backbone lr warmup epochs after each unfreeze (lr linearly ramps up from 1/10)
46
+
47
+ # ---- Trainer configuration ----
48
+ trainer:
49
+ accelerator: "gpu" # Accelerator type: gpu | cpu
50
+ devices: 2 # Number of GPUs (this machine has 2x NVIDIA L20)
51
+ strategy: "ddp" # Distributed strategy: ddp (data parallel) | fsdp (fully sharded data parallel)
52
+
53
+ # ---- Checkpoint management ----
54
+ checkpointing:
55
+ monitor: "val_auroc" # Metric to monitor (criterion for selecting the best model)
56
+ mode: "max" # max=higher is better (auroc), min=lower is better (loss)
57
+ save_top_k: 3 # Save top-K best models (disk space limited, keep only 3)
58
+ save_last: true # Whether to additionally save the last epoch's checkpoint
59
+ dirpath: "checkpoints/" # Checkpoint save directory
60
+
61
+ # ---- Logging configuration ----
62
+ logging:
63
+ logger: "tensorboard" # Logging backend: tensorboard (no login required, view locally)
64
+ log_dir: "lightning_logs/" # TensorBoard log directory
65
+ log_every_n_steps: 50 # Log every N steps (too frequent will slow down training)
66
+
67
+ # ---- Early stopping ----
68
+ early_stopping:
69
+ enabled: true # Whether to enable early stopping (prevents overfitting, recommended)
70
+ monitor: "val_loss" # Metric to monitor
71
+ patience: 10 # Stop after N consecutive epochs without improvement (progressive unfreezing needs more recovery time)
72
+ mode: "min" # min=lower is better
73
+
74
+ # ---- Random seed ----
75
+ seed: 42 # Global random seed (ensures experiment reproducibility)