Skip to content

Commit

Permalink
Simplify Hydra dirname scheme + add config options for ordinal mode i…
Browse files Browse the repository at this point in the history
…n experiment configs
  • Loading branch information
nathanpainchaud committed Nov 1, 2023
1 parent 18fe180 commit 501c61e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ excluded_clinical_attrs: ${oc.dict.keys:task.predict_losses}

task:
predict_losses: ???
ordinal_mode: True
contrastive_loss:
_target_: vital.metrics.train.metric.NTXent
contrastive_loss_weight: 0
Expand All @@ -28,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/${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/${hydra.job.override_dirname}
dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/finetune/${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/ordinal_mode=${task.ordinal_mode},distribution=${oc.select:task.model.ordinal_head.distribution,null},tau_mode=${oc.select:task.model.ordinal_head.tau_mode,null}/${hydra.job.override_dirname}
sweep:
dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/finetune
subdir: ${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/${hydra.job.override_dirname}
subdir: ${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/ordinal_mode=${task.ordinal_mode},distribution=${oc.select:task.model.ordinal_head.distribution,null},tau_mode=${oc.select:task.model.ordinal_head.tau_mode,null}/${hydra.job.override_dirname}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ excluded_clinical_attrs: ${oc.dict.keys:task.predict_losses}

task:
predict_losses: ???
ordinal_mode: True

callbacks:
transformer_encoder_freeze:
Expand All @@ -24,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/${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/${hydra.job.override_dirname}
dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/head/${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/ordinal_mode=${task.ordinal_mode},distribution=${oc.select:task.model.ordinal_head.distribution,null},tau_mode=${oc.select:task.model.ordinal_head.tau_mode,null}/${hydra.job.override_dirname}
sweep:
dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/head
subdir: ${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/${hydra.job.override_dirname}
subdir: ${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/ordinal_mode=${task.ordinal_mode},distribution=${oc.select:task.model.ordinal_head.distribution,null},tau_mode=${oc.select:task.model.ordinal_head.tau_mode,null}/${hydra.job.override_dirname}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ excluded_clinical_attrs: ${oc.dict.keys:task.predict_losses}

task:
predict_losses: ???
ordinal_mode: True
contrastive_loss:
_target_: vital.metrics.train.metric.NTXent
contrastive_loss_weight: 0
mtr_p: [ 0.3, 0 ]

hydra:
run:
dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/scratch/${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/${hydra.job.override_dirname}
dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/scratch/${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/ordinal_mode=${task.ordinal_mode},distribution=${oc.select:task.model.ordinal_head.distribution,null},tau_mode=${oc.select:task.model.ordinal_head.tau_mode,null}/${hydra.job.override_dirname}
sweep:
dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/scratch
subdir: ${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/${hydra.job.override_dirname}
subdir: ${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/ordinal_mode=${task.ordinal_mode},distribution=${oc.select:task.model.ordinal_head.distribution,null},tau_mode=${oc.select:task.model.ordinal_head.tau_mode,null}/${hydra.job.override_dirname}
6 changes: 5 additions & 1 deletion didactic/config/experiment/cardinal/multimodal-xformer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ callbacks:
_target_: pytorch_lightning.callbacks.LearningRateFinder


experiment_dirname: encoder=${hydra:runtime.choices.task/model/encoder}/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.num_layers},nhead=${task.model.encoder.encoder_layer.nhead},dropout=${task.model.encoder.encoder_layer.dropout}/mtr_p=${task.mtr_p},mt_by_attr=${task.mt_by_attr}
experiment_dirname: 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}
hydra:
job:
config:
Expand Down Expand Up @@ -162,3 +162,7 @@ hydra:
- task.model.encoder.encoder_layer.nhead
- task.model.encoder.encoder_layer.dim_feedforward
- task.model.encoder.encoder_layer.dropout

- task.ordinal_mode
- task.model.ordinal_head.backbone_distribution
- task.model.ordinal_head.tau_mode
6 changes: 3 additions & 3 deletions didactic/config/experiment/cardinal/xtab-finetune.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ excluded_clinical_attrs: ${oc.dict.keys:task.predict_losses}

task:
predict_losses: ???
ordinal_mode: True
contrastive_loss:
_target_: vital.metrics.train.metric.NTXent
contrastive_loss_weight: 0
Expand All @@ -34,10 +35,9 @@ 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/encoder}/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}
hydra:
run:
dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/xtab-finetune/${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/${hydra.job.override_dirname}
dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/xtab-finetune/${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/ordinal_mode=${task.ordinal_mode},distribution=${oc.select:task.model.ordinal_head.distribution,null},tau_mode=${oc.select:task.model.ordinal_head.tau_mode,null}/${hydra.job.override_dirname}
sweep:
dir: ${oc.env:CARDIAC_MULTIMODAL_REPR_PATH}/xtab-finetune
subdir: ${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/${hydra.job.override_dirname}
subdir: ${experiment_dirname}/targets=${oc.dict.keys:task.predict_losses}/ordinal_mode=${task.ordinal_mode},distribution=${oc.select:task.model.ordinal_head.distribution,null},tau_mode=${oc.select:task.model.ordinal_head.tau_mode,null}/${hydra.job.override_dirname}

0 comments on commit 501c61e

Please sign in to comment.