Skip to content

Commit 37b9d36

Browse files
[WC][Tests] Compressed weights refs/ do_float_quantization refs (#3724)
### Changes * `test_compare_compressed_weights` is updated with MXFP and FP types * `reference compressed weights` refs are introduced for the test_compare_compressed_weights * `test_float_compressed_weighs_range` is introduced to check the `do_float_quantization` function * `--regen-ref-data` and `--nncf-debug` params are added to the openvino `conftest.py` ### Reason for changes To cover MXFP types, compressed weight and `do_float_quantization` function by unit tests ### Related tickets 174717
1 parent bf56785 commit 37b9d36

17 files changed

+1494
-669
lines changed

tests/openvino/conftest.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@
99
# See the License for the specific language governing permissions and
1010
# limitations under the License.
1111

12+
import logging
13+
import os
1214
from pathlib import Path
1315

1416
import pytest
1517

18+
from nncf import set_log_level
1619
from tests.cross_fw.shared.case_collection import COMMON_SCOPE_MARKS_VS_OPTIONS
1720
from tests.cross_fw.shared.case_collection import skip_marked_cases_if_options_not_specified
1821
from tests.cross_fw.shared.install_fixtures import tmp_venv_with_nncf # noqa: F401
@@ -21,6 +24,28 @@
2124

2225
def pytest_addoption(parser):
2326
parser.addoption("--data", type=str, default=None, help="Directory path to cached data.")
27+
parser.addoption(
28+
"--regen-ref-data",
29+
action="store_true",
30+
default=False,
31+
help="If specified, the reference files will be regenerated using the current state of the repository.",
32+
)
33+
parser.addoption(
34+
"--nncf-debug",
35+
action="store_true",
36+
default=False,
37+
help="Set debug level for nncf logger.",
38+
)
39+
40+
41+
def pytest_configure(config) -> None:
42+
regen_dot = config.getoption("--regen-ref-data", False)
43+
if regen_dot:
44+
os.environ["NNCF_TEST_REGEN_DOT"] = "1"
45+
46+
nncf_debug = config.getoption("--nncf-debug", False)
47+
if nncf_debug:
48+
set_log_level(logging.DEBUG)
2449

2550

2651
@pytest.fixture(name="data_dir")

tests/openvino/native/data/2024.1/reference_scales/IntegerModel_compressed_weights_int4_asym.json

Lines changed: 145 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,177 +1,253 @@
11
{
22
"matmul_2_data": {
3+
"compressed_weight": [
4+
[
5+
[
6+
7.0,
7+
0.0,
8+
13.0
9+
]
10+
],
11+
[
12+
[
13+
15.0,
14+
4.0,
15+
0.0
16+
]
17+
],
18+
[
19+
[
20+
10.0,
21+
1.0,
22+
0.0
23+
]
24+
],
25+
[
26+
[
27+
11.0,
28+
0.0,
29+
15.0
30+
]
31+
],
32+
[
33+
[
34+
0.0,
35+
15.0,
36+
3.0
37+
]
38+
],
39+
[
40+
[
41+
0.0,
42+
9.0,
43+
15.0
44+
]
45+
]
46+
],
47+
"zero_point": [
48+
[
49+
[
50+
15.0
51+
]
52+
],
53+
[
54+
[
55+
9.0
56+
]
57+
],
58+
[
59+
[
60+
15.0
61+
]
62+
],
63+
[
64+
[
65+
8.0
66+
]
67+
],
68+
[
69+
[
70+
6.0
71+
]
72+
],
73+
[
74+
[
75+
7.0
76+
]
77+
]
78+
],
379
"scale": [
480
[
581
[
6-
0.04962158203125
82+
0.040008544921875
783
]
884
],
985
[
1086
[
11-
0.0567626953125
87+
0.0992431640625
1288
]
1389
],
1490
[
1591
[
16-
0.056610107421875
92+
0.041839599609375
1793
]
1894
],
1995
[
2096
[
21-
0.037994384765625
97+
0.049774169921875
2298
]
2399
],
24100
[
25101
[
26-
0.054473876953125
102+
0.0989990234375
27103
]
28104
],
29105
[
30106
[
31-
0.064453125
107+
0.10955810546875
32108
]
33109
]
34110
]
35111
},
36112
"matmul_1_data": {
37113
"compressed_weight": [
38114
[
39-
119,
40-
168,
41-
11,
42-
49,
115+
107,
116+
156,
117+
0,
118+
38,
43119
255,
44-
255
120+
245
45121
],
46122
[
123+
96,
124+
0,
47125
255,
48-
159,
49-
255,
50-
255,
51-
255,
52-
255
126+
248,
127+
125,
128+
111
53129
],
54130
[
131+
241,
132+
111,
133+
0,
55134
255,
56-
169,
57-
59,
58-
255,
59-
228,
60-
135
135+
170,
136+
76
61137
],
62138
[
63-
202,
64-
255,
139+
68,
140+
236,
65141
255,
66-
149,
67-
238,
68-
134
142+
15,
143+
104,
144+
0
69145
],
70146
[
71-
229,
72-
130,
73-
151,
147+
141,
148+
43,
149+
63,
74150
255,
75-
87,
76-
240
151+
0,
152+
152
77153
],
78154
[
79-
26,
80-
255,
81-
245,
82-
75,
155+
8,
156+
242,
157+
228,
158+
57,
83159
255,
84-
18
160+
0
85161
]
86162
],
87163
"zero_point": [
88164
[
89-
0
165+
187
90166
],
91167
[
92-
0
168+
48
93169
],
94170
[
95-
0
171+
159
96172
],
97173
[
98-
0
174+
74
99175
],
100176
[
101-
0
177+
105
102178
],
103179
[
104-
0
180+
138
105181
]
106182
],
107183
"scale": [
108184
[
109-
0.0025196075439453125
185+
0.005039215087890625
110186
],
111187
[
112-
0.0024051666259765625
188+
0.004810333251953125
113189
],
114190
[
115-
0.002300262451171875
191+
0.00460052490234375
116192
],
117193
[
118-
0.0024013519287109375
194+
0.004802703857421875
119195
],
120196
[
121-
0.0025997161865234375
197+
0.005199432373046875
122198
],
123199
[
124-
0.003208160400390625
200+
0.00641632080078125
125201
]
126202
]
127203
},
128204
"gather_2_data": {
129205
"compressed_weight": [
130206
[
131-
181,
132-
77,
133-
12,
134-
5,
135-
231,
207+
177,
208+
72,
209+
7,
210+
0,
211+
227,
136212
255
137213
],
138214
[
139-
166,
140-
200,
141-
149,
215+
165,
216+
199,
217+
148,
142218
255,
143-
223,
144-
1
219+
222,
220+
0
145221
],
146222
[
223+
253,
224+
0,
225+
214,
226+
43,
147227
255,
148-
10,
149-
224,
150-
54,
151-
255,
152-
166
228+
156
153229
]
154230
],
155231
"zero_point": [
156232
[
157-
0
233+
138
158234
],
159235
[
160-
0
236+
136
161237
],
162238
[
163-
0
239+
143
164240
]
165241
],
166242
"scale": [
167243
[
168-
0.0035152435302734375
244+
0.007030487060546875
169245
],
170246
[
171-
0.0036563873291015625
247+
0.007312774658203125
172248
],
173249
[
174-
0.003253936767578125
250+
0.00650787353515625
175251
]
176252
]
177253
}

0 commit comments

Comments
 (0)