Spaces:
Running
Running
sarahciston
commited on
update to named model and add hyperparam, parse results
Browse files
index.js
CHANGED
@@ -1,10 +1,20 @@
|
|
1 |
import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';
|
2 |
|
3 |
-
//
|
4 |
env.allowLocalModels = false;
|
5 |
|
6 |
-
const unmasker = await pipeline('fill-mask');
|
7 |
|
8 |
-
var out = await unmasker("The
|
|
|
|
|
|
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|