Download quantize.py from strelizi/kosmos: direct link, hf CLI and curl.
- Browser
- Download file 355 Bytes
-
https://huggingface.co/spaces/strelizi/kosmos/resolve/main/quantize.py
- Command line
-
hf download hf://spaces/strelizi/kosmos/quantize.py
-
curl -L -o quantize.py https://huggingface.co/spaces/strelizi/kosmos/resolve/main/quantize.py
355 Bytes
| # quantize.py | |
| from onnxruntime.quantization import quantize_dynamic, QuantType | |
| print("Quantizing bge_m3_onnx/model.onnx to INT8...") | |
| quantize_dynamic( | |
| model_input="bge_m3_onnx/model.onnx", | |
| model_output="bge_m3_onnx/model_quantized.onnx", | |
| weight_type=QuantType.QUInt8 | |
| ) | |
| print("Quantization complete: bge_m3_onnx/model_quantized.onnx created!") |