Views
No views yet
1>>> from transformers import pipeline
2>>> unmasker = pipeline('fill-mask', model='distilroberta-base')
3>>> unmasker("The man worked as a <mask>.")
4[{'score': 0.1237526461482048,
5 'sequence': 'The man worked as a waiter.',
6 'token': 38233,
7 'token_str': ' waiter'},
8 {'score': 0.08968018740415573,
9 'sequence': 'The man worked as a waitress.',
10 'token': 35698,
11 'token_str': ' waitress'},
12 {'score': 0.08387645334005356,
13 'sequence': 'The man worked as a bartender.',
14 'token': 33080,
15 'token_str': ' bartender'},
16 {'score': 0.061059024184942245,
17 'sequence': 'The man worked as a mechanic.',
18 'token': 25682,
19 'token_str': ' mechanic'},
20 {'score': 0.03804653510451317,
21 'sequence': 'The man worked as a courier.',
22 'token': 37171,
23 'token_str': ' courier'}]
24
25>>> unmasker("The woman worked as a <mask>.")
26[{'score': 0.23149248957633972,
27 'sequence': 'The woman worked as a waitress.',
28 'token': 35698,
29 'token_str': ' waitress'},
30 {'score': 0.07563332468271255,
31 'sequence': 'The woman worked as a waiter.',
32 'token': 38233,
33 'token_str': ' waiter'},
34 {'score': 0.06983394920825958,
35 'sequence': 'The woman worked as a bartender.',
36 'token': 33080,
37 'token_str': ' bartender'},
38 {'score': 0.05411609262228012,
39 'sequence': 'The woman worked as a nurse.',
40 'token': 9008,
41 'token_str': ' nurse'},
42 {'score': 0.04995106905698776,
43 'sequence': 'The woman worked as a maid.',
44 'token': 29754,
45 'token_str': ' maid'}]| Task | MNLI | QQP | QNLI | SST-2 | CoLA | STS-B | MRPC | RTE |
|---|---|---|---|---|---|---|---|---|
| 84.0 | 89.4 | 90.8 | 92.5 | 59.3 | 88.3 | 86.6 | 67.9 |
1@article{Sanh2019DistilBERTAD,
2 title={DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter},
3 author={Victor Sanh and Lysandre Debut and Julien Chaumond and Thomas Wolf},
4 journal={ArXiv},
5 year={2019},
6 volume={abs/1910.01108}
7}1>>> from transformers import pipeline
2>>> unmasker = pipeline('fill-mask', model='distilroberta-base')
3>>> unmasker("Hello I'm a <mask> model.")
4[{'score': 0.04673689603805542,
5 'sequence': "Hello I'm a business model.",
6 'token': 265,
7 'token_str': ' business'},
8 {'score': 0.03846118599176407,
9 'sequence': "Hello I'm a freelance model.",
10 'token': 18150,
11 'token_str': ' freelance'},
12 {'score': 0.03308931365609169,
13 'sequence': "Hello I'm a fashion model.",
14 'token': 2734,
15 'token_str': ' fashion'},
16 {'score': 0.03018997237086296,
17 'sequence': "Hello I'm a role model.",
18 'token': 774,
19 'token_str': ' role'},
20 {'score': 0.02111748233437538,
21 'sequence': "Hello I'm a Playboy model.",
22 'token': 24526,
23 'token_str': ' Playboy'}]