Spaces:
Running
Running
sarahciston
commited on
Commit
•
de353b9
1
Parent(s):
95d623b
update vars for model output run
Browse files
sketch.js
CHANGED
@@ -11,7 +11,7 @@ var PREPROMPT = `Please continue the story, filling any [MASK] with your own wor
|
|
11 |
// let PREPROMPT = `Please complete the phrase and fill in any [MASK]: `
|
12 |
var PROMPT_INPUT = `The [BLANK] has a job as a [MASK] but...` // a field for writing or changing a text value
|
13 |
var promptField // an html element to hold the prompt
|
14 |
-
var outText //
|
15 |
var blanksArray = [] // an empty list to store all the variables we enter to modify the prompt
|
16 |
// e.g. ["woman", "man", "non-binary person"]
|
17 |
|
@@ -53,7 +53,7 @@ async function textGenTask(pre, prompt, blanks){
|
|
53 |
// const pipe = await pipeline('text-generation', MODEL) //different task type, also for text generation
|
54 |
const pipe = await pipeline('text2text-generation', MODEL)
|
55 |
|
56 |
-
var hyperparameters = { max_new_tokens: 200, top_k:
|
57 |
// setting hyperparameters
|
58 |
// max_new_tokens: 256, top_k: 50, temperature: 0.7, do_sample: true, no_repeat_ngram_size: 2, num_return_sequences: 2 (must be 1?)
|
59 |
|
@@ -201,16 +201,16 @@ new p5(function (p5){
|
|
201 |
// // make output placeholders
|
202 |
// text-only output
|
203 |
p5.createElement('h3', 'Text output').parent(outputDiv)
|
204 |
-
|
205 |
|
206 |
// placeholder DIV for images and captions
|
207 |
p5.createElement('h3', 'Text-to-image output').parent(outputDiv)
|
208 |
-
|
209 |
// img1 = p5.createImg('URL')
|
210 |
|
211 |
// print info about model, prompt, and hyperparams
|
212 |
p5.createElement('h3', 'Prompting info').parent(outputDiv)
|
213 |
-
|
214 |
}
|
215 |
|
216 |
async function displayOutput(){
|
@@ -236,7 +236,7 @@ new p5(function (p5){
|
|
236 |
console.log(outs)
|
237 |
|
238 |
// insert the model outputs into the paragraph
|
239 |
-
await outText.html(outs, false) // false
|
240 |
}
|
241 |
|
242 |
p5.draw = function(){
|
|
|
11 |
// let PREPROMPT = `Please complete the phrase and fill in any [MASK]: `
|
12 |
var PROMPT_INPUT = `The [BLANK] has a job as a [MASK] but...` // a field for writing or changing a text value
|
13 |
var promptField // an html element to hold the prompt
|
14 |
+
var outText, outPics, outInfo // html elements to hold the results
|
15 |
var blanksArray = [] // an empty list to store all the variables we enter to modify the prompt
|
16 |
// e.g. ["woman", "man", "non-binary person"]
|
17 |
|
|
|
53 |
// const pipe = await pipeline('text-generation', MODEL) //different task type, also for text generation
|
54 |
const pipe = await pipeline('text2text-generation', MODEL)
|
55 |
|
56 |
+
var hyperparameters = { max_new_tokens: 200, top_k: 20, repetition_penalty: 1.5 }
|
57 |
// setting hyperparameters
|
58 |
// max_new_tokens: 256, top_k: 50, temperature: 0.7, do_sample: true, no_repeat_ngram_size: 2, num_return_sequences: 2 (must be 1?)
|
59 |
|
|
|
201 |
// // make output placeholders
|
202 |
// text-only output
|
203 |
p5.createElement('h3', 'Text output').parent(outputDiv)
|
204 |
+
outText = p5.createP('').id('outText').parent(outputDiv)
|
205 |
|
206 |
// placeholder DIV for images and captions
|
207 |
p5.createElement('h3', 'Text-to-image output').parent(outputDiv)
|
208 |
+
outPics = p5.createDiv().id('outPics').parent(outputDiv)
|
209 |
// img1 = p5.createImg('URL')
|
210 |
|
211 |
// print info about model, prompt, and hyperparams
|
212 |
p5.createElement('h3', 'Prompting info').parent(outputDiv)
|
213 |
+
outInfo = p5.createP('').id('outInfo').parent(outputDiv)
|
214 |
}
|
215 |
|
216 |
async function displayOutput(){
|
|
|
236 |
console.log(outs)
|
237 |
|
238 |
// insert the model outputs into the paragraph
|
239 |
+
await outText.html(outs, false) // false valuereplaces text, true appends text
|
240 |
}
|
241 |
|
242 |
p5.draw = function(){
|