BayesWatch / pytorch-experiments-template

A pytorch based classification experiments template
GNU General Public License v3.0
5 stars 1 forks source link

Adding **kwargs in certain models to ensure new argument passing style works #75

Closed AntreasAntoniou closed 3 years ago

jack-willturner commented 3 years ago

We made a fairly conscious decision to remove these in bb6e56bb1719b07d74301d941160ac18c7f0e4cf. Is there a reason you want to bring them back?

AntreasAntoniou commented 3 years ago

The main reason is that it causes a bug if it's not there. There were two solutions to that:

  1. Add kwargs in the ResNet*** classes or 2. at the base ResNet class. I went with the latter because it meant less code.
jack-willturner commented 3 years ago

What's the bug?

AntreasAntoniou commented 3 years ago

If there aren't **kwargs then any additional arguments like model.type passed into the downstream classes will throw an error of unexpected argument.

On Thu, May 6, 2021 at 3:30 PM Jack Turner @.**@.>> wrote:

What's the bug?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/BayesWatch/pytorch-experiments-template/pull/75#issuecomment-833569598, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACSK4NU3DX5ZAYNFUHARC4LTMKRX5ANCNFSM44FXCIGQ.

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.

AntreasAntoniou commented 3 years ago

@jack-willturner Any thoughts?

sourcery-ai[bot] commented 3 years ago

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 1.08%.

Quality metrics Before After Change
Complexity 2.66 ⭐ 2.89 ⭐ 0.23 👎
Method Length 62.64 🙂 63.11 🙂 0.47 👎
Working memory 10.44 😞 10.67 😞 0.23 👎
Quality 66.32% 🙂 65.24% 🙂 -1.08% 👎
Other metrics Before After Change
Lines 1622 1499 -123
Changed files Quality Before Quality After Quality Change
models/init.py 61.37% 🙂 61.37% 🙂 0.00%
models/auto_builder_models.py 63.30% 🙂 63.29% 🙂 -0.01% 👎
models/auto_builder_transformers.py 59.81% 🙂 59.76% 🙂 -0.05% 👎
models/densenet.py 69.80% 🙂 69.74% 🙂 -0.06% 👎
models/resnet.py 71.44% 🙂 71.42% 🙂 -0.02% 👎
models/wresnet.py 65.55% 🙂 65.51% 🙂 -0.04% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
models/auto_builder_models.py BatchRelationalModule.forward 13 🙂 373 ⛔ 15 😞 31.20% 😞 Try splitting into smaller methods. Extract out complex expressions
models/auto_builder_models.py BatchRelationalModule.build 13 🙂 451 ⛔ 14 😞 31.54% 😞 Try splitting into smaller methods. Extract out complex expressions
models/resnet.py ResNet.__init__ 9 🙂 178 😞 16 ⛔ 42.42% 😞 Try splitting into smaller methods. Extract out complex expressions
models/wresnet.py WideResNet.__init__ 5 ⭐ 230 ⛔ 14 😞 44.81% 😞 Try splitting into smaller methods. Extract out complex expressions
models/auto_builder_transformers.py VisualTransformer.build 3 ⭐ 287 ⛔ 13 😞 45.47% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Let us know what you think of it by mentioning @sourcery-ai in a comment.