Instructions to use CatSnowdrop/universal_onnxruntime with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TensorRT
How to use CatSnowdrop/universal_onnxruntime with TensorRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Download onnxruntime/quantization/operators/qdq_base_operator.py from CatSnowdrop/universal_onnxruntime: direct link, hf CLI and curl.
- Browser
- Download file 801 Bytes
-
https://huggingface.co/CatSnowdrop/universal_onnxruntime/resolve/main/onnxruntime/quantization/operators/qdq_base_operator.py
- Command line
-
hf download hf://CatSnowdrop/universal_onnxruntime/onnxruntime/quantization/operators/qdq_base_operator.py
-
curl -L -o qdq_base_operator.py https://huggingface.co/CatSnowdrop/universal_onnxruntime/resolve/main/onnxruntime/quantization/operators/qdq_base_operator.py
801 Bytes
| import itertools | |
| from ..quant_utils import QuantizedValue, QuantizedValueType, attribute_to_kwarg, quantize_nparray # noqa: F401 | |
| from .base_operator import QuantOperatorBase # noqa: F401 | |
| class QDQOperatorBase: | |
| def __init__(self, onnx_quantizer, onnx_node): | |
| self.quantizer = onnx_quantizer | |
| self.node = onnx_node | |
| self.disable_qdq_for_node_output = onnx_node.op_type in onnx_quantizer.op_types_to_exclude_output_quantization | |
| def quantize(self): | |
| node = self.node | |
| if self.disable_qdq_for_node_output: | |
| tensors_to_quantize = node.input | |
| else: | |
| tensors_to_quantize = itertools.chain(node.input, node.output) | |
| for tensor_name in tensors_to_quantize: | |
| self.quantizer.quantize_activation_tensor(tensor_name) | |