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

🔨 Fix nncf key issue in nightly job #238

Merged
merged 8 commits into from
May 5, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion anomalib/utils/callbacks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def get_callbacks(config: Union[ListConfig, DictConfig]) -> List[Callback]:
nncf_config = yaml.safe_load(OmegaConf.to_yaml(config.optimization.nncf))
callbacks.append(
nncf_callback(
config=nncf_config,
nncf_config=nncf_config,
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is nncf_callback, config would indicate the nncf_config, wouldn't it? In this case, not sure if we need this renaming here.

export_dir=os.path.join(config.project.path, "compressed"),
)
)
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def setup_model_train(
config.model.weight_file = weight_file if not fast_run else "weights/last.ckpt"

if nncf:
config.optimization.nncf.apply = True
config.optimization["nncf"] = {"apply": True, "input_info": {"sample_size": None}}
config = update_nncf_config(config)
config.init_weights = None

Expand Down
2 changes: 1 addition & 1 deletion tests/nightly/models/test_model_nightly.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def _test_metrics(self, trainer, config, model, datamodule):
thresholds = OmegaConf.load("tests/nightly/models/performance_thresholds.yaml")

threshold = thresholds[config.model.name][config.dataset.category]
if "optimization" in config.keys() and config.optimization.nncf.apply:
if "optimization" in config.keys() and "nncf" in config.optimization.keys() and config.optimization.nncf.apply:
threshold = threshold.nncf
if not (
np.isclose(results["image_AUROC"], threshold["image_AUROC"], rtol=0.02)
Expand Down