Patch int8PrepareBias to handle nullptr #82
Merged
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.
Description
This fixes base student models not working with the wasm version of bergamot-translator.
int8PrepareBias
is being called from bothPrepareBiasForBNodeOp
andPrepareFakeBiasForBNodeOp
. These are two different intgemm calls (callbacks differ) but they map to the same WASM surrogate function.I'm using the fact that one of those calls has
bias_input = nullptr
as a way to differentiate between the two and call the correct intgemm function + callback pair in its implementation.This will also need to be fixed in Mozilla's tree, @abhi-agg.
While on the topic of Mozilla's implementation, should the bounds check in Mozilla's implementation also pick up nullptrs?
See issue #81 for a more detailed explanation.
List of changes:
int8PrepareBias
fallback to callintgemm::Int8Shift::PrepareBias
with the correct callback.How to test
See #81 how I tested this. To test whether the fix itself works, easiest way would be:
entries.reverse()
as mentioned here: TranslateLocally _base_ models do not work jelmervdl/translatelocally-web-ext#14.Checklist