Add Support Layer List to ASP#40253
Conversation
1. Added a function to allow user to add their own layer and correspond pruning way to ASP support. 2. Changed naming rule to asp masks.
|
Thanks for your contribution! |
| # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. | ||
| # Copyright (c) 2021 NVIDIA Corporation. All rights reserved. | ||
| # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. | ||
| # Copyright (c) 2022 NVIDIA Corporation. All rights reserved. |
There was a problem hiding this comment.
该文件不是本PR新增,不用修改CopyRight年份,下同。这是误改?
There was a problem hiding this comment.
Done, 2022 -> 2021
| 'get_mask_2d_greedy', 'get_mask_2d_best', 'create_mask', 'check_sparsity', | ||
| 'MaskAlgo', 'CheckMethod', 'decorate', 'prune_model', 'set_excluded_layers', | ||
| 'reset_excluded_layers' | ||
| 'reset_excluded_layers', 'add_supported_layer' |
There was a problem hiding this comment.
add_supported_layer、set_excluded_layers、reset_excluded_layers,这三个接口有点令人迷惑了。
There was a problem hiding this comment.
這三個接口功能分別如下
add_supported_layer: 讓使用者增加自己客製化的nn.Layer的參數到ASP的支援清單,預設只會支援FC, Conv2D, Linear.
set_excluded_layers: 在支援的nn.Layer的參數中,針對特定的幾層不執行ASP, 比如 一個網絡有三層FC, 但其中一層不需要ASP,怎可以使用此API來將該層排除
reset_excluded_layers: 將 set_excluded_layers 所添加的Layer全部清空。
| 'get_mask_2d_greedy', 'get_mask_2d_best', 'create_mask', 'check_sparsity', | ||
| 'MaskAlgo', 'CheckMethod', 'decorate', 'prune_model', 'set_excluded_layers', | ||
| 'reset_excluded_layers' | ||
| 'reset_excluded_layers', 'add_supported_layer' |
There was a problem hiding this comment.
add_supported_layer、set_excluded_layers、reset_excluded_layers,这三个接口有点令人迷惑了。
|
|
||
| MASK_APPENDDED_NAME = '_asp_mask' | ||
| SUPPORTED_LAYERS = {'fc': 'w_0', 'linear': 'w_0', 'conv2d': 'w_0'} | ||
| PADDLE_WEIGHT_SUFFIX = "w_" |
There was a problem hiding this comment.
这样改的好处,是可以支持更多的layer,不限定于fc、linear、conv2d?
There was a problem hiding this comment.
是的,此次改動將支援的Layer改為統一由supported_layer_list來管理
|
|
||
| MASK_APPENDDED_NAME = '_asp_mask' | ||
| SUPPORTED_LAYERS = {'fc': 'w_0', 'linear': 'w_0', 'conv2d': 'w_0'} | ||
| PADDLE_WEIGHT_SUFFIX = "w_" |
There was a problem hiding this comment.
这样改的好处,是可以支持更多的layer,不限定于fc、linear、conv2d?
| string: The mask name of :attr:`param_name`. | ||
| """ | ||
| return param_name + ASPHelper.MASK_APPENDDED_NAME | ||
| return param_name + "." + ASPHelper.MASK_APPENDDED_NAME |
| string: The mask name of :attr:`param_name`. | ||
| """ | ||
| return param_name + ASPHelper.MASK_APPENDDED_NAME | ||
| return param_name + "." + ASPHelper.MASK_APPENDDED_NAME |
| 'set_excluded_layers', | ||
| 'reset_excluded_layers' | ||
| 'reset_excluded_layers', | ||
| 'add_supported_layer' |
There was a problem hiding this comment.
这里后续PR再加?add_supported_layer、set_excluded_layers、reset_excluded_layers,这三个接口有点令人迷惑了。
There was a problem hiding this comment.
同上解釋後,是否還是要暫緩對外公開呢?
| 'set_excluded_layers', | ||
| 'reset_excluded_layers' | ||
| 'reset_excluded_layers', | ||
| 'add_supported_layer' |
There was a problem hiding this comment.
这里后续PR再加?add_supported_layer、set_excluded_layers、reset_excluded_layers,这三个接口有点令人迷惑了。
There was a problem hiding this comment.
同上解釋後,是否還是要暫緩對外公開呢?
1. Modified year of copyright. 2. Changed asp mask name from _asp_mask to asp_mask.
1. Hide add_support_layer and wait API confirmation to release. 2. Changed year of copyright.
44d0b07 to
920111e
Compare
PR types
New features
PR changes
APIs
Describe