It it possible to quantize a scripted model?

Hi, I was wondering if it is possible to quantize a scripted model with either eager or graph mode.

For example, there is a model scripted by torch.jit.trace() in advance. Technically, the scripted model should already both structure and weights. With that, is it possible to quantize it with either eager or graph mode?

Thanks all!

cc @jerryzh168 @James_Reed

1 Like

we do have an api for Torchscript models before: pytorch/quantize_jit.py at master · pytorch/pytorch · GitHub but it’s been de-prioritized and deprecated. The current recommendation is to quantize the model in python, with either eager mode quantization or FX Graph Mode Quantization.