I’m interested in using the @tensorflow-models/qna model for a project, but I need it to work with Spanish text. Does anyone know if this model can handle Spanish inputs directly? I’m calling the model with a question and a context in Spanish but the model doesn’t answer, and I’m wondering if I’m doing something wrong. If not, is there a recommended way to train it on a Spanish language dataset for question answering? Any advice or resources would be greatly appreciated! Thanks in advance for your help.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Heya,
The
@tensorflow-models/qna
model, which is based on the BERT architecture, is primarily trained on English text and may not perform well with Spanish inputs directly. This model is designed for question answering tasks in English and, as you’ve noticed, it doesn’t handle Spanish inputs effectively out of the box.bert-base-spanish
), which can be used for various NLP tasks, including question answering.mBERT
(multilingual BERT) orXLM-RoBERTa
. These models are trained on multiple languages, including Spanish, and can handle inputs in various languages better than a model trained exclusively on English data.Example Code for Using a Multilingual Model
Here’s a quick example of how you might use a multilingual model like
XLM-RoBERTa
for question answering: