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

Refactor of Transformers SparseML CLI and integrations #536

Merged
merged 20 commits into from
Feb 1, 2022

Conversation

markurtz
Copy link
Member

No description provided.

@markurtz markurtz requested a review from a team January 31, 2022 14:37
@markurtz markurtz self-assigned this Jan 31, 2022
@markurtz markurtz requested review from mgoin, rahul-tuli and KSGulin and removed request for a team January 31, 2022 14:37
@markurtz markurtz marked this pull request as draft January 31, 2022 14:38
Copy link
Member

@rahul-tuli rahul-tuli left a comment

Choose a reason for hiding this comment

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

Really like these changes, overall the code looks good, left a few nits,
main required change would be

  • fix the name of sparseml.sparsification package, right now it is misspelled as sparsfiication need to rename and update usages.

src/sparseml/optim/helpers.py Outdated Show resolved Hide resolved
src/sparseml/optim/helpers.py Outdated Show resolved Hide resolved
src/sparseml/optim/manager.py Show resolved Hide resolved
src/sparseml/optim/manager.py Show resolved Hide resolved
src/sparseml/optim/manager.py Outdated Show resolved Hide resolved
src/sparseml/transformers/token_classification.py Outdated Show resolved Hide resolved
src/sparseml/transformers/utils/__init__.py Show resolved Hide resolved
src/sparseml/transformers/utils/model.py Outdated Show resolved Hide resolved
src/sparseml/transformers/__init__.py Show resolved Hide resolved
src/sparseml/sparsification/types.py Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
src/sparseml/optim/manager.py Show resolved Hide resolved
src/sparseml/pytorch/optim/manager.py Show resolved Hide resolved
src/sparseml/transformers/export.py Outdated Show resolved Hide resolved
src/sparseml/transformers/export.py Show resolved Hide resolved
@markurtz markurtz marked this pull request as ready for review February 1, 2022 13:01

# create fake model input
inputs = tokenizer(
"", return_tensors="pt", padding=PaddingStrategy.MAX_LENGTH.value
).data # Dict[Tensor]
_LOGGER.info(f"Created sample inputs for the ONNX export process: {inputs}")
Copy link
Contributor

Choose a reason for hiding this comment

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

the inputs here are coming from a tokenized/padded empty string and will be just a large tensor of mostly 0s, ends up being more like log spam. could print out input shapes or names instead

bfineran
bfineran previously approved these changes Feb 1, 2022
Copy link
Contributor

@bfineran bfineran left a comment

Choose a reason for hiding this comment

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

LGTM, left comment on export logging but not critical

rahul-tuli
rahul-tuli previously approved these changes Feb 1, 2022
Copy link
Member

@rahul-tuli rahul-tuli left a comment

Choose a reason for hiding this comment

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

Looks good to me! Verified training commands run!

@markurtz markurtz dismissed stale reviews from rahul-tuli and bfineran via 5cf143d February 1, 2022 19:13
@markurtz markurtz merged commit 00add9f into main Feb 1, 2022
bfineran pushed a commit that referenced this pull request Feb 2, 2022
* Refactor of Transformers SparseML CLI and integrations

* Refactor export.py to use new pathways, fix make quality

* Update src/sparseml/optim/manager.py

Co-authored-by: Rahul Tuli <rahul@neuralmagic.com>

* Update src/sparseml/transformers/utils/model.py

Co-authored-by: Rahul Tuli <rahul@neuralmagic.com>

* fixes from review

* fixes from review and testing

* bug fixes and logging

* bug fixes for export and distillation

* review fixes, quality fixes, style fixes

* fix dependency issue

* fix distillation tests

* fix distillation tests

* fix distillation tests

* fill in docs and update style

* fix issue with distillation improperly updating students inputs

* fix quality

* Update src/sparseml/pytorch/optim/modifier_distillation.py

* add in better logging for missing and unexpected keys in model reload for transformers trainer

* fix logging for transformers export

Co-authored-by: Rahul Tuli <rahul@neuralmagic.com>
markurtz added a commit that referenced this pull request Feb 2, 2022
* Refactor of Transformers SparseML CLI and integrations (#536)

* Refactor of Transformers SparseML CLI and integrations

* Refactor export.py to use new pathways, fix make quality

* Update src/sparseml/optim/manager.py

Co-authored-by: Rahul Tuli <rahul@neuralmagic.com>

* Update src/sparseml/transformers/utils/model.py

Co-authored-by: Rahul Tuli <rahul@neuralmagic.com>

* fixes from review

* fixes from review and testing

* bug fixes and logging

* bug fixes for export and distillation

* review fixes, quality fixes, style fixes

* fix dependency issue

* fix distillation tests

* fix distillation tests

* fix distillation tests

* fill in docs and update style

* fix issue with distillation improperly updating students inputs

* fix quality

* Update src/sparseml/pytorch/optim/modifier_distillation.py

* add in better logging for missing and unexpected keys in model reload for transformers trainer

* fix logging for transformers export

Co-authored-by: Rahul Tuli <rahul@neuralmagic.com>

* Fix model load bug and add logging to catch potential future issues (#537)

* Fix model load bug and add logging to catch potential future issues

* initial migration to generalize module sparsification information

* propagate ModuleSparsificationInfo

* report type of input tensors in export.py

* minor bug fixes

* ModuleSparsificationInfo docs

* export onnx bugfix

* bug fixes

* make style

* bug fix for quantization

* revert to use ScheduledOptimizer due to bug with torch LambdaLR

* remove language_modeling script

* add end model sparsification log

Co-authored-by: Benjamin <ben@neuralmagic.com>

Co-authored-by: Mark Kurtz <mark@neuralmagic.com>
Co-authored-by: Rahul Tuli <rahul@neuralmagic.com>
@jeanniefinks jeanniefinks deleted the transformers_cleanup branch February 10, 2022 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants