Closed jelmervdl closed 2 years ago
Initial estimates show that bergamot-translator compiled with emscripten 3.0.0 runs at about 3x the speed of 2.0.9 (when using embedded intgemm)
@jelmervdl Wow. This sounds awesome. Thanks for the initiative. I hope we get the same performance in browser environment as well. Irrespective of that, we should upgrade the toolchain.
Although the PR is in draft state, I am leaving few comments. I hope that is fine with you 👍🏾
I only later noticed that marian-dev also has a wasm example itself. I think I removed too much from its CMakeLists file to still work, so I'll bring back some of that as well.
I only later noticed that marian-dev also has a wasm example itself. I think I removed too much from its CMakeLists file to still work, so I'll bring back some of that as well.
I was about to write the same 👍🏾 If you want, I can also submit a PR to have similar changes in marian-dev if that is helpful.
I only later noticed that marian-dev also has a wasm example itself. I think I removed too much from its CMakeLists file to still work, so I'll bring back some of that as well.
I propose going forward abandoning of WASM marian-decoder to keep things simple. The original attempt to port marian to WASM for inference left us with marian-decoder in WASM (https://github.com/browsermt/marian-dev/pull/6). Bergamot's WASM bindings/port have filled in the role.
I propose going forward abandoning of WASM marian-decoder to keep things simple. The original attempt to port marian to WASM for inference left us with marian-decoder in WASM (https://github.com/browsermt/marian-dev/pull/6). Bergamot's WASM bindings/port have filled in the role.
I'm a fan. Simplifies things a lot.
I was about to write the same 👍🏾 If you want, I can also submit a PR to have similar changes in marian-dev if that is helpful.
If we're abandoning the wasm interface in marian-dev (the one that's not actively being used or tested right now…) then just a minimal change like this one should be sufficient. Maybe another one that removes the 'wasm' directory from marian-dev entirely.
If we're abandoning the wasm interface in marian-dev (the one that's not actively being used or tested right now…) then just a minimal change like this one should be sufficient. Maybe another one that removes the 'wasm' directory from marian-dev entirely.
Although maintaining marian-decode looks to be a minimal change. Very similar to here. Separating compile and link flags, which has to happen anyway. However, I am fine with throwing that away. So, a PR in marian-dev with the corresponding submodule update here should be sufficient. I haven't looked into the exact changes in marian but I can go through them right away 👍🏾
@abhi-agg do you have a specific timeline for this issue? I.e. asap for code freeze or something? I was working on something else today, but can switch if necessary.
@abhi-agg do you have a specific timeline for this issue? I.e. asap for code freeze or something? I was working on something else today, but can switch if necessary.
Yep. We want to freeze by eod today. So upgrading emscripten version if the topmost priority for me. If you don't have bandwidth today then I am more than happy to take it up.
@abhi-agg Feel free to go ahead and take over this pull request. I feel that's probably the faster way of getting this done today.
remove the need for the patching of the bergamot-translation-worker.js file, this can now easily be done through supported apis
Just a heads up. I will not be including this change. I also don't know right now how to have the wasm binary itself initialise the function pointers to the fallback implementations, and then have the ability to override them during initialisation.
Replaced by #414
Necessary to work with newer versions of emscripten that are more picky about which option goes to the compiler, and which to the linker. Also took the opportunity to remove the need for the patching of the bergamot-translation-worker.js file, this can now easily be done through supported apis. Furthermore, I tried to downsize the generated javascript and wasm code a bit.
Initial estimates show that bergamot-translator compiled with emscripten 3.0.0 runs at about 3x the speed of 2.0.9 (when using embedded intgemm). Speed-up when using mozIntGemm is less dramatic, I expect:
Filesizes are also a bit smaller: