Lightning-AI / Lightning-AI/pytorch-lightning

Integrate Intel Neural Compressor tool to quantize fp32 model

Open
#10,909 0 comments 1 reaction 2 assignees View on GitHub

@Borda is already working on this.

Since Nov 7, 2022.

feature
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

🚀 Feature

Intel Neural Compressor tool is an open-source Python library running on Intel CPUs and GPUs, which delivers unified interfaces across multiple deep learning frameworks for popular network compression technologies, such as quantization, pruning, knowledge distillation.

Motivation

from discussion in https://github.com/PyTorchLightning/pytorch-lightning/pull/10793
Neural Compressor supports automatic accuracy-driven tuning strategies to help users quickly find out the best-quantized model, and it supports three modes: post-training static quantization, post-training dynamic quantization and quantization aware training. It also implements different weight pruning algorithms to generate pruned models with predefined sparsity goals and supports knowledge distillation to distill the knowledge from the teacher model to the student model.

Pitch
Alternatives
Additional context

Now INC only supports the LightningModules which has a backbone model like https://github.com/PenghuiCheng/pytorch-lightning/blob/e5a9d6fb38db5c835672e45c6fcdc21444e2d7e1/pl_examples/quantization/imagenet.py#L87.

The test result on AWS c6i.16xlarge instance [Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz]
BS=1 Cores/instance=4 Instance=8

fp32 int8
accuracy 75.932 76.13
throughput 184.98 542.60

cc @borda

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.