Upgrade to transformers release V4.23.1#62
Upgrade to transformers release V4.23.1#62bfineran merged 3 commits intoupstream-v4.23-release-copyfrom
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
There was a problem hiding this comment.
Yeah I'm almost positive we could hot patch this stuff in instead of having repo forks.
Something like
import transformers
from transformers.models.bert.modeling_bert import BertSelfAttention as _BertSelfAttention
class PatchedBertSelfAttention(_BertSelfAttention):
def __init__(self, *args, **kwargs):
self.attention_scores_matmul = ...
def forward(self):
...
transformers.models.bert.modeling_bert.BertSelfAttention = PatchedBertSelfAttention
There was a problem hiding this comment.
Yeah I think now that most of the implementation has been moved on the sparseml side, there's definitely potential to explore here. One thing to keep in mind is that every time we've upgraded the HF repo had changes that broke our integration, so the hot patch would need to be easy to debug and amend. But in general I'm all for this
There was a problem hiding this comment.
What was the reasoning for adding this class? Was this functionality not here before?
There was a problem hiding this comment.
This is a file I noted for myself to remove before pushing and did not follow through
9282e09 to
6133554
Compare
Disable FP16 on QAT start (#12) * Override LRScheduler when using LRModifiers * Disable FP16 on QAT start * keep wrapped scaler object for training after disabling Using QATMatMul in DistilBERT model class (#41) Removed double quantization of output of context layer. (#45) Fix DataParallel validation forward signatures (#47) * Fix: DataParallel validation forward signatures * Update: generalize forward_fn selection Best model after epoch (#46) fix sclaer check for non fp16 mode in trainer (#38) Mobilebert QAT (#55) * Remove duplicate quantization of vocabulary. enable a QATWrapper for non-parameterized matmuls in BERT self attention (#9)
6133554 to
7548869
Compare
|
Committed the sin of editing history and paired down our fork changes to 3 commits |
| f"files downloaded from {val}. Found {framework_file_names}. Check " | ||
| "if the given stub is for a transformers repo model" | ||
| ) | ||
| framework_dir_path = Path(framework_file_paths[0]).parent.absolute() |
There was a problem hiding this comment.
Will all the framework_file_paths have the same parent? Is that why we can just use the 1st one?
| return tuple( | ||
| [_download_dataclass_zoo_stub_files(output) for output in outputs] | ||
| ) |
There was a problem hiding this comment.
not sure if i like this better but thought i'd add
| return tuple( | |
| [_download_dataclass_zoo_stub_files(output) for output in outputs] | |
| ) | |
| return tuple(map(_download_dataclass_zoo_stub_files, outputs)) |
| self.wrap_qat = True | ||
| self.qat_wrapper_kwargs = { | ||
| "num_inputs": 2, | ||
| "num_outputs": 0, |
There was a problem hiding this comment.
Is this supposed to be here? Don't see it in others
|
@corey-nm good comments, going to keep changes to existing flows out of scope for this PR as it's mean to be a rebase only, let's dig in together offline |
* Add recipe_name to default file names * Upgrade to transformers release V4.30.2 (#62) * Update trainer and model flows to accommodate sparseml Disable FP16 on QAT start (#12) * Override LRScheduler when using LRModifiers * Disable FP16 on QAT start * keep wrapped scaler object for training after disabling Using QATMatMul in DistilBERT model class (#41) Removed double quantization of output of context layer. (#45) Fix DataParallel validation forward signatures (#47) * Fix: DataParallel validation forward signatures * Update: generalize forward_fn selection Best model after epoch (#46) fix sclaer check for non fp16 mode in trainer (#38) Mobilebert QAT (#55) * Remove duplicate quantization of vocabulary. enable a QATWrapper for non-parameterized matmuls in BERT self attention (#9) * Utils and auxillary changes update Zoo stub loading for SparseZoo 1.1 refactor (#54) add flag to signal NM integration is active (#32) Add recipe_name to file names * Fix errors introduced in manual cherry-pick upgrade Co-authored-by: Benjamin Fineran <bfineran@users.noreply.github.com> * update build versions for NM fork pypi push (#74) * fix nightly package name (#75) * add make build command (#76) * add GHA workflow files to build nightly and release packages (#77) * add GHA workflow files to build nightly and release packages * fix name --------- Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local> * bump up version to 1.6.0 (#79) Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local> --------- Co-authored-by: Konstantin <konstantin@neuralmagic.com> Co-authored-by: Konstantin Gulin <66528950+KSGulin@users.noreply.github.com> Co-authored-by: dhuangnm <74931910+dhuangnm@users.noreply.github.com> Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local>
* Add recipe_name to default file names * Upgrade to transformers release V4.30.2 (#62) * Update trainer and model flows to accommodate sparseml Disable FP16 on QAT start (#12) * Override LRScheduler when using LRModifiers * Disable FP16 on QAT start * keep wrapped scaler object for training after disabling Using QATMatMul in DistilBERT model class (#41) Removed double quantization of output of context layer. (#45) Fix DataParallel validation forward signatures (#47) * Fix: DataParallel validation forward signatures * Update: generalize forward_fn selection Best model after epoch (#46) fix sclaer check for non fp16 mode in trainer (#38) Mobilebert QAT (#55) * Remove duplicate quantization of vocabulary. enable a QATWrapper for non-parameterized matmuls in BERT self attention (#9) * Utils and auxillary changes update Zoo stub loading for SparseZoo 1.1 refactor (#54) add flag to signal NM integration is active (#32) Add recipe_name to file names * Fix errors introduced in manual cherry-pick upgrade Co-authored-by: Benjamin Fineran <bfineran@users.noreply.github.com> * update build versions for NM fork pypi push (#74) * fix nightly package name (#75) * add make build command (#76) * add GHA workflow files to build nightly and release packages (#77) * add GHA workflow files to build nightly and release packages * fix name --------- Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local> * bump up version to 1.6.0 (#79) Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local> --------- Co-authored-by: Konstantin <konstantin@neuralmagic.com> Co-authored-by: Konstantin Gulin <66528950+KSGulin@users.noreply.github.com> Co-authored-by: dhuangnm <74931910+dhuangnm@users.noreply.github.com> Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local>
* Add recipe_name to default file names * Upgrade to transformers release V4.30.2 (#62) * Update trainer and model flows to accommodate sparseml Disable FP16 on QAT start (#12) * Override LRScheduler when using LRModifiers * Disable FP16 on QAT start * keep wrapped scaler object for training after disabling Using QATMatMul in DistilBERT model class (#41) Removed double quantization of output of context layer. (#45) Fix DataParallel validation forward signatures (#47) * Fix: DataParallel validation forward signatures * Update: generalize forward_fn selection Best model after epoch (#46) fix sclaer check for non fp16 mode in trainer (#38) Mobilebert QAT (#55) * Remove duplicate quantization of vocabulary. enable a QATWrapper for non-parameterized matmuls in BERT self attention (#9) * Utils and auxillary changes update Zoo stub loading for SparseZoo 1.1 refactor (#54) add flag to signal NM integration is active (#32) Add recipe_name to file names * Fix errors introduced in manual cherry-pick upgrade Co-authored-by: Benjamin Fineran <bfineran@users.noreply.github.com> * update build versions for NM fork pypi push (#74) * fix nightly package name (#75) * add make build command (#76) * add GHA workflow files to build nightly and release packages (#77) * add GHA workflow files to build nightly and release packages * fix name --------- Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local> * bump up version to 1.6.0 (#79) Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local> --------- Co-authored-by: Konstantin <konstantin@neuralmagic.com> Co-authored-by: Konstantin Gulin <66528950+KSGulin@users.noreply.github.com> Co-authored-by: dhuangnm <74931910+dhuangnm@users.noreply.github.com> Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local>
* Add recipe_name to default file names * Upgrade to transformers release V4.30.2 (#62) * Update trainer and model flows to accommodate sparseml Disable FP16 on QAT start (#12) * Override LRScheduler when using LRModifiers * Disable FP16 on QAT start * keep wrapped scaler object for training after disabling Using QATMatMul in DistilBERT model class (#41) Removed double quantization of output of context layer. (#45) Fix DataParallel validation forward signatures (#47) * Fix: DataParallel validation forward signatures * Update: generalize forward_fn selection Best model after epoch (#46) fix sclaer check for non fp16 mode in trainer (#38) Mobilebert QAT (#55) * Remove duplicate quantization of vocabulary. enable a QATWrapper for non-parameterized matmuls in BERT self attention (#9) * Utils and auxillary changes update Zoo stub loading for SparseZoo 1.1 refactor (#54) add flag to signal NM integration is active (#32) Add recipe_name to file names * Fix errors introduced in manual cherry-pick upgrade Co-authored-by: Benjamin Fineran <bfineran@users.noreply.github.com> * update build versions for NM fork pypi push (#74) * fix nightly package name (#75) * add make build command (#76) * add GHA workflow files to build nightly and release packages (#77) * add GHA workflow files to build nightly and release packages * fix name --------- Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local> * bump up version to 1.6.0 (#79) Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local> --------- Co-authored-by: Konstantin <konstantin@neuralmagic.com> Co-authored-by: Konstantin Gulin <66528950+KSGulin@users.noreply.github.com> Co-authored-by: dhuangnm <74931910+dhuangnm@users.noreply.github.com> Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local>
(previous commits) * Add recipe_name to default file names * Upgrade to transformers release V4.30.2 (#62) * Update trainer and model flows to accommodate sparseml Disable FP16 on QAT start (#12) * Override LRScheduler when using LRModifiers * Disable FP16 on QAT start * keep wrapped scaler object for training after disabling Using QATMatMul in DistilBERT model class (#41) Removed double quantization of output of context layer. (#45) Fix DataParallel validation forward signatures (#47) * Fix: DataParallel validation forward signatures * Update: generalize forward_fn selection Best model after epoch (#46) fix sclaer check for non fp16 mode in trainer (#38) Mobilebert QAT (#55) * Remove duplicate quantization of vocabulary. enable a QATWrapper for non-parameterized matmuls in BERT self attention (#9) * Utils and auxillary changes update Zoo stub loading for SparseZoo 1.1 refactor (#54) add flag to signal NM integration is active (#32) Add recipe_name to file names * Fix errors introduced in manual cherry-pick upgrade Co-authored-by: Benjamin Fineran <bfineran@users.noreply.github.com> * update build versions for NM fork pypi push (#74) * fix nightly package name (#75) * add make build command (#76) * add GHA workflow files to build nightly and release packages (#77) * add GHA workflow files to build nightly and release packages * fix name --------- Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local> * bump up version to 1.6.0 (#79) Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local> --------- Co-authored-by: Konstantin <konstantin@neuralmagic.com> Co-authored-by: Konstantin Gulin <66528950+KSGulin@users.noreply.github.com> Co-authored-by: dhuangnm <74931910+dhuangnm@users.noreply.github.com> Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local> minor improvements for build workflow files (#83) Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local> fix minor issue (#84) Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local> OPT with quantizable MatMuls (#85) fix a minor issue for release build (#86) Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local> update version in version.py Testmo (#91) * improve GHA workflow files to build nightly and release, and report status to testmo * clean up * report exit code * Assign value to exit_code --------- Co-authored-by: dhuang <dhuang@MacBook-Pro-2.local> Update trainer.py - fix DistributedSampler import (#93) DistributedSampler is used but not imported in `trainer.py` Research/llama/bmm quantization (#94) * Quantize attention matmuls * Quantize attention matmuls bump base transformers version
Note: currently targeted at copy of upstream release branch for easy comparison. Diff is intended to land on our main branch.
This PR integrates our existing transformers integration with the updated v4.23.1 upstream. See here for HuggingFace release notes.
Meant to land concurrently with neuralmagic/sparseml#1081
Testing Plan