Skip to content

Clearer validation errors#1072

Open
pfebrer wants to merge 3 commits into
mainfrom
better_validation_errors
Open

Clearer validation errors#1072
pfebrer wants to merge 3 commits into
mainfrom
better_validation_errors

Conversation

@pfebrer

@pfebrer pfebrer commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

With the last documentation refactor, documentation became better and more streamlined, but some validation errors became terrible to read.

The main issue is that when Unions fail to validate, there is no well-defined way of consistently telling which option was closest to passing, and therefore pydantic by default prints the reason why all the possible options failed. This affected mostly error messages on the dataset and target types, which are the most convoluted inputs in metatrain.

This PR:

  • Adds discriminators to help pydantic understand which error to raise, reducing the amount of validation errors.
  • For architecture options validation, it separates model from training errors so that it is visually easier to distinguish the errors.
  • Whenever possible, adds links to metatrain documentation that might help the user.

@pfebrer pfebrer force-pushed the better_validation_errors branch from 3989f48 to c4fb6b7 Compare March 25, 2026 10:09
@pfebrer pfebrer force-pushed the better_validation_errors branch from c4fb6b7 to c948e25 Compare March 31, 2026 07:46
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