Skip to content

Expose --attention_dropout in pretraining (consistency with classification/segmentation)#2

Open
alex-crlhmmr wants to merge 1 commit into
thuml:mainfrom
alex-crlhmmr:feature/expose-attention-dropout-in-pretrain
Open

Expose --attention_dropout in pretraining (consistency with classification/segmentation)#2
alex-crlhmmr wants to merge 1 commit into
thuml:mainfrom
alex-crlhmmr:feature/expose-attention-dropout-in-pretrain

Conversation

@alex-crlhmmr

Copy link
Copy Markdown

What

Adds a --attention_dropout flag to pretrain.py and threads it into the graph encoder in models/pretraining.py, matching how classification.py and segmentation.py already handle it.

Why

The two downstream entrypoints expose --attention_dropout and pass it into DualGraphEncoder:

  • classification.py / segmentation.py: parser.add_argument("--attention_dropout", type=float, default=0.1)
  • models/dual_classification.py / models/dual_segmentation.py: attention_dropout=getattr(args, "attention_dropout", args.dropout)

pretrain.py has no such flag, and models/pretraining.py constructs DualGraphEncoder without passing attention_dropout. As a result, during pretraining the attention dropout is pinned at the DualGraphEncoder default (0.1), and --dropout has no effect on it. The attention regularization actually used to pretrain a model is therefore not derivable from the pretraining flags/config, which is inconsistent with the fine-tuning entrypoints and awkward for reproducibility.

Change

Two lines, mirroring the downstream pattern exactly:

  • pretrain.py: add --attention_dropout (default 0.1).
  • models/pretraining.py: pass attention_dropout=getattr(args, "attention_dropout", args.dropout) to DualGraphEncoder.

Behavior

The default (0.1) reproduces current behavior exactly, so existing runs are unaffected. The flag simply makes attention dropout controllable and visible in the pretraining config, as it already is downstream.

…ream

pretrain.py did not expose --attention_dropout, and models/pretraining.py
built the graph encoder without passing it, so attention dropout stayed
pinned at the DualGraphEncoder default (0.1) and --dropout did not affect it.
classification.py and segmentation.py already expose the flag and thread it
into DualGraphEncoder; this mirrors that pattern for pretraining.

The default (0.1) preserves existing behavior; the flag now makes attention
dropout controllable and visible in the pretraining config, which matters for
reproducibility (the effective attention regularization was previously not
derivable from the pretraining flags).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant