Skip to content

What's the correct way to go about static quantization of models in timm? #643

Answered by rwightman
alexander-soare asked this question in Q&A
Discussion options

You must be logged in to vote

Assuming the trace for FX quantization is no different from other forms of tracing, there may need to be another fun workaround for the same padding (it's annoying, but no other way to support Tensorflow like SAME padding properly unless it gets implemented in the core of Pytorch someday).

See ONNX export code I have in a diff project here: https://github.com/rwightman/gen-efficientnet-pytorch/blob/master/onnx_export.py#L77-L102

It replaces conv2 dynamic same with a static (run once and then export) alternative (loose resolution flexibility) https://github.com/rwightman/gen-efficientnet-pytorch/blob/master/geffnet/conv2d_layers.py#L88-L113

I can bring that layer here if it's needed

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@alexander-soare
Comment options

@alexander-soare
Comment options

@lijuncheng16
Comment options

@alexander-soare
Comment options

@lijuncheng16
Comment options

Answer selected by alexander-soare
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants