Skip to content

Fix AllSet instantiation with default activation - #378

Merged
ffl096 merged 2 commits into
mainfrom
frantzen/fix-allset-activation-defaults
Aug 25, 2026
Merged

Fix AllSet instantiation with default activation#378
ffl096 merged 2 commits into
mainfrom
frantzen/fix-allset-activation-defaults

Conversation

@ffl096

@ffl096 ffl096 commented Aug 24, 2026

Copy link
Copy Markdown
Member

AllSet defaulted mlp_activation to None, which overrode the nn.ReLU default of AllSetLayer and reached the MLP helper, where the activation class was called unconditionally, raising TypeError: 'NoneType' object is not callable on construction.

  • Default mlp_activation to torch.nn.ReLU in AllSet
  • Skip None activations in both copy-pasted MLP helpers, mirroring the existing norm_layer guard
  • Apply the same fixes to AllSetTransformerBlock and its MLP helper, which shared the latent bug

Fixes #307

AllSet defaulted mlp_activation to None, which overrode the nn.ReLU
default of AllSetLayer and reached the MLP helper, where the
activation class was called unconditionally, raising
TypeError: 'NoneType' object is not callable on construction.

- Default mlp_activation to torch.nn.ReLU in AllSet
- Skip None activations in both copy-pasted MLP helpers, mirroring
  the existing norm_layer guard
- Apply the same fixes to AllSetTransformerBlock and its MLP helper,
  which shared the latent bug

Fixes #307
@ffl096 ffl096 added this to the 0.1.0 milestone Aug 24, 2026
@ffl096
ffl096 requested a lite review from Copilot August 24, 2026 12:52
@ffl096 ffl096 self-assigned this Aug 24, 2026
@ffl096 ffl096 added the bug Something isn't working label Aug 24, 2026
@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.36%. Comparing base (aed06d6) to head (8b99f8f).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #378      +/-   ##
==========================================
- Coverage   96.43%   96.36%   -0.08%     
==========================================
  Files          58       58              
  Lines        2078     2092      +14     
==========================================
+ Hits         2004     2016      +12     
- Misses         74       76       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a construction-time error in the hypergraph AllSet models where mlp_activation=None could propagate into MLP helpers that unconditionally instantiated the activation, causing TypeError: 'NoneType' object is not callable.

Changes:

  • Default mlp_activation to ReLU in AllSet and AllSetTransformerBlock constructors.
  • Guard against activation_layer is None in the MLP helper implementations (mirroring the existing norm_layer guard).
  • Apply the same activation/default + guard fixes consistently across both the AllSet and AllSetTransformer implementations.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
topomodelx/nn/hypergraph/allset.py Changes AllSet default mlp_activation to torch.nn.ReLU to prevent None overriding downstream defaults.
topomodelx/nn/hypergraph/allset_transformer_layer.py Defaults mlp_activation to nn.ReLU and skips activation construction when None in the local MLP helper.
topomodelx/nn/hypergraph/allset_layer.py Skips activation construction when None in the local MLP helper to avoid instantiation-time errors.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

layer_dropout=0.2,
mlp_num_layers=2,
mlp_activation=None,
mlp_activation=torch.nn.ReLU,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 8b99f8f by updating the mlp_activation docstring to callable | None with default torch.nn.ReLU.

Co-authored-by: ffl096 <2105496+ffl096@users.noreply.github.com>
@ffl096
ffl096 merged commit 9033f1d into main Aug 25, 2026
37 of 38 checks passed
@ffl096
ffl096 deleted the frantzen/fix-allset-activation-defaults branch August 25, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot instantiate a basic AllSet net

3 participants