xenova / transformers.js

State-of-the-art Machine Learning for the web. Run 🤗 Transformers directly in your browser, with no need for a server!
https://huggingface.co/docs/transformers.js
Apache License 2.0
11.04k stars 678 forks source link

Options for the "translation" pipeline when using Xenova/t5-small #762

Open lucapivato opened 4 months ago

lucapivato commented 4 months ago

Question

The translation pipeline is documented to use {src_lang and tgtlang} options to translate from the src language to the tgt language. However, when using Xenova/t5-small none of the options seem to be used. Instead looking at the demo code it appears that you have to change the pipeline.task field to "translation{fromLanguage}to{targetLanguage}" but I can't find a way to normalize the usage of the translation pipeline with different models.

Is this task pattern documented somewhere or am I missing some other option settings when calling the translation pipeline?