Re-quantize models in FP16 in keep positional encoding in FP32 to avoid bad accuracy
Browse files- convert_to_fp16.py +3 -1
- rtmo-l.fp16.onnx +2 -2
- rtmo-m.fp16.onnx +2 -2
- rtmo-s.fp16.onnx +2 -2
- rtmo-t.fp16.onnx +2 -2
convert_to_fp16.py
CHANGED
@@ -2,6 +2,8 @@ import argparse
|
|
2 |
from onnxmltools.utils.float16_converter import convert_float_to_float16
|
3 |
from onnxmltools.utils import load_model, save_model
|
4 |
|
|
|
|
|
5 |
def main():
|
6 |
# Set up an argument parser
|
7 |
parser = argparse.ArgumentParser(description='Convert ONNX model from Float32 to Float16.')
|
@@ -17,7 +19,7 @@ def main():
|
|
17 |
|
18 |
# Convert model from Float32 to Float16
|
19 |
print("Converting model...")
|
20 |
-
new_onnx_model = convert_float_to_float16(onnx_model, min_positive_val=1e-7, max_finite_val=1e4, keep_io_types=True)
|
21 |
|
22 |
# Save the converted model
|
23 |
print(f"Saving converted model to {args.output_model}")
|
|
|
2 |
from onnxmltools.utils.float16_converter import convert_float_to_float16
|
3 |
from onnxmltools.utils import load_model, save_model
|
4 |
|
5 |
+
node_block_list = ['Sin_689', 'MatMul_694', 'MatMul_698', 'Clip_699', 'Clip_700', 'Sub_702', 'Sub_704']
|
6 |
+
|
7 |
def main():
|
8 |
# Set up an argument parser
|
9 |
parser = argparse.ArgumentParser(description='Convert ONNX model from Float32 to Float16.')
|
|
|
19 |
|
20 |
# Convert model from Float32 to Float16
|
21 |
print("Converting model...")
|
22 |
+
new_onnx_model = convert_float_to_float16(onnx_model, min_positive_val=1e-7, max_finite_val=1e4, keep_io_types=True, node_block_list=node_block_list)
|
23 |
|
24 |
# Save the converted model
|
25 |
print(f"Saving converted model to {args.output_model}")
|
rtmo-l.fp16.onnx
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:94010d0d62a79c87e7dd3fdf74395f6ed4e73918e4fc8ee3de94d90051dcc160
|
3 |
+
size 88025578
|
rtmo-m.fp16.onnx
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0413fa25c7796c3f1ed97ee92069192a5e923a7422aedb2291bcab96042ee184
|
3 |
+
size 44703434
|
rtmo-s.fp16.onnx
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5ff4fd6f14d9f5c7fe4b59896789debc5713a39f64f7ecf60bbb98ae59c75509
|
3 |
+
size 19873230
|
rtmo-t.fp16.onnx
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a4d4df491a850429f32e738ec3273aceecda9e08e034607e9ea2413270977b66
|
3 |
+
size 13735169
|