Farm: DistilBert for En, De and Fr

Created on 26 Jan 2020  路  4Comments  路  Source: deepset-ai/FARM

Question
I see Farm supports german DistilBERT. Is it the case for English and French too ? If yes, how do I use the load those models ?

model question

All 4 comments

Sure, you can easily convert models between FARM <-> huggingface's transformers. You can load any of the models from here by just using the model name in a load() method:

LanguageModel.load("distilbert-base-uncased")
Tokenizer.load("distilbert-base-uncased")

In our example scripts, this is as simple as changing this variable to the model name you want:
https://github.com/deepset-ai/FARM/blob/d606df13f7d3d0536de9e5e5de843b2d9422f223/examples/doc_classification.py#L32

This should allow you to use DistilBERT for EN and DE. However, I haven't seen a DistilBERT for french yet.


BTW, there's also the option to use an already trained downstream model directly for inference:

inf = Inferencer.load("distilbert-base-uncased-distilled-squad", task_type="question_answering")
# run predictions
QA_input = [{"qas": ["Why is model conversion important?"],
                 "context": "Model conversion lets people easily switch between frameworks."}]
result = inf.inference_from_dicts(dicts=QA_input)

Thanks works. Would multilingual distilBERT work for French ?

Definitely worth a try! If that doesn't give satisfying results, you could also consider training a french distilBERT yourself (see here)

Awesome. Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zolekode picture zolekode  路  4Comments

AndriyMulyar picture AndriyMulyar  路  7Comments

Chipandcharge picture Chipandcharge  路  5Comments

malteos picture malteos  路  5Comments

ckobus picture ckobus  路  3Comments