Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Automatic model downloading - Part 1 #110

Merged
merged 37 commits into from
May 4, 2021

Conversation

motin
Copy link

@motin motin commented Apr 22, 2021

Fixes #5

Changes made to bergamot-translator can be reviewed here: mozilla/bergamot-translator#45

@motin
Copy link
Author

motin commented Apr 22, 2021

Currently done:

  • Host models locally during development
  • Download models, vocabularies and lexical shortlists automatically in the extension
  • Make sure that translation works when using the automatically downloaded model files
  • Don't re-download if the model files have already been downloaded once in the current browser session

@motin
Copy link
Author

motin commented Apr 22, 2021

Currently done:

  • Persist downloaded model files across browser restarts so that the user only needs to download a specific language pair once

Left to do:

  • Download gzipped model files so that there is less to download
  • Verify the hash of downloaded model files after download
  • Measure the time it takes to download model files
  • Add tests for model downloading
  • Show model downloading progress in translation infobar
  • Handle and prevent anticipated model download errors
  • Configure production-builds of the extension to use a remote base url for model downloads

@motin motin force-pushed the automatic-model-downloading branch from c98abde to f106abd Compare April 26, 2021 06:01
@motin
Copy link
Author

motin commented Apr 27, 2021

Done since last update:

  • Download gzipped model files so that there is less to download
  • Verify the hash of downloaded model files after download
  • Measure the time it takes to download model files
  • Add tests for model downloading

Screenshot showing that gzipped model files are downloaded:

Developer_Tools_—_Mocha_—_moz-extension___28da6aed-8ed8-0648-bc9b-47ae3bbd960d_test-runner_index_html_grep_getBergamotModelsForLanguagePair

Left to do:

  • Show model downloading progress in translation infobar
  • Handle and prevent anticipated model download errors
  • Publish available models, vocabularies and lexical shortlists somewhere extension users can access them
  • Configure extension to use the non-local models base url for production-build model downloads

@motin
Copy link
Author

motin commented Apr 27, 2021

The task Configure production-builds of the extension to use a remote base url for model downloads is currently blocked by the fact that GitHub, where the models reside now, is not configured to serve gzipped contents transparently.

EDIT: Filed as a separate issue

@motin
Copy link
Author

motin commented Apr 28, 2021

Done since last update:

  • Handle and prevent anticipated model download errors

Left to do:

  • Show model downloading progress in translation infobar

I filed a separate issue for Configure extension to use the non-local models base url for production-build model downloads so that we can review and merge the general automatic model download functionality in this PR without being blocked.

@motin
Copy link
Author

motin commented Apr 29, 2021

Done since last update:

  • Show model downloading progress in translation infobar
Download.progress.infobar.prototype.UI.mov

@motin
Copy link
Author

motin commented Apr 29, 2021

Done since last update:

  • Record model download time metric in post-translation telemetry

This PR is now ready for review.

@motin motin marked this pull request as ready for review April 29, 2021 10:49
@motin
Copy link
Author

motin commented May 3, 2021

This PR uses a Cache API polyfill due to https://bugzilla.mozilla.org/show_bug.cgi?id=1575625. It works well enough to have it as part of this PR during review, but I have created a separate issue for eventually removing this polyfill when/if it is no longer necessary: https://github.com/mozilla-extensions/bergamot-browser-extension/issues/116. Please review the current PR as is, knowing that a follow-up PR will address the polyfill issue.

@motin motin changed the title Automatic model downloading Automatic model downloading - Part 1 May 3, 2021
@andrenatal
Copy link
Contributor

r+ with the condition that the polyfill is removed in the short term

@motin motin merged commit 6564226 into mozilla-extensions:main May 4, 2021
@motin motin deleted the automatic-model-downloading branch May 4, 2021 06:34
andrenatal pushed a commit that referenced this pull request Apr 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants