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

feat: Add algorithm model validators #361

Merged
merged 3 commits into from
Jan 20, 2025

Conversation

jdeschamps
Copy link
Member

Description

Following #354: final_activation was allowed to be set although it would break CARE, N2N and N2V.

This PR adds a Pydantic validator preventing final activation for these algorithms. It also takes the opportunity to improve the Pydantic models by moving the validators to a different module and using annotations for cleaner code.

  • What: CARE, N2N and N2V do not allow final activation in the UNet.
  • Why: This would otherwise break the algorithm training.
  • How: Add model validators in the respective Pydantic models.

Changes Made

  • Added: model_validators.py.
  • Modified: Algorithms model.

Related Issues


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)

@jdeschamps jdeschamps marked this pull request as ready for review January 17, 2025 21:02
Copy link
Member

@melisande-c melisande-c left a comment

Choose a reason for hiding this comment

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

Nice! the annotated types are pretty neat

@jdeschamps jdeschamps merged commit aad0c19 into main Jan 20, 2025
18 checks passed
@jdeschamps jdeschamps deleted the jd/fix/n2v_activation_validation branch January 20, 2025 11:05
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.

Validate UNet final_activation in N2V, CARE and N2N algorithm configurations
2 participants