deepspeedai / deepspeedai/DeepSpeed

[REQUEST] Usability of quantised models

Open
#4,112 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

I have used the compression tool of deepspeed to quantise a model. When I save the model state dict, the quantised tensors are indeed quantised, e.g. if I quantise using 8bit precision, I get that the tensor has at most 6084 unique values, corresponding to all the values that an 8bit register can take. Nonetheless, the precision of the corresponding tensors is fp16, and the actual values of the tensor are not integers.

It is not clear in any part of the documentation how should one:

  1. Save a quantised model, where the dtypes of the quantised tensors are correct, e.g. int8.
  2. Once one has a model with such dtypes, how to actually run the model for inference (https://www.deepspeed.ai/tutorials/inference-tutorial/#datatypes-and-quantized-models is not clear enough, as the first model object may use fp16 or fp32, which is already too big for edge devices).

Describe the solution you'd like
I would like a utility to save the quantised model with the correct data types, as well as a utility to load this model (with the internal knowledge of what the quantisation scales are).

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.

Research direction

Start by reviewing the DeepSpeed compression tool and the linked Inference tutorial, focusing on model state-dict saving, quantised dtypes, and inference datatypes. The requested outcome is a utility to save quantised tensors with appropriate dtypes and load them with their quantisation scales, but the issue does not identify files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.