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

[modifier refactor] Add constant pruning tests #1752

Merged
merged 14 commits into from
Oct 27, 2023

Conversation

rahul-tuli
Copy link
Member

@rahul-tuli rahul-tuli commented Oct 9, 2023

This PR serves as the base branch for all ConstantPruningModifier tests:

@rahul-tuli rahul-tuli marked this pull request as ready for review October 9, 2023 14:20
@rahul-tuli rahul-tuli changed the title [WIP] Add constant pruning tests modifier refactor Add constant pruning tests modifier refactor Oct 9, 2023
@rahul-tuli rahul-tuli changed the title Add constant pruning tests modifier refactor [modifier refactor] Add constant pruning tests Oct 9, 2023
@rahul-tuli rahul-tuli marked this pull request as draft October 9, 2023 14:41
@rahul-tuli rahul-tuli self-assigned this Oct 11, 2023
@rahul-tuli rahul-tuli marked this pull request as ready for review October 11, 2023 15:20
Copy link

@Satrat Satrat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to test the mask is correctly being added and removed(see comments), but otherwise this is looking good!

tests/sparseml/core/recipe/test_recipe.py Outdated Show resolved Hide resolved
tests/sparseml/modifiers/pruning/constant/test_pytorch.py Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
tests/sparseml/modifiers/pruning/constant/test_pytorch.py Outdated Show resolved Hide resolved
tests/sparseml/modifiers/pruning/constant/test_pytorch.py Outdated Show resolved Hide resolved
tests/sparseml/modifiers/pruning/constant/test_pytorch.py Outdated Show resolved Hide resolved
tests/sparseml/modifiers/pruning/constant/test_pytorch.py Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
tests/sparseml/helpers.py Show resolved Hide resolved
@Satrat Satrat self-requested a review October 19, 2023 13:46
Copy link

@Satrat Satrat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, but I think our branches have diverged a bit of testing layout. Lets figure it out in pair programming today then get this merged

that torch isn't imported unless running the tests
* Bugfix .dict() method on Recipe

* Remove extraneous local test, [faulty commit]
* Add serialization tests

* Clean up

* Keep original stage and group names
Clean up _get_yaml_dict

* fix comment

* Typo
* Move valid recipes to a helper file
Add tests for session.py

* Increase test coverage of src/sparseml/core/session.py
to 100%
Run Style
Add logs to .gitignore

* Increase coverage of tests/sparseml/core/test_state.py
to 100%

* add tests for lifecycle/event.py

* Increase code coverage of lifecycle/event to
100%

* increase lifecycle/session.py code coverage to 93%

* Address review comments from @Satrat
Update makefile to only ignore *pytorch.py files in modifier dir
Fix order in test
Add regex to makefile
Add helper function to determine if torch tests should be run
Check masks
Make transformers import optional in sparsegpt.py
* Fix mask de-register logic

* forgot to remove commented out line
@rahul-tuli rahul-tuli force-pushed the add-constant-pruning-tests-modifier-refactor branch from e11ed3d to 2c7f050 Compare October 23, 2023 21:00
@rahul-tuli rahul-tuli marked this pull request as draft October 23, 2023 21:03
bfineran
bfineran previously approved these changes Oct 24, 2023
@rahul-tuli rahul-tuli marked this pull request as ready for review October 25, 2023 01:35
@rahul-tuli
Copy link
Member Author

The failing test tests/sparseml/pytorch/modifiers/quantization/test_pytorch.py is fixed by #1790

Copy link

@Satrat Satrat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great pending the session reset PR getting merged!

@bfineran bfineran merged commit b3cfbf4 into main Oct 27, 2023
9 of 11 checks passed
@bfineran bfineran deleted the add-constant-pruning-tests-modifier-refactor branch October 27, 2023 16:32
rahul-tuli added a commit that referenced this pull request Oct 30, 2023
* Initial commit

* Add end to end tests

* Add e2e tests for constant pruning modifier

* Move imports inside the test fuctions so
that torch isn't imported unless running the tests

* Update setup.py to not run modifier tests unless pytorch is specified

* [Bugfix] .dict() method on Recipe (#1753)

* Bugfix .dict() method on Recipe

* Remove extraneous local test, [faulty commit]

* [modifier refactor] Add serialization tests (#1755)

* Add serialization tests

* Clean up

* Keep original stage and group names
Clean up _get_yaml_dict

* fix comment

* Typo

* [Unit Tests][Modifier Refactor] (#1756)

* Move valid recipes to a helper file
Add tests for session.py

* Increase test coverage of src/sparseml/core/session.py
to 100%
Run Style
Add logs to .gitignore

* Increase coverage of tests/sparseml/core/test_state.py
to 100%

* add tests for lifecycle/event.py

* Increase code coverage of lifecycle/event to
100%

* increase lifecycle/session.py code coverage to 93%

* Address review comments from @Satrat

* Address review comments on 1752 (#1772)

Update makefile to only ignore *pytorch.py files in modifier dir
Fix order in test
Add regex to makefile
Add helper function to determine if torch tests should be run
Check masks
Make transformers import optional in sparsegpt.py

* Fix merge conflict

* Add more tests to check valid modifiers are created (#1774)

* [Bug][ConstantPruningModifier] Fix mask de register bug (#1773)

* Fix mask de-register logic

* forgot to remove commented out line

* Move tests inside pytorch directory as requested

* Fix session reset (#1790)
rahul-tuli added a commit that referenced this pull request Oct 31, 2023
* - Update `src/sparseml/modifiers/obcq/pytorch.py`
to use layer prefix for from model
- Remove `layer_prefix` from `SparseGPTModifier` base
- Update ModelMetaData to include layer_prefix
- Added a convenience function to update missing
values in RecipeMetaData instance from another RecipeMetaData instance
- Update simplify recipe to also include metadata
- Update simplify_combine_recipes to include metadata
- Add layer_prefix property to `ModifiableModel`
- propagate `layer_prefix` to superclass
- update session.py to set_layer_prefix on the model
before initializing modifiers
- Update example recipe to include layer_prefix in metadata

* Add missing docstring

* - address review comment
- update docstring
- add test for `update_missing_metadata`

* Add test

* Style

* Fix tests

* Style

* [modifier refactor] Add constant pruning tests  (#1752)

* Initial commit

* Add end to end tests

* Add e2e tests for constant pruning modifier

* Move imports inside the test fuctions so
that torch isn't imported unless running the tests

* Update setup.py to not run modifier tests unless pytorch is specified

* [Bugfix] .dict() method on Recipe (#1753)

* Bugfix .dict() method on Recipe

* Remove extraneous local test, [faulty commit]

* [modifier refactor] Add serialization tests (#1755)

* Add serialization tests

* Clean up

* Keep original stage and group names
Clean up _get_yaml_dict

* fix comment

* Typo

* [Unit Tests][Modifier Refactor] (#1756)

* Move valid recipes to a helper file
Add tests for session.py

* Increase test coverage of src/sparseml/core/session.py
to 100%
Run Style
Add logs to .gitignore

* Increase coverage of tests/sparseml/core/test_state.py
to 100%

* add tests for lifecycle/event.py

* Increase code coverage of lifecycle/event to
100%

* increase lifecycle/session.py code coverage to 93%

* Address review comments from @Satrat

* Address review comments on 1752 (#1772)

Update makefile to only ignore *pytorch.py files in modifier dir
Fix order in test
Add regex to makefile
Add helper function to determine if torch tests should be run
Check masks
Make transformers import optional in sparsegpt.py

* Fix merge conflict

* Add more tests to check valid modifiers are created (#1774)

* [Bug][ConstantPruningModifier] Fix mask de register bug (#1773)

* Fix mask de-register logic

* forgot to remove commented out line

* Move tests inside pytorch directory as requested

* Fix session reset (#1790)

* fix datasets version to be compatible with fsspec (#1797)

* Add kvcache config for Mistral (#1766)

* Add kvcache config for Mistral

* Update configs.py

* Update configs.py

* Fix reset logic

* Style after resolving merge conflicts

---------

Co-authored-by: Sara Adkins <sara@neuralmagic.com>
Co-authored-by: Michael Goin <michael@neuralmagic.com>
bfineran pushed a commit that referenced this pull request Nov 16, 2023
* Initial commit

* Add end to end tests

* Add e2e tests for constant pruning modifier

* Move imports inside the test fuctions so
that torch isn't imported unless running the tests

* Update setup.py to not run modifier tests unless pytorch is specified

* [Bugfix] .dict() method on Recipe (#1753)

* Bugfix .dict() method on Recipe

* Remove extraneous local test, [faulty commit]

* [modifier refactor] Add serialization tests (#1755)

* Add serialization tests

* Clean up

* Keep original stage and group names
Clean up _get_yaml_dict

* fix comment

* Typo

* [Unit Tests][Modifier Refactor] (#1756)

* Move valid recipes to a helper file
Add tests for session.py

* Increase test coverage of src/sparseml/core/session.py
to 100%
Run Style
Add logs to .gitignore

* Increase coverage of tests/sparseml/core/test_state.py
to 100%

* add tests for lifecycle/event.py

* Increase code coverage of lifecycle/event to
100%

* increase lifecycle/session.py code coverage to 93%

* Address review comments from @Satrat

* Address review comments on 1752 (#1772)

Update makefile to only ignore *pytorch.py files in modifier dir
Fix order in test
Add regex to makefile
Add helper function to determine if torch tests should be run
Check masks
Make transformers import optional in sparsegpt.py

* Fix merge conflict

* Add more tests to check valid modifiers are created (#1774)

* [Bug][ConstantPruningModifier] Fix mask de register bug (#1773)

* Fix mask de-register logic

* forgot to remove commented out line

* Move tests inside pytorch directory as requested

* Fix session reset (#1790)
bfineran pushed a commit that referenced this pull request Nov 16, 2023
* - Update `src/sparseml/modifiers/obcq/pytorch.py`
to use layer prefix for from model
- Remove `layer_prefix` from `SparseGPTModifier` base
- Update ModelMetaData to include layer_prefix
- Added a convenience function to update missing
values in RecipeMetaData instance from another RecipeMetaData instance
- Update simplify recipe to also include metadata
- Update simplify_combine_recipes to include metadata
- Add layer_prefix property to `ModifiableModel`
- propagate `layer_prefix` to superclass
- update session.py to set_layer_prefix on the model
before initializing modifiers
- Update example recipe to include layer_prefix in metadata

* Add missing docstring

* - address review comment
- update docstring
- add test for `update_missing_metadata`

* Add test

* Style

* Fix tests

* Style

* [modifier refactor] Add constant pruning tests  (#1752)

* Initial commit

* Add end to end tests

* Add e2e tests for constant pruning modifier

* Move imports inside the test fuctions so
that torch isn't imported unless running the tests

* Update setup.py to not run modifier tests unless pytorch is specified

* [Bugfix] .dict() method on Recipe (#1753)

* Bugfix .dict() method on Recipe

* Remove extraneous local test, [faulty commit]

* [modifier refactor] Add serialization tests (#1755)

* Add serialization tests

* Clean up

* Keep original stage and group names
Clean up _get_yaml_dict

* fix comment

* Typo

* [Unit Tests][Modifier Refactor] (#1756)

* Move valid recipes to a helper file
Add tests for session.py

* Increase test coverage of src/sparseml/core/session.py
to 100%
Run Style
Add logs to .gitignore

* Increase coverage of tests/sparseml/core/test_state.py
to 100%

* add tests for lifecycle/event.py

* Increase code coverage of lifecycle/event to
100%

* increase lifecycle/session.py code coverage to 93%

* Address review comments from @Satrat

* Address review comments on 1752 (#1772)

Update makefile to only ignore *pytorch.py files in modifier dir
Fix order in test
Add regex to makefile
Add helper function to determine if torch tests should be run
Check masks
Make transformers import optional in sparsegpt.py

* Fix merge conflict

* Add more tests to check valid modifiers are created (#1774)

* [Bug][ConstantPruningModifier] Fix mask de register bug (#1773)

* Fix mask de-register logic

* forgot to remove commented out line

* Move tests inside pytorch directory as requested

* Fix session reset (#1790)

* fix datasets version to be compatible with fsspec (#1797)

* Add kvcache config for Mistral (#1766)

* Add kvcache config for Mistral

* Update configs.py

* Update configs.py

* Fix reset logic

* Style after resolving merge conflicts

---------

Co-authored-by: Sara Adkins <sara@neuralmagic.com>
Co-authored-by: Michael Goin <michael@neuralmagic.com>
bfineran pushed a commit that referenced this pull request Nov 16, 2023
* Initial commit

* Add end to end tests

* Add e2e tests for constant pruning modifier

* Move imports inside the test fuctions so
that torch isn't imported unless running the tests

* Update setup.py to not run modifier tests unless pytorch is specified

* [Bugfix] .dict() method on Recipe (#1753)

* Bugfix .dict() method on Recipe

* Remove extraneous local test, [faulty commit]

* [modifier refactor] Add serialization tests (#1755)

* Add serialization tests

* Clean up

* Keep original stage and group names
Clean up _get_yaml_dict

* fix comment

* Typo

* [Unit Tests][Modifier Refactor] (#1756)

* Move valid recipes to a helper file
Add tests for session.py

* Increase test coverage of src/sparseml/core/session.py
to 100%
Run Style
Add logs to .gitignore

* Increase coverage of tests/sparseml/core/test_state.py
to 100%

* add tests for lifecycle/event.py

* Increase code coverage of lifecycle/event to
100%

* increase lifecycle/session.py code coverage to 93%

* Address review comments from @Satrat

* Address review comments on 1752 (#1772)

Update makefile to only ignore *pytorch.py files in modifier dir
Fix order in test
Add regex to makefile
Add helper function to determine if torch tests should be run
Check masks
Make transformers import optional in sparsegpt.py

* Fix merge conflict

* Add more tests to check valid modifiers are created (#1774)

* [Bug][ConstantPruningModifier] Fix mask de register bug (#1773)

* Fix mask de-register logic

* forgot to remove commented out line

* Move tests inside pytorch directory as requested

* Fix session reset (#1790)
bfineran pushed a commit that referenced this pull request Nov 16, 2023
* - Update `src/sparseml/modifiers/obcq/pytorch.py`
to use layer prefix for from model
- Remove `layer_prefix` from `SparseGPTModifier` base
- Update ModelMetaData to include layer_prefix
- Added a convenience function to update missing
values in RecipeMetaData instance from another RecipeMetaData instance
- Update simplify recipe to also include metadata
- Update simplify_combine_recipes to include metadata
- Add layer_prefix property to `ModifiableModel`
- propagate `layer_prefix` to superclass
- update session.py to set_layer_prefix on the model
before initializing modifiers
- Update example recipe to include layer_prefix in metadata

* Add missing docstring

* - address review comment
- update docstring
- add test for `update_missing_metadata`

* Add test

* Style

* Fix tests

* Style

* [modifier refactor] Add constant pruning tests  (#1752)

* Initial commit

* Add end to end tests

* Add e2e tests for constant pruning modifier

* Move imports inside the test fuctions so
that torch isn't imported unless running the tests

* Update setup.py to not run modifier tests unless pytorch is specified

* [Bugfix] .dict() method on Recipe (#1753)

* Bugfix .dict() method on Recipe

* Remove extraneous local test, [faulty commit]

* [modifier refactor] Add serialization tests (#1755)

* Add serialization tests

* Clean up

* Keep original stage and group names
Clean up _get_yaml_dict

* fix comment

* Typo

* [Unit Tests][Modifier Refactor] (#1756)

* Move valid recipes to a helper file
Add tests for session.py

* Increase test coverage of src/sparseml/core/session.py
to 100%
Run Style
Add logs to .gitignore

* Increase coverage of tests/sparseml/core/test_state.py
to 100%

* add tests for lifecycle/event.py

* Increase code coverage of lifecycle/event to
100%

* increase lifecycle/session.py code coverage to 93%

* Address review comments from @Satrat

* Address review comments on 1752 (#1772)

Update makefile to only ignore *pytorch.py files in modifier dir
Fix order in test
Add regex to makefile
Add helper function to determine if torch tests should be run
Check masks
Make transformers import optional in sparsegpt.py

* Fix merge conflict

* Add more tests to check valid modifiers are created (#1774)

* [Bug][ConstantPruningModifier] Fix mask de register bug (#1773)

* Fix mask de-register logic

* forgot to remove commented out line

* Move tests inside pytorch directory as requested

* Fix session reset (#1790)

* fix datasets version to be compatible with fsspec (#1797)

* Add kvcache config for Mistral (#1766)

* Add kvcache config for Mistral

* Update configs.py

* Update configs.py

* Fix reset logic

* Style after resolving merge conflicts

---------

Co-authored-by: Sara Adkins <sara@neuralmagic.com>
Co-authored-by: Michael Goin <michael@neuralmagic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants