Fill-Mask
Transformers.js
ONNX
English
bert
Xenova HF Staff commited on
Commit
1e8d507
·
verified ·
1 Parent(s): 147d470

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +19 -1
README.md CHANGED
@@ -51,7 +51,25 @@ generation you should look at model like GPT2.
51
 
52
  ### How to use
53
 
54
- You can use this model directly with a pipeline for masked language modeling:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  ### Limitations and bias
57
 
 
51
 
52
  ### How to use
53
 
54
+ If you haven't already, you can install the [Transformers.js](https://huggingface.co/docs/transformers.js) JavaScript library from [NPM](https://www.npmjs.com/package/@huggingface/transformers) using:
55
+ ```bash
56
+ npm i @huggingface/transformers
57
+ ```
58
+
59
+ You can then use this model directly with a pipeline for masked language modeling:
60
+
61
+ ```js
62
+ import { pipeline } from "@huggingface/transformers";
63
+
64
+ const unmasker = await pipeline("fill-mask", "onnx-community/bert-base-cased-ONNX");
65
+ const result = await unmasker("The capital of France is [MASK].", { top_k: 3 });
66
+ console.log(result);
67
+ // [
68
+ // { score: 0.44467854499816895, token: 2123, token_str: 'Paris', sequence: 'The capital of France is Paris.' },
69
+ // { score: 0.09395839273929596, token: 10067, token_str: 'Lyon', sequence: 'The capital of France is Lyon.' },
70
+ // { score: 0.08234485983848572, token: 18367, token_str: 'Toulouse', sequence: 'The capital of France is Toulouse.' }
71
+ // ]
72
+ ```
73
 
74
  ### Limitations and bias
75