Pretrain Caduceus on the Human Reference Genome
mainTo reproduce pre-training experiments, follow these steps:
1. Prepare Data
Download the Human Reference Genome (hg38) files into ./data/hg38/. You need the .fasta file (the genome sequence) and the .bed file (sequence intervals).
mkdir -p data/hg38/
curl https://storage.googleapis.com/basenji_barnyard2/hg38.ml.fa.gz > data/hg38/hg38.ml.fa.gz
gunzip data/hg38/hg38.ml.fa.gz
curl https://storage.googleapis.com/basenji_barnyard2/sequences_human.bed > data/hg38/human-sequences.bed2. Run Pre-training
Use the train.py script via the python -m train command. Key arguments for pre-training include dataset.mlm=true and model=caduceus.
Alternatively, if using a Slurm cluster, you can use the provided scripts in the slurm_scripts/ directory:
cd slurm_scripts
sbatch run_pretrain_caduceus.shpython -m train \
experiment=hg38/hg38 \
callbacks.model_checkpoint_every_n_steps.every_n_train_steps=500 \
dataset.max_length=1024 \
dataset.batch_size=1024 \
dataset.mlm=true \
dataset.mlm_probability=0.15 \
dataset.rc_aug=false \
model=caduceus \
model.config.d_model=128 \
model.config.n_layer=4 \
model.config.bidirectional=true \
model.config.bidirectional_strategy=add \
model.config.bidirectional_weight_tie=true \
model.config.rcps=true \
optimizer.lr="8e-3" \
train.global_batch_size=1024 \
trainer.max_steps=10000 \
+trainer.val_check_interval=10000 \
wandb=null