Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refac: made some attributes of VAEAlgorithmConfig optional #261

Closed

Conversation

federico-carrara
Copy link
Collaborator

Description

  • What: Made all attributes, except model, Optional in VAEAlgortihmConfig.
  • Why: At inference time the only the model attribute is needed. This allows to simplify model initialization for evaluation.
  • How: Simply marked attributes as Optional, added None default if needed.

Please ensure your PR meets the following requirements:

  • Code builds and passes tests locally, including doctests
  • New tests have been added (for bug fixes/features)
  • Pre-commit passes
  • PR to the documentation exists (for bug fixes / features)

@federico-carrara federico-carrara requested a review from a team November 4, 2024 10:03
Copy link
Member

@jdeschamps jdeschamps left a comment

Choose a reason for hiding this comment

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

That means that we would need to check whether they have been assigned for training.

Would it make sense to simply give them a default value?

@federico-carrara
Copy link
Collaborator Author

federico-carrara commented Nov 4, 2024

I think I got your point, but let me be sure. The problem you are pointing out is that in this way we could instantiate an Algorithm config that will raise a RuntimrError during training since some attributes are not defined, right?

If this is the case, yeah good point. I guess a solution is to change the default values of the pydantic configs, e.g.,

loss: Optional[LVAELossConfig] = LVAELossConfig()

What do you think?

@federico-carrara
Copy link
Collaborator Author

Or we could also skip this PR. However, it is really ugly to load a loss config or an optimizer config which are just useless at inference time...

Copy link

codecov bot commented Nov 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.80%. Comparing base (b29fc6c) to head (4f9e5bd).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #261   +/-   ##
=======================================
  Coverage   87.80%   87.80%           
=======================================
  Files         137      137           
  Lines        4971     4971           
=======================================
  Hits         4365     4365           
  Misses        606      606           

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


🚨 Try these New Features:

@jdeschamps
Copy link
Member

Sorry I lost track of this.

I do prefer having an unused parameter class than guarding against it being None in the training calls.

@federico-carrara
Copy link
Collaborator Author

federico-carrara commented Nov 19, 2024

I completely see your point. Let's skip this PR then, not important at all!
If you agree I will close it :)

@jdeschamps jdeschamps closed this Nov 20, 2024
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.

2 participants