Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keras structured SIMD pruning #871

Merged
merged 96 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
b276815
Init pruning support
Nov 28, 2023
96f6df5
Seperate is_entry and is_exit for keras nodes functions
Nov 28, 2023
3a8ffbb
split intermediate section mask to 2 masks
Nov 28, 2023
58eeedd
fixed pruned model to be trainable
Nov 28, 2023
c0fbf11
split keras functions into multiple files
Nov 28, 2023
877cf45
Add l2norm and params count to lfh scores
Nov 29, 2023
957133c
Add check for exit nodes #IC to match the #OC of their entry node
Nov 29, 2023
6a2c099
Consider null channels in graph memory computation
Nov 29, 2023
b50dc1c
Remove debug code
Nov 29, 2023
a3b3c92
Add PruningFrameworkImplementation
Nov 29, 2023
c1a3bc1
add small sections tests
Nov 29, 2023
476fcc8
Fix tf imports when tf was not found
Nov 29, 2023
73b9971
Run pruning tests in keras workflow
Nov 29, 2023
54e6fb3
add memory calculator test
Dec 3, 2023
0e69771
add simd padding to tpc
Dec 3, 2023
0433744
Take score computation out to a new LFH importance score calculator
Dec 3, 2023
8c7f0ee
split memory count from params count in memory calculator
Dec 3, 2023
6fd3fa3
rename pruning section attributes
Dec 3, 2023
92cdaf5
move has_matching_channel_count to common
Dec 3, 2023
74e4d86
rename pruner api
Dec 3, 2023
e64047e
move node count params to common memory calc
Dec 3, 2023
8dcbf85
Refactor pruned node params count
Dec 3, 2023
a5a636e
Add comments to memory calc
Dec 3, 2023
521910a
Add comments to LFH importance matric
Dec 3, 2023
c75791a
revert constant value that was changed during debug
Dec 4, 2023
522f93a
Add comments to importance metric factory
Dec 4, 2023
ac545c9
Use ChannelGrouping object to select the groups indices of each node
Dec 10, 2023
d7dc395
Add licenses to new files
Dec 10, 2023
631bce0
Undo change in qat tutorial
Dec 10, 2023
c452884
merge with main
Dec 10, 2023
5a4d5b4
Add tests to test suite for coverage inclusion
Dec 11, 2023
280803b
revert typehint fix
Dec 11, 2023
cb4331c
fix bad import of ImportanceMetric
Dec 11, 2023
7942276
Remove unneeded comments and spaces
Dec 11, 2023
044f785
add todo for moving KPI out of MP package
Dec 11, 2023
0e1bd39
Create PerChannelMask and PerSIMDGroupMask for holding and updating t…
Dec 12, 2023
a41e77f
Remove summing of scores of channels in an simd group
Dec 12, 2023
c62f458
Add documantation to mask calculator
Dec 12, 2023
4de024a
Move keras implementation functions into PruningKerasImplementation
Dec 12, 2023
5f9367d
remove fw_info from functions in base graph
Dec 12, 2023
c04a5ad
Refactor base graph pruning functions
Dec 12, 2023
94b0d4e
Add constant FP32_BYTES_PER_PARAMETER to use when computing memory fo…
Dec 12, 2023
0f47b8d
Use enum for mask indicator values
Dec 14, 2023
51dfe4e
Tests fixes
Dec 18, 2023
94828e5
add comments and assertions to get_simd in base_node
Dec 18, 2023
0c5bbcb
Add examples in the facade
Dec 18, 2023
199cd8c
Use 2 approximations in feature tests
Dec 18, 2023
2768d7c
Remove new function that was added to hessian service
Dec 19, 2023
e660dff
Add fn to calculate the num of out channels in a node in per-channel …
Dec 19, 2023
861d7ad
change remainder check in ChannelsGrouping
Dec 19, 2023
ac382e9
Add type hints and comments to ChannelsGrouping and LFHImportanceScore
Dec 20, 2023
64a7ca5
Move scores unrolling to PrunerInfo and test it
Dec 20, 2023
613869d
Extend feature tests with more simd tests
Dec 20, 2023
228865a
Remove old unused file
Dec 20, 2023
45a14a3
Rename trace occurances in lfh metric computation
Dec 20, 2023
badd233
add _get_kernel_node_oc_info to LFH metric
Dec 20, 2023
9d4c5c3
Add unit tests that use LFH and not only constant score
Dec 20, 2023
3c8c020
Add type hints to memory calculator
Dec 20, 2023
28319e7
Replace None with 1s mask when input mask can not be found
Dec 21, 2023
a917377
Add assertion for non-negative integer num oc in memory calc
Dec 21, 2023
1295c3c
Add comments to pruner and rename _create_pruned_graph to _prune_graph
Dec 21, 2023
81b8e45
Remove empty lines in hessian service info
Dec 21, 2023
0b531bc
Fix comment in pruning config
Dec 21, 2023
2fefe84
fix typehints
Dec 21, 2023
193671f
reformat pruning info
Dec 21, 2023
c59096f
rename pruning section method to get all section nodes
Dec 21, 2023
f17ab09
Add todo to rename feature tests
Dec 21, 2023
983a013
rename prune_graph fn in pruner
Dec 21, 2023
97ef899
organize imports of pruning facade
Dec 21, 2023
81edb8a
fix tpc comments and use properties where needed
Dec 21, 2023
e892522
use a single check for simd legal values instead of 2
Dec 24, 2023
97738c4
Use logger when asserting
Dec 24, 2023
3518e64
Use unittests assert when needed
Dec 24, 2023
fd5ebb2
use only one cr for testing pretrained models
Dec 24, 2023
04b3652
use keras kernel constant in random importance metric
Dec 24, 2023
0613e95
Add assertion in get_Attributes_info before iterating on kernel attri…
Dec 24, 2023
bf6c00f
rename get_node_attributes_with_oi_axis to attrs_oi_channels_info_for…
Dec 24, 2023
7f124e8
Merged from main
Dec 24, 2023
19100b0
remove todos
Dec 24, 2023
aff8068
use property in channels_grouping
Dec 24, 2023
dfb194e
remove todo
Dec 24, 2023
a30ab5d
add comments to mask files
Dec 24, 2023
4ffc45c
remove commented out code from pruner
Dec 24, 2023
becc499
remove pytorch init file
Dec 24, 2023
78e8d29
remove todos
Dec 24, 2023
5eab6d4
add example usage in notebooks
Dec 24, 2023
b492be6
Add notebook
Dec 25, 2023
6b305f1
fixes to notebook
Dec 25, 2023
38d61e1
add docs for pruning API
Dec 25, 2023
7513006
Rename importance metric factory
Dec 28, 2023
5cf8994
use mask indicator enum when initializing masks
Dec 28, 2023
449bd2e
replace a list of params count in LFH with a np array
Dec 28, 2023
60a24ea
Add fw_impl typehints
Dec 28, 2023
fa709b4
create pruning config separately in pruning tutorial
Dec 28, 2023
294f203
rename function name in memory calculator for specifying the input ma…
Dec 28, 2023
0c2290c
Update readme
Dec 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add docs for pruning API
  • Loading branch information
reuvenp committed Dec 25, 2023
commit 38d61e1e69c49773deb7feeb808dd525f2af9944
1 change: 1 addition & 0 deletions docsrc/source/api/experimental_api_docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Functions
- :ref:`get_tensorflow_data_generation_config<ug-get_tensorflow_data_generation_config>`: A function to generate a DataGenerationConfig for Tensorflow data generation(experimental).
- :ref:`pytorch_data_generation_experimental<ug-pytorch_data_generation_experimental>`: A function to generate data for a Pytorch model (experimental).
- :ref:`get_pytorch_data_generation_config<ug-get_pytorch_data_generation_config>`: A function to load a DataGenerationConfig for Pytorch data generation (experimental).
- :ref:`keras_pruning_experimental<ug-keras_pruning_experimental>`: A function to apply structured pruning for Keras models (experimental).


Modules
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
:orphan:

.. _ug-keras_pruning_experimental:


================================================
Keras Structured Pruning
================================================

.. autofunction:: model_compression_toolkit.pruning.keras_pruning_experimental

================================================
Pruning Configuration
================================================

.. autofunction:: model_compression_toolkit.pruning.PruningConfig



================================================
Pruning Information
================================================

.. autofunction:: model_compression_toolkit.pruning.PruningInfo

1 change: 1 addition & 0 deletions docsrc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Keras:
* :ref:`Mixed-precision post training quantization<ug-keras_post_training_quantization_mixed_precision>`
* :ref:`Init model for Quantization Aware Training<ug-keras_quantization_aware_training_init>` (Experimental)
* :ref:`Finalize model after Quantization Aware Training<ug-keras_quantization_aware_training_finalize>` (Experimental)
* :ref:`Structured Pruning<ug-keras_pruning_experimental>` (Experimental)

Pytorch:

Expand Down