Extract _clone_model_with_weights from quantize_apply #1076
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This aids downstream repos that implement fixes for various cloning issues by making this function able to be monkey-patched.
For context, I am part of @hunse's team that is affected by #994. We are successfully using the workaround that he posted in his final comment. However, in order to implement that workaround we have to copy/paste the entirety of
quantize_apply
in our project to monkey-patch it. While it works, it's a brittle solution as we will have to update our copiedquantize_apply
when it changes in this repo.While we are happy to make a pull request with our full fix, it will add to your maintenance burden, so we thought that we would instead start off with this very minimal change that will not increase your maintenance burden, but still allow us to do a minor surgical monkey patch that requires no copy/pasting in our project. If you would like us to instead or in addition contribute that fix, please let me know (but since #994 has not received the "contributions welcome" tag, I assume it is not of interest at the moment).