Skip to content

Commit 1290c84

Browse files
fix data free step (#3570)
### Changes Fix problem with data free AWQ algorithm ### Reason for changes The axis for the mean should depend on the reduction axis. ### Related tickets N/A
1 parent 2e98294 commit 1290c84

File tree

1 file changed

+3
-3
lines changed
  • src/nncf/quantization/algorithms/weight_compression

1 file changed

+3
-3
lines changed

src/nncf/quantization/algorithms/weight_compression/awq.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def apply(
165165
weight = weight.astype(TensorDataType.float32)
166166

167167
if is_data_free:
168-
scale = self._data_free_step(weight)
168+
scale = self._data_free_step(weight, 1 - wp.reduction_axes[0])
169169
else:
170170
scale = self._data_aware_step(wp, weight, statistics[k])
171171

@@ -272,9 +272,9 @@ def _data_aware_step(self, wp, weight, statistics):
272272

273273
return scale
274274

275-
def _data_free_step(self, weight):
275+
def _data_free_step(self, weight, axis):
276276
eps = fns.finfo(weight).eps
277-
scale = fns.maximum(fns.mean(fns.abs(weight), axis=0), eps)
277+
scale = fns.maximum(fns.mean(fns.abs(weight), axis=axis), eps)
278278
return 1 / scale
279279

280280
def _get_awq_data(

0 commit comments

Comments
 (0)