-
Notifications
You must be signed in to change notification settings - Fork 677
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 issues when validation and test split modes set to none #1703
Open
willyfh
wants to merge
6
commits into
openvinotoolkit:main
Choose a base branch
from
willyfh:fix-val-test-none
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
77ec74a
skip validation stage when val_split_mode is set to none
willyfh a9de159
skip test stage when test_split_mode is set to none
willyfh 17aaf0e
Merge branch 'main' into fix-val-test-none
willyfh 4098154
Merge branch 'main' into fix-val-test-none
willyfh ddf94ec
Merge branch 'openvinotoolkit:main' into fix-val-test-none
willyfh d629988
Merge branch 'main' into fix-val-test-none
samet-akcay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ | |
from jsonargparse import Path as JSONArgparsePath | ||
from omegaconf import DictConfig, ListConfig, OmegaConf | ||
|
||
from anomalib.data.utils import ValSplitMode | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
|
@@ -122,6 +124,7 @@ def update_config(config: DictConfig | ListConfig | Namespace) -> DictConfig | L | |
config.results_dir.path = str(project_path) | ||
|
||
config = _update_nncf_config(config) | ||
config = _update_val_config(config) | ||
|
||
# write the original config for eventual debug (modified config at the end of the function) | ||
(project_path / "config_original.yaml").write_text(to_yaml(config_original)) | ||
|
@@ -214,6 +217,21 @@ def _update_nncf_config(config: DictConfig | ListConfig) -> DictConfig | ListCon | |
return config | ||
|
||
|
||
def _update_val_config(config: DictConfig | ListConfig) -> DictConfig | ListConfig: | ||
"""Skip validation if `val_split_mode` is set to 'none'. | ||
|
||
Args: | ||
config (DictConfig | ListConfig): Configurable parameters of the current run. | ||
|
||
Returns: | ||
DictConfig | ListConfig: Updated configurable parameters in DictConfig object. | ||
""" | ||
if config.data.init_args.val_split_mode == ValSplitMode.NONE and config.trainer.limit_val_batches != 0.0: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we sure that if |
||
logger.warning("Running without validation set. Setting trainer.limit_val_batches to 0.") | ||
config.trainer.limit_val_batches = 0.0 | ||
return config | ||
|
||
|
||
def _show_warnings(config: DictConfig | ListConfig | Namespace) -> None: | ||
"""Show warnings if any based on the configuration settings. | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What happens if
datamodule
is not None andtest_dataloaders
is not None