You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by Jonathan Mace via TVM Discuss <no...@discuss.tvm.ai> on 2020/04/21 08:16:49 UTC

[TVM Discuss] [Questions] Inconsistent params size of optimized models vs non-optimized


Hi all,

I've been compiling some gluoncv models and I noticed that the params size of the compiled model increases by a significant amount (1.5x) after optimizing, versus compiling without optimizing.  I'm just wondering why this is the case.

Concretely, for resnet18v2, if I just compile the model without any autotvm optimization, the compiled model has about 46MB params; if I do even just one iteration of optimization, the compiled model jumps to 77MB params.

I'm compiling for CUDA GPU.

See here for the example compiled models:
* http://people.mpi-sws.org/~jcmace/tvm/resnet18_v2_opt/tvm-model.json
* http://people.mpi-sws.org/~jcmace/tvm/resnet18_v2_noopt/tvm-model.json
* (for the .so and .params files, replace .json in the above URLs; this message board has a limit of 2 URLs per post)

Is this expected behavior?  Thanks in advance.

Jon





---
[Visit Topic](https://discuss.tvm.ai/t/inconsistent-params-size-of-optimized-models-vs-non-optimized/6444/1) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.ai/email/unsubscribe/a3136571b883d38801d0d82968a6641f230c780e9efc9dc8ba0f1d679a841ad5).

[TVM Discuss] [Questions] Inconsistent params size of optimized models vs non-optimized

Posted by Jonathan Mace via TVM Discuss <no...@discuss.tvm.ai>.

OK to answer my own question:

The easiest way to disable weight transformations is to exclude winograd tasks from the optimization process.  After calling `extract_from_program`, you can filter the returned tasks based on whether `winograd` is in the task name (hacky but simple).

Alternatively, if you have logged the tuning history to a file, you can manually edit it to remove the winograd optimizations.

Here are some quick performance for resnet18_v2 on a tesla v100 using the same tuning history, just removing the winograds.

Model size (bytes)

* normal size = 46737836
* winograd size = 77408684 (+66%)

Execution latency (batch size 1)
* winograd = 0.95ms
* non-winograd = 1.33ms (+40%)





---
[Visit Topic](https://discuss.tvm.ai/t/inconsistent-params-size-of-optimized-models-vs-non-optimized/6444/3) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.ai/email/unsubscribe/3e77f825cb194627488ca9898592a48f6d41dd7426d0484f407958da7f33a523).

[TVM Discuss] [Questions] Inconsistent params size of optimized models vs non-optimized

Posted by masahi via TVM Discuss <no...@discuss.tvm.ai>.

Can you try this? 

```
with relay.build_config(opt_level=3, disabled_pass=["AlterOpLayout"]):
   ...
```

If my memory is right, AlterLayout is what enables winograd weight transform at compile time. I agree 1.5x increase is pretty bad. Since weight transform is cheap, I don't think perf hit would be big.





---
[Visit Topic](https://discuss.tvm.ai/t/inconsistent-params-size-of-optimized-models-vs-non-optimized/6444/4) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.ai/email/unsubscribe/2d36493138dda5ac67dc0df3b23975dcc48b2934720d6cb92b45ebbd1b6a778c).