diff --git a/experiments/grouped/codebert.yaml b/experiments/grouped/codebert.yaml index 8bcf1e9..353590e 100644 --- a/experiments/grouped/codebert.yaml +++ b/experiments/grouped/codebert.yaml @@ -16,7 +16,6 @@ run_name: "InvCodeBERT-grouped" alpha: 1.0 temperature: 0.1 max_seq_length: 512 -sample_rate: 0.2 contra_mode: "grouped" max_num_augs: 6 diff --git a/experiments/grouped/contrabert_c.yaml b/experiments/grouped/contrabert_c.yaml index d5f8f4d..93432a4 100644 --- a/experiments/grouped/contrabert_c.yaml +++ b/experiments/grouped/contrabert_c.yaml @@ -17,7 +17,6 @@ run_name: "InvContraBERT_C-grouped" alpha: 1.0 temperature: 0.1 max_seq_length: 512 -sample_rate: 0.2 contra_mode: "grouped" max_num_augs: 6 diff --git a/experiments/grouped/contrabert_g.yaml b/experiments/grouped/contrabert_g.yaml index 392420a..b30a708 100644 --- a/experiments/grouped/contrabert_g.yaml +++ b/experiments/grouped/contrabert_g.yaml @@ -17,7 +17,6 @@ run_name: "InvContraBERT_G-grouped" alpha: 1.0 temperature: 0.1 max_seq_length: 512 -sample_rate: 0.2 contra_mode: "grouped" max_num_augs: 6 diff --git a/experiments/grouped/graphcodebert.yaml b/experiments/grouped/graphcodebert.yaml index 7e235df..7104fbf 100644 --- a/experiments/grouped/graphcodebert.yaml +++ b/experiments/grouped/graphcodebert.yaml @@ -16,7 +16,6 @@ run_name: "InvGraphCodeBERT-grouped" alpha: 1.0 temperature: 0.1 max_seq_length: 512 -sample_rate: 0.2 contra_mode: "grouped" max_num_augs: 6 diff --git a/experiments/supcon/contrabert_c.yaml b/experiments/supcon/contrabert_c.yaml index 28704bb..0694e4c 100644 --- a/experiments/supcon/contrabert_c.yaml +++ b/experiments/supcon/contrabert_c.yaml @@ -17,6 +17,5 @@ run_name: "InvContraBERT_C-supcon" alpha: 1.0 temperature: 0.1 max_seq_length: 512 -sample_rate: 0.2 contra_mode: "supcon" diff --git a/experiments/supcon/contrabert_g.yaml b/experiments/supcon/contrabert_g.yaml index 4f6b973..5bc03e7 100644 --- a/experiments/supcon/contrabert_g.yaml +++ b/experiments/supcon/contrabert_g.yaml @@ -17,6 +17,5 @@ run_name: "InvContraBERT_G-supcon" alpha: 1.0 temperature: 0.1 max_seq_length: 512 -sample_rate: 0.2 contra_mode: "supcon" diff --git a/experiments/supcon/graphcodebert.yaml b/experiments/supcon/graphcodebert.yaml index 8444138..6360c18 100644 --- a/experiments/supcon/graphcodebert.yaml +++ b/experiments/supcon/graphcodebert.yaml @@ -16,6 +16,5 @@ run_name: "InvGraphCodeBERT-supcon" alpha: 1.0 temperature: 0.1 max_seq_length: 512 -sample_rate: 0.2 contra_mode: "supcon" diff --git a/modeling/cli.py b/modeling/cli.py index dfee525..c12165c 100644 --- a/modeling/cli.py +++ b/modeling/cli.py @@ -20,15 +20,23 @@ def run( Path, typer.Argument(help="Path to a YAML experiment config file."), ], + sample_rate: Annotated[ + Optional[float], + typer.Option("--sample-rate", "-sr", help="Override sample rate from config."), + ] = None, ) -> None: """Run pre-training from a YAML config file. All parameters are read from the config file to ensure full reproducibility. + Use --sample-rate to override the dataset sampling fraction. - Example: python -m modeling run experiments/base.yaml + Example: python -m modeling run experiments/base.yaml --sample-rate 0.1 """ cfg = load_config(config) - main(**asdict(cfg)) + kwargs = asdict(cfg) + if sample_rate is not None: + kwargs["sample_rate"] = sample_rate + main(**kwargs) @app.command()