p5tutorial2 / index.js
sarahciston's picture
update to named model and add hyperparam, parse results
8993dbb verified
raw
history blame
525 Bytes
import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';
// skip local model check
env.allowLocalModels = false;
const unmasker = await pipeline('fill-mask', 'Xenova/bert-base-uncased');
var out = await unmasker("The woman has a job as a [MASK] and hates it.",
parameters: {
top_k: 7
})
var outputList = []
out.forEach(o => {
console.log(o)
outputList.push(o.sequence)
})
console.log(outputList)