Skip to content

Commit 0c4be3c

Browse files
authored
Fix NNCF training on CPU (#2373)
1 parent c28c612 commit 0c4be3c

File tree

1 file changed

+5
-1
lines changed
  • src/otx/algorithms/common/adapters/mmcv/nncf

1 file changed

+5
-1
lines changed

src/otx/algorithms/common/adapters/mmcv/nncf/runners.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ def dump_checkpoint_fn(model, compression_ctrl, nncf_runner, save_dir):
111111
self._eval_hook._save_ckpt(self, nncf_runner.best_val_metric_value)
112112
return self._eval_hook.best_ckpt_path
113113

114-
uncompressed_model_accuracy = self.model.module.nncf._uncompressed_model_accuracy
114+
if hasattr(self.model, "module"):
115+
uncompressed_model_accuracy = self.model.module.nncf._uncompressed_model_accuracy
116+
else:
117+
uncompressed_model_accuracy = self.model.nncf._uncompressed_model_accuracy
118+
115119
acc_aware_training_loop = create_accuracy_aware_training_loop(
116120
self.nncf_config,
117121
self.compression_ctrl,

0 commit comments

Comments
 (0)