π€ Optimum is an extension of π€ Transformers, providing a set of performance optimization tools enabling maximum efficiency to train and run models on targeted hardware.
The AI ecosystem evolves quickly and more and more specialized hardware along with their own optimizations are emerging every day. As such, Optimum enables users to efficiently use any of these platforms with the same ease inherent to transformers.
π€ Optimum aims at providing more diversity towards the kind of hardware users can target to train and finetune their models.
To achieve this, we are collaborating with the following hardware manufacturers in order to provide the best transformers integration:
Along with supporting dedicated AI hardware for training, Optimum also provides inference optimizations towards various frameworks and platforms.
We currently support ONNX runtime along with Intel Neural Compressor (INC).
| Features | ONNX Runtime | Intel Neural Compressor |
|---|---|---|
| Post-training Dynamic Quantization | β | β |
| Post-training Static Quantization | β | β |
| Quantization Aware Training (QAT) | Stay tuned! β | β |
| Pruning | N/A | β |
π€ Optimum can be installed using pip as follows:
python -m pip install optimum
If youβd like to use the accelerator-specific features of π€ Optimum, you can install the required dependencies according to the table below:
| Accelerator | Installation |
|---|---|
| ONNX runtime | python -m pip install optimum[onnxruntime] |
| Intel Neural Compressor (INC) | python -m pip install optimum[intel] |
| Graphcore IPU | python -m pip install optimum[graphcore] |
| Habana Gaudi Processor (HPU) | python -m pip install optimum[habana] |
If youβd like to play with the examples or need the bleeding edge of the code and canβt wait for a new release, you can install the base library from source as follows:
python -m pip install git+https://github.com/huggingface/optimum.git
For the acclerator-specific features, you can install them by appending #egg=optimum[accelerator_type] to the pip command, e.g.
python -m pip install git+https://github.com/huggingface/optimum.git#egg=optimum[onnxruntime]