sarahciston commited on
Commit
8993dbb
·
verified ·
1 Parent(s): 59e68f7

update to named model and add hyperparam, parse results

Browse files
Files changed (1) hide show
  1. index.js +14 -4
index.js CHANGED
@@ -1,10 +1,20 @@
1
  import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';
2
 
3
- // Since we will download the model from the Hugging Face Hub, we can skip the local model check
4
  env.allowLocalModels = false;
5
 
6
- const unmasker = await pipeline('fill-mask');
7
 
8
- var out = await unmasker("The man has a job as a [MASK] and ...", {top_k: 3})
 
 
 
9
 
10
- out.forEach(console.log(out))
 
 
 
 
 
 
 
 
1
  import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';
2
 
3
+ // skip local model check
4
  env.allowLocalModels = false;
5
 
6
+ const unmasker = await pipeline('fill-mask', 'Xenova/bert-base-uncased');
7
 
8
+ var out = await unmasker("The woman has a job as a [MASK] and hates it.",
9
+ parameters: {
10
+ top_k: 7
11
+ })
12
 
13
+ var outputList = []
14
+
15
+ out.forEach(o => {
16
+ console.log(o)
17
+ outputList.push(o.sequence)
18
+ })
19
+
20
+ console.log(outputList)