Skip to content

Instantly share code, notes, and snippets.

@zilunpeng
Created March 23, 2021 21:31
Show Gist options
  • Save zilunpeng/8c530a0de99f190fe4b7bfab39020357 to your computer and use it in GitHub Desktop.
Save zilunpeng/8c530a0de99f190fe4b7bfab39020357 to your computer and use it in GitHub Desktop.
Quantize wav2vec 2.0. Code below is part of quantized wav2vec 2.0 demo notebook (https://git.io/JYe1o).
quantized_model = torch.quantization.quantize_dynamic(pt_wav2vec2, {torch.nn.Linear}, dtype=torch.qint8, inplace=True)
quantized_model.prepare_for_inference_after_quantization()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment