Open mram0509 opened 5 months ago
You can use model.config.id2label
or model.config.label2id
. Also, note that you need to update your model id to: Xenova/distilbert-base-uncased-finetuned-sst-2-english
which is a version of the model that contains transformers.js-compatible ONNX weights.
Question
Does transformers.js have a function to get the label after getting the logits? How to get the labels from the inference output?
let tokenizer = await AutoTokenizer.from_pretrained('distilbert-base-uncased-finetuned-sst-2-english'); let model = await AutoModel.from_pretrained('distilbert-base-uncased-finetuned-sst-2-english');
let inputs = await tokenizer('I love transformers!'); let { logits } = await model(inputs);