Dynamic Quantization for GPT2 model from huggingface.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9.3k
- Forks
- 4.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 4
Description
Hi,
Reproducibility required: PyTorch version 1.4.0
I am trying to use the torch.quantization.quantize_dynamic function to quantize the pre_trained DistilGPT2 model from Hugging-face.
As most transformer blocks in this model are made up of the nn.Conv1d modules, there occurs a problem while performing the quantization.
I understand, because the function torch.quantization.quantize_dynamic does not define a way for quantizing the nn.Conv1d layer (see the snippet below), they all just go UN-Quantized
if qconfig_spec is None:
if dtype == torch.qint8:
qconfig_spec = {
nn.Linear : default_dynamic_qconfig,
nn.LSTM : default_dynamic_qconfig
}
Please suggest a solution.
cc @jerryzh168 @jianyuh
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported behavior with PyTorch 1.4.0, torch.quantization.quantize_dynamic, and the pre-trained DistilGPT2 model from Hugging Face. No repository file, test, or acceptance criteria is named, so the intended solution and definition of done would need clarification before implementation.
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