This multilingual model can perform natural language inference (NLI) on 100+ languages and is therefore also suitable for multilingual zero-shot classification.
A SENTENCE
, CANDIDATE_LABELS
and HYPOTHESIS_TEMPLATE
.
Probability scores for each label.
Set the SENTENCE
, CANDIDATE_LABELS
and HYPOTHESIS_TEMPLATE
as an argument.
$ python3 multilingual-minilmv2.py -s "今日、新しいiPhoneが発売されました" -c "スマートフォン, エンタメ, スポーツ" -t "This example is {}."
...
+ idx=0
category=0[スマートフォン ]
prob=0.8609882593154907
+ idx=1
category=1[エンタメ ]
prob=0.1195221021771431
+ idx=2
category=2[スポーツ ]
prob=0.019489625468850136
You can select a model from minilm_l6 | minilm_l12
by adding --arch (default: minilm_l12).
PyTorch
ONNX opset = 14