From 722549c6d48a06bd3d2309aeb5abd8c83d1b90ca Mon Sep 17 00:00:00 2001 From: Nathan Painchaud Date: Wed, 25 Oct 2023 00:35:11 +0200 Subject: [PATCH] Update naming scheme of custom transformer experiment configs + output folders hierarchy --- ...ac-multimodal-representation-pretrain.yaml | 22 ------------------- ....yaml => multimodal-xformer-finetune.yaml} | 6 ++--- ...head.yaml => multimodal-xformer-head.yaml} | 6 ++--- .../cardinal/multimodal-xformer-pretrain.yaml | 22 +++++++++++++++++++ ...h.yaml => multimodal-xformer-scratch.yaml} | 6 ++--- ...sentation.yaml => multimodal-xformer.yaml} | 0 .../experiment/cardinal/xtab-finetune.yaml | 8 +++---- 7 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 didactic/config/experiment/cardinal/cardiac-multimodal-representation-pretrain.yaml rename didactic/config/experiment/cardinal/{cardiac-multimodal-representation-finetune.yaml => multimodal-xformer-finetune.yaml} (73%) rename didactic/config/experiment/cardinal/{cardiac-multimodal-representation-head.yaml => multimodal-xformer-head.yaml} (70%) create mode 100644 didactic/config/experiment/cardinal/multimodal-xformer-pretrain.yaml rename didactic/config/experiment/cardinal/{cardiac-multimodal-representation-scratch.yaml => multimodal-xformer-scratch.yaml} (58%) rename didactic/config/experiment/cardinal/{cardiac-multimodal-representation.yaml => multimodal-xformer.yaml} (100%) diff --git a/didactic/config/experiment/cardinal/cardiac-multimodal-representation-pretrain.yaml b/didactic/config/experiment/cardinal/cardiac-multimodal-representation-pretrain.yaml deleted file mode 100644 index 42373bf0..00000000 --- a/didactic/config/experiment/cardinal/cardiac-multimodal-representation-pretrain.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# @package _global_ - -defaults: - - cardinal/cardiac-multimodal-representation - -trainer: - max_epochs: 2500 - -excluded_clinical_attrs: ??? - -task: - contrastive_loss: - _target_: vital.metrics.train.metric.NTXent - contrastive_loss_weight: 1 - mtr_p: [0.3, 0] - -hydra: - run: - dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/pretrain/excluded_clinical_attrs=${excluded_clinical_attrs},img_attrs=${task.img_attrs}/${experiment_dirname}/${hydra.job.override_dirname} - sweep: - dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/pretrain - subdir: excluded_clinical_attrs=${excluded_clinical_attrs},img_attrs=${task.img_attrs}/${experiment_dirname}/${hydra.job.override_dirname} diff --git a/didactic/config/experiment/cardinal/cardiac-multimodal-representation-finetune.yaml b/didactic/config/experiment/cardinal/multimodal-xformer-finetune.yaml similarity index 73% rename from didactic/config/experiment/cardinal/cardiac-multimodal-representation-finetune.yaml rename to didactic/config/experiment/cardinal/multimodal-xformer-finetune.yaml index 55bb3d27..5fd51e45 100644 --- a/didactic/config/experiment/cardinal/cardiac-multimodal-representation-finetune.yaml +++ b/didactic/config/experiment/cardinal/multimodal-xformer-finetune.yaml @@ -1,7 +1,7 @@ # @package _global_ defaults: - - cardinal/cardiac-multimodal-representation + - cardinal/multimodal-xformer - /callbacks: - transformer_encoder_freeze @@ -29,7 +29,7 @@ strict: False # Only load weights where they match the defined network, to only hydra: run: - dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/finetune/targets=${oc.dict.keys:task.predict_losses}/${experiment_dirname}/${hydra.job.override_dirname} + dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/finetune/${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/${hydra.job.override_dirname} sweep: dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/finetune - subdir: targets=${oc.dict.keys:task.predict_losses}/${experiment_dirname}/${hydra.job.override_dirname} + subdir: ${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/${hydra.job.override_dirname} diff --git a/didactic/config/experiment/cardinal/cardiac-multimodal-representation-head.yaml b/didactic/config/experiment/cardinal/multimodal-xformer-head.yaml similarity index 70% rename from didactic/config/experiment/cardinal/cardiac-multimodal-representation-head.yaml rename to didactic/config/experiment/cardinal/multimodal-xformer-head.yaml index ea7f3468..54f8760b 100644 --- a/didactic/config/experiment/cardinal/cardiac-multimodal-representation-head.yaml +++ b/didactic/config/experiment/cardinal/multimodal-xformer-head.yaml @@ -1,7 +1,7 @@ # @package _global_ defaults: - - cardinal/cardiac-multimodal-representation + - cardinal/multimodal-xformer - /callbacks: - transformer_encoder_freeze @@ -25,7 +25,7 @@ strict: False # Only load weights where they match the defined network, to only hydra: run: - dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/head/targets=${oc.dict.keys:task.predict_losses}/${experiment_dirname}/${hydra.job.override_dirname} + dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/head/${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/${hydra.job.override_dirname} sweep: dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/head - subdir: targets=${oc.dict.keys:task.predict_losses}/${experiment_dirname}/${hydra.job.override_dirname} + subdir: ${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/${hydra.job.override_dirname} diff --git a/didactic/config/experiment/cardinal/multimodal-xformer-pretrain.yaml b/didactic/config/experiment/cardinal/multimodal-xformer-pretrain.yaml new file mode 100644 index 00000000..7d9ff0f8 --- /dev/null +++ b/didactic/config/experiment/cardinal/multimodal-xformer-pretrain.yaml @@ -0,0 +1,22 @@ +# @package _global_ + +defaults: + - cardinal/multimodal-xformer + +trainer: + max_epochs: 2500 + +excluded_clinical_attrs: ??? + +task: + contrastive_loss: + _target_: vital.metrics.train.metric.NTXent + contrastive_loss_weight: 1 + mtr_p: [0.3, 0] + +hydra: + run: + dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/pretrain/${experiment_dirname}/excluded_clinical_attrs=${excluded_clinical_attrs}/${hydra.job.override_dirname} + sweep: + dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/pretrain + subdir: ${experiment_dirname}/excluded_clinical_attrs=${excluded_clinical_attrs}/${hydra.job.override_dirname} diff --git a/didactic/config/experiment/cardinal/cardiac-multimodal-representation-scratch.yaml b/didactic/config/experiment/cardinal/multimodal-xformer-scratch.yaml similarity index 58% rename from didactic/config/experiment/cardinal/cardiac-multimodal-representation-scratch.yaml rename to didactic/config/experiment/cardinal/multimodal-xformer-scratch.yaml index 1ef5cc4c..da3b8d45 100644 --- a/didactic/config/experiment/cardinal/cardiac-multimodal-representation-scratch.yaml +++ b/didactic/config/experiment/cardinal/multimodal-xformer-scratch.yaml @@ -1,7 +1,7 @@ # @package _global_ defaults: - - cardinal/cardiac-multimodal-representation + - cardinal/multimodal-xformer trainer: max_epochs: 2500 @@ -18,7 +18,7 @@ task: hydra: run: - dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/scratch/targets=${oc.dict.keys:task.predict_losses}/${experiment_dirname}/${hydra.job.override_dirname} + dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/scratch/${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/${hydra.job.override_dirname} sweep: dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/scratch - subdir: targets=${oc.dict.keys:task.predict_losses}/${experiment_dirname}/${hydra.job.override_dirname} + subdir: ${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/${hydra.job.override_dirname} diff --git a/didactic/config/experiment/cardinal/cardiac-multimodal-representation.yaml b/didactic/config/experiment/cardinal/multimodal-xformer.yaml similarity index 100% rename from didactic/config/experiment/cardinal/cardiac-multimodal-representation.yaml rename to didactic/config/experiment/cardinal/multimodal-xformer.yaml diff --git a/didactic/config/experiment/cardinal/xtab-finetune.yaml b/didactic/config/experiment/cardinal/xtab-finetune.yaml index 5d948e28..d9864a1a 100644 --- a/didactic/config/experiment/cardinal/xtab-finetune.yaml +++ b/didactic/config/experiment/cardinal/xtab-finetune.yaml @@ -1,7 +1,7 @@ # @package _global_ defaults: - - cardinal/cardiac-multimodal-representation + - cardinal/multimodal-xformer - override /task/model: xtab-ft-transformer trainer: @@ -34,10 +34,10 @@ ckpt: ??? # Make it mandatory to provide a checkpoint weights_only: True # Only load the weights and ignore the hyperparameters strict: False # Only load weights where they match the defined network, to only some changes (e.g. heads, etc.) -experiment_dirname: encoder=${hydra:runtime.choices.task/model}/n_clinical_attrs=${builtin.len:${task.clinical_attrs}},n_img_attrs=${op.mul:${builtin.len:${task.views}},${builtin.len:${task.img_attrs}}}/contrastive=${oc.select:task.contrastive_loss_weight,0}/embed_dim=${task.embed_dim},depth=${task.model.encoder.n_blocks},nhead=${task.model.encoder.attention_n_heads},dropout=${task.model.encoder.attention_dropout},${task.model.encoder.ffn_dropout},${task.model.encoder.residual_dropout}/mtr_p=${task.mtr_p},mt_by_attr=${task.mt_by_attr},attrs_dropout=${task.attrs_dropout} +experiment_dirname: encoder=${hydra:runtime.choices.task/model}/img_tokenizer=${hydra:runtime.choices.task/img_tokenizer/model}/n_clinical_attrs=${n_clinical_attrs},n_img_attrs=${n_img_attrs}/contrastive=${oc.select:task.contrastive_loss_weight,0}/embed_dim=${task.embed_dim},depth=${task.model.encoder.n_blocks},nhead=${task.model.encoder.attention_n_heads},dropout=${task.model.encoder.attention_dropout},${task.model.encoder.ffn_dropout},${task.model.encoder.residual_dropout}/mtr_p=${task.mtr_p},mt_by_attr=${task.mt_by_attr},attrs_dropout=${task.attrs_dropout} hydra: run: - dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/xtab-finetune/targets=${oc.dict.keys:task.predict_losses}/${experiment_dirname}/${hydra.job.override_dirname} + dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/xtab-finetune/${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/${hydra.job.override_dirname} sweep: dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/xtab-finetune - subdir: targets=${oc.dict.keys:task.predict_losses}/${experiment_dirname}/${hydra.job.override_dirname} + subdir: ${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/${hydra.job.override_dirname}