Live data from Hacker News

Web Translator API

developer.mozilla.org

51–60 of 71 posts

Re: Web Translator API

#51
post #3

While this might be useful, be mindful: - it's experimental - the "specification" is nowhere near a standards track: https://webmachinelearning.github.io/translation-api/ Of course it's already shipped in Chrome, and now Chrome pretends that its own Chrome-only API is somehow standard. Expect people on HN to blame other browsers for not shipping this.

This is the W3C standardization process. The W3C is not a prescriptive standardization body. It doesn't have any regulatory power giving it any teeth to go after vendors acting in bad faith. So the W3C process is descriptive and encourages a period of competitive divergence in implementations. It is only after the early adopters have hammered on the features and figured out which parts they like best that a Web API c…

> This is the W3C standardization process.

Let me quote the site for you

--- start quote ---

This specification was published by the Web Machine Learning Community Group. It is not a W3C Standard nor is it on the W3C Standards Track.

--- end quote ---

> So the W3C process is descriptive and encourages a period of competitive divergence in implementations.

That is exactly opposite of how the w3c standardization process works

> It is only after the early adopters have hammered on the features and figured out which parts they like best that a Web API can then start to get standardized.

Yes, and until then this work is not supposed to be enabled by default

Re: Web Translator API

#52
post #5

Earlier quoted context omitted.

Chrome embeds a small LLM (never stops being a funny thing) in the browser allowing them to do local translations. I assume every browser will do the same as on-device models start becoming more useful.

What's the easiest way to get this functionality outside of the browser, e.g. as a CLI tool? Last time I looked I wasn't able to find any easy to run models that supported more than a handful of languages.

Setting aside general-purpose LLMs, there exist a handful of models geared towards translation between hundred of language pairs: Meta's NLLB-200 [0] and M2M-100 [1] can be run using HuggingFace's transformers (plus numpy and sentencepieces), while Google's MADLAD-400 [2], in GGUF format [3], is also supported by llama.cpp.

You could also look into Argos Translate, or just use the same models as Firefox through kotki [4].

[0] https://huggingface.co/facebook/nllb-200-distilled-600M [1] https://huggingface.co/facebook/m2m100_418M [2] https://huggingface.co/google/madlad400-3b-mt [3] https://huggingface.co/models?other=base_model:quantized:goo... [4] https://github.com/kroketio/kotki

Re: Web Translator API

#53

This would be very useful. Basically, the 'translate this' button you see on Twitter or Instagram next to comments in foreign languages. This API would make it trivial for all developers to add that to their web apps.

Except that it is the user that will pay with his own llm tokens

how do you know this?

Re: Web Translator API

#54
post #35
post #11

https://developer.chrome.com/docs/ai/translator-api const translator = await Translator.create({ sourceLanguage: 'en', targetLanguage: 'fr', }); await translator.translate('Where is the next bus stop, please?');

So, this is Google Translate built running locally in Chrome? I wonder if it is a small/degraded model or limited languages? Otherwise, how is it not a simple way around the paid Google API?

Here is the information on how it works in Chrome. https://developer.chrome.com/docs/ai/translator-api

Re: Web Translator API

#55
post #35
post #11

https://developer.chrome.com/docs/ai/translator-api const translator = await Translator.create({ sourceLanguage: 'en', targetLanguage: 'fr', }); await translator.translate('Where is the next bus stop, please?');

So, this is Google Translate built running locally in Chrome? I wonder if it is a small/degraded model or limited languages? Otherwise, how is it not a simple way around the paid Google API?

Could it get more degraded?

Re: Web Translator API

#56
post #40

I was excited that Firefox finally exposed its local translations as API, but it's Chrome-only (still?). Will be nice for userscripts, for example to replace Twitter's translation button that hardly ever works

> I was excited that Firefox finally exposed its local translations as API, but it's Chrome-only (still?).

Bacause it was, is, and will be Chrome-only for the forseeable future: https://news.ycombinator.com/item?id=44375326

Re: Web Translator API

#58
post #38
post #35

Earlier quoted context omitted.

So, this is Google Translate built running locally in Chrome? I wonder if it is a small/degraded model or limited languages? Otherwise, how is it not a simple way around the paid Google API?

There's already ways to do translation locally in javascript with neural-nets running in WASM, this is just more convenient. https://huggingface.co/Xenova/nllb-200-distilled-600M

I tried to use this model in my package with translators kit https://github.com/translate-tools/core/pull/112

It runs very slow. Test case that run translation for text in 3k chars multiple times, takes about 30 seconds for google translator, but more than 10 minutes for `nllb-200-distilled-600M`.

Text sample: https://github.com/translate-tools/core/pull/112/files#diff-...

My tests runs on nodejs, it looks in browser it have no chance for real world use

Re: Web Translator API

#59

This would be very useful. Basically, the 'translate this' button you see on Twitter or Instagram next to comments in foreign languages. This API would make it trivial for all developers to add that to their web apps.

Except that it is the user that will pay with his own llm tokens

The user pays with some disk space, not API tokens

Re: Web Translator API

#60
post #48

Earlier quoted context omitted.

Does the API trigger the download automatically, or does it ask for user permission? (Answered my own question): Doesn't look like it requires the user's permission. Upon first use, the model will start downloading. The user has to wait for the download to finish before the API will work. That could take hours for 22gb. I presume this can't work on mobile? https://developer.mozilla.org/en-US/docs/Web/API/Translator_.…

The article indicates that it will only download the model over an unmetered connection, e.g., while the phone is connected to wifi.

Seems very backwards for markets where wired/wifi connections at home are nonexistant, 4g/5g is already unmetered and phones are the wifi you connect your devices to.
Post reply on HN