-
Notifications
You must be signed in to change notification settings - Fork 49
Conversation
- Modified worker to construct TranslationModel with the appropriate model config for Quality Estimate feature when it is enabled by user - Supported QE feature only for in-page translation and not for Outbound translation
- For in-page translation, the flag is passed at it is - For outbound translation, we don't need QE. So passing it as false and restoring it after translate call is done.
- An api change has made it necessary to specify the size
0a7aefa
to
6436fc7
Compare
Fixes first 3 parts of #26. The last part is left (i.e. using CSS to show colors for bad scores) which will be taken up the next week. |
@@ -246,7 +288,7 @@ class TranslationHelper { | |||
// instantiate the Translation Service | |||
constructTranslationService() { | |||
if (!this.translationService) { | |||
let translationServiceConfig = {}; | |||
let translationServiceConfig = { cacheSize: 10 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note: a cache size of 10 won't do you much good. The cache is non-probing, it is basically just cache[hash(sentence) % cacheSize]
. The description of the parameter is a bit indirect about that. If you set it too low, you'll end up having too many different sentences hitting the same cache entry, constantly overwriting each other, and no cache benefit at all.
In my experience you'd get about 20% occupancy, so if you set it to 50 you'd be caching about 10 sentences. But from testing in TranslateLocally and my extension fork, I'd suggest starting with something around 1000 or higher, and see whether you can notice it in the memory usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tip Jelmer, please keep them coming. I think caching will be particularly helpful after I move the engine to the background script last week. I heard from the security folks that's fine, so I think that will be helpful.
Fixes:
#133
#132
#96