sarahciston commited on
Commit
95ce7e8
·
verified ·
1 Parent(s): 8993dbb

reformat parameter, change prompt, parse result

Browse files
Files changed (1) hide show
  1. index.js +3 -6
index.js CHANGED
@@ -5,16 +5,13 @@ 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)
 
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.", {top_k: 7});
 
 
 
9
 
10
  var outputList = []
11
 
12
  out.forEach(o => {
13
+ console.log(o) // yields { score, sequence, token, token_str } for each result
14
+ outputList.push(o.sequence) // put only the full sequence in a list
15
  })
16
 
17
  console.log(outputList)