-
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
fix: Issue 1247 #1656
fix: Issue 1247 #1656
Conversation
avglinsky
commented
Jul 11, 2023
•
edited by IgnatovFedor
Loading
edited by IgnatovFedor
- fix AttributeError raised when validating with an empty validation set or a missing valid.csv #1247
3881ce7
to
f13a85b
Compare
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.
change version in deeppavlov._metadata to 1.3.0
deeppavlov/core/commands/train.py
Outdated
@@ -92,6 +92,11 @@ def train_evaluate_model_from_config(config: Union[str, Path, dict], | |||
if iterator is None: | |||
try: | |||
data = read_data_by_config(config) | |||
# if the value 'val_every_n_epochs' is set in the config and there is no validation data - raise exception |
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.
remove comment - unnecessary
deeppavlov/core/commands/train.py
Outdated
@@ -92,6 +92,11 @@ def train_evaluate_model_from_config(config: Union[str, Path, dict], | |||
if iterator is None: | |||
try: | |||
data = read_data_by_config(config) | |||
# if the value 'val_every_n_epochs' is set in the config and there is no validation data - raise exception | |||
if config.get('train', {}).get('val_every_n_epochs', None) and not data.get('valid', []): |
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.
add batch parameter check, replace not data.get('valid', [])
with not data.get('valid')
deeppavlov/core/commands/train.py
Outdated
# if the value 'val_every_n_epochs' is set in the config and there is no validation data - raise exception | ||
if config.get('train', {}).get('val_every_n_epochs', None) and not data.get('valid', []): | ||
error_message = 'The value "val_every_n_epochs" is set in the config but no validation data is provided' | ||
log.exception(error_message) |
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.
remove log.exception - duplicates exception output
deeppavlov/core/commands/train.py
Outdated
if config.get('train', {}).get('val_every_n_epochs', None) and not data.get('valid', []): | ||
error_message = 'The value "val_every_n_epochs" is set in the config but no validation data is provided' | ||
log.exception(error_message) | ||
raise Exception(error_message) |
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.
Replace with more specific error type