dhuynh95 commited on
Commit
b9ce19a
1 Parent(s): f91fb64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -324,15 +324,15 @@ def complete(sample, k, current_example):
324
  output = prefix
325
  for token in client.text_generation(prefix, do_sample=False, max_new_tokens=512, stream=True):
326
  if token == "<|endoftext|>":
327
- bleu_score = {"BLEU": bleu.compute(predictions=[output],
328
  references=[current_example])["bleu"]}
329
  return diff(output, current_example), gr.Label.update(value=bleu_score), current_example
330
  output += token
331
- bleu_score = {"BLEU": bleu.compute(predictions=[output],
332
  references=[current_example])["bleu"]}
333
  yield diff(output, current_example), gr.Label.update(value=bleu_score), current_example
334
  # yield output, diff_texts(output, sample), gr.Label.update(value=bleu_score)
335
- bleu_score = {"BLEU": bleu.compute(predictions=[output],
336
  references=[current_example])["bleu"]}
337
  # return output, diff_texts(output, sample), gr.Label.update(value=bleu_score)
338
  return diff(output, current_example), gr.Label.update(value=bleu_score), current_example
@@ -386,7 +386,7 @@ with gr.Blocks(theme=style) as demo:
386
  )
387
 
388
  with gr.Column():
389
- label = gr.Label(value={"Memorization score (BLEU)": 0},label="BLEU")
390
  with gr.Accordion("What is BLEU?", open=False): # NOTE - THIS WEIRDLY BREAKS EVERYTHING IF I UNCOMMENT
391
  gr.Markdown("""[BLEU](https://huggingface.co/spaces/evaluate-metric/bleu) score is a metric that can be used to measure the similarity of two sentences.
392
  Here, the higher the BLEU score, the more likely the model will learn the example by heart.
 
324
  output = prefix
325
  for token in client.text_generation(prefix, do_sample=False, max_new_tokens=512, stream=True):
326
  if token == "<|endoftext|>":
327
+ bleu_score = {"Memorization score (BLEU)": bleu.compute(predictions=[output],
328
  references=[current_example])["bleu"]}
329
  return diff(output, current_example), gr.Label.update(value=bleu_score), current_example
330
  output += token
331
+ bleu_score = {"Memorization score (BLEU)": bleu.compute(predictions=[output],
332
  references=[current_example])["bleu"]}
333
  yield diff(output, current_example), gr.Label.update(value=bleu_score), current_example
334
  # yield output, diff_texts(output, sample), gr.Label.update(value=bleu_score)
335
+ bleu_score = {"Memorization score (BLEU)": bleu.compute(predictions=[output],
336
  references=[current_example])["bleu"]}
337
  # return output, diff_texts(output, sample), gr.Label.update(value=bleu_score)
338
  return diff(output, current_example), gr.Label.update(value=bleu_score), current_example
 
386
  )
387
 
388
  with gr.Column():
389
+ label = gr.Label(value={"Memorization score (BLEU)": 0},label="Memorization")
390
  with gr.Accordion("What is BLEU?", open=False): # NOTE - THIS WEIRDLY BREAKS EVERYTHING IF I UNCOMMENT
391
  gr.Markdown("""[BLEU](https://huggingface.co/spaces/evaluate-metric/bleu) score is a metric that can be used to measure the similarity of two sentences.
392
  Here, the higher the BLEU score, the more likely the model will learn the example by heart.