-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add non_zero
to common_fields.NumFCLayersField
#3215
Conversation
@@ -11,6 +11,7 @@ | |||
from typing import Any, Dict, Optional | |||
|
|||
import pytest | |||
from marshmallow import ValidationError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to just use ConfigValidationError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It fails with the marshmallow ValidationError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's strange. The code should be wrapping it in a ConfigValidationError
. CC @justinxzhao
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually glancing through the code we manually raise a ValidationError
in quite a few locations. (Worth a separate refactoring/investigation.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ConfigValidationError is only raised at the ModelConfig level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but ideally this is an error that should bubble up and either be caught and wrapped by:
- JSON validation via
check_schema
:raise ConfigValidationError(f"Failed to validate JSON schema for config. Error: {error.message}") - Deserialization via
schema.load
:ludwig/ludwig/schema/model_types/base.py
Line 113 in f262220
raise ConfigValidationError(f"Config validation error raised during config deserialization: {e}") from e
Am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed it might be good to clarify some of our semantics about ConfigValidationError vs. ValidationError from marshmallow, perhaps moving all Ludwig-specific validation code to ConfigValidationError
.
@abidwael It would be good to understand how the test gets through raises a marshmallow ValidationError
. Perhaps it's because we don't except
it in this block.
Otherwise, LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah @justinxzhao thanks for the link, I totally missed that <imblind.gif>
@@ -11,6 +11,7 @@ | |||
from typing import Any, Dict, Optional | |||
|
|||
import pytest | |||
from marshmallow import ValidationError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed it might be good to clarify some of our semantics about ConfigValidationError vs. ValidationError from marshmallow, perhaps moving all Ludwig-specific validation code to ConfigValidationError
.
@abidwael It would be good to understand how the test gets through raises a marshmallow ValidationError
. Perhaps it's because we don't except
it in this block.
Otherwise, LGTM.
A dense encoder with 0
num_layer
s doesn't make sense. This PR adds the option for specifying anon_zero
argument incommon_fields.NumFCLayersField
.