Views
No views yet
1import torch
2from transformers import pipeline
3from pprint import pprint
4
5pipe = pipeline(
6 "fill-mask",
7 model="2nji/ModernBERT-base-mask-finetuned-shakespeare",
8 torch_dtype=torch.bfloat16,
9)
10
11input_text = "Thou [MASK] on [MASK]."
12results = pipe(input_text)
13pprint(results)
14
15
16<!-- [[{'score': 0.71875,
17 'sequence': '[CLS]Thou art on[MASK].[SEP]',
18 'token': 1445,
19 'token_str': ' art'},
20 {'score': 0.1416015625,
21 'sequence': '[CLS]Thou hast on[MASK].[SEP]',
22 'token': 16579,
23 'token_str': ' hast'},
24 {'score': 0.014892578125,
25 'sequence': '[CLS]Thou be on[MASK].[SEP]',
26 'token': 320,
27 'token_str': ' be'},
28 {'score': 0.00701904296875,
29 'sequence': '[CLS]Thou Art on[MASK].[SEP]',
30 'token': 3975,
31 'token_str': ' Art'},
32 {'score': 0.0042724609375,
33 'sequence': '[CLS]Thou call on[MASK].[SEP]',
34 'token': 1067,
35 'token_str': ' call'}],
36 [{'score': 0.1767578125,
37 'sequence': "[CLS]Thou[MASK] on't.[SEP]",
38 'token': 626,
39 'token_str': "'t"},
40 {'score': 0.146484375,
41 'sequence': '[CLS]Thou[MASK] on me.[SEP]',
42 'token': 479,
43 'token_str': ' me'},
44 {'score': 0.0419921875,
45 'sequence': '[CLS]Thou[MASK] on it.[SEP]',
46 'token': 352,
47 'token_str': ' it'},
48 {'score': 0.0419921875,
49 'sequence': '[CLS]Thou[MASK] on earth.[SEP]',
50 'token': 6149,
51 'token_str': ' earth'},
52 {'score': 0.03955078125,
53 'sequence': '[CLS]Thou[MASK] on him.[SEP]',
54 'token': 779,
55 'token_str': ' him'}]] -->
56| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| No log | 1.0 | 197 | 2.3128 |
| No log | 2.0 | 394 | 2.2150 |
| 2.3002 | 3.0 | 591 | 2.2395 |