Spaces:
Sleeping
Sleeping
jwkirchenbauer
commited on
Commit
β’
8ec4512
1
Parent(s):
5b3e92c
update framework acknowledgement
Browse files- demo_watermark.py +17 -7
demo_watermark.py
CHANGED
@@ -411,6 +411,8 @@ def run_gradio(args, model=None, device=None, tokenizer=None):
|
|
411 |
gr.Markdown(
|
412 |
"""
|
413 |
## π§ [A Watermark for Large Language Models](https://arxiv.org/abs/2301.10226) π
|
|
|
|
|
414 |
"""
|
415 |
)
|
416 |
with gr.Column(scale=1):
|
@@ -445,18 +447,27 @@ def run_gradio(args, model=None, device=None, tokenizer=None):
|
|
445 |
was likely to have been generated by a model that uses the watermark.
|
446 |
|
447 |
This space showcases a watermarking approach that can be applied to _any_ generative language model.
|
448 |
-
For demonstration purposes, the space
|
449 |
"""
|
450 |
)
|
451 |
-
with gr.Accordion("A note on
|
452 |
gr.Markdown(
|
453 |
"""
|
454 |
-
This demo uses open-source language models
|
455 |
-
|
456 |
-
|
457 |
-
For best results, prompt
|
458 |
Some examples include the opening paragraph of a wikipedia article, or the first few sentences of a story.
|
459 |
Longer prompts that end mid-sentence will result in more fluent generations.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
"""
|
461 |
)
|
462 |
gr.Markdown(
|
@@ -769,7 +780,6 @@ def run_gradio(args, model=None, device=None, tokenizer=None):
|
|
769 |
select_green_tokens.change(fn=detect_partial, inputs=[output_with_watermark,session_args,session_tokenizer], outputs=[with_watermark_detection_result,session_args,session_tokenizer])
|
770 |
select_green_tokens.change(fn=detect_partial, inputs=[detection_input,session_args,session_tokenizer], outputs=[detection_result,session_args,session_tokenizer])
|
771 |
|
772 |
-
|
773 |
demo.queue(concurrency_count=3)
|
774 |
|
775 |
if args.demo_public:
|
|
|
411 |
gr.Markdown(
|
412 |
"""
|
413 |
## π§ [A Watermark for Large Language Models](https://arxiv.org/abs/2301.10226) π
|
414 |
+
|
415 |
+
Demo made possible by the HuggingFace π€ [text-generation-inference](https://github.com/huggingface/text-generation-inference) serving framework.
|
416 |
"""
|
417 |
)
|
418 |
with gr.Column(scale=1):
|
|
|
447 |
was likely to have been generated by a model that uses the watermark.
|
448 |
|
449 |
This space showcases a watermarking approach that can be applied to _any_ generative language model.
|
450 |
+
For demonstration purposes, the space demos a selection of multi-billion parameter models (see the following note for caveats).
|
451 |
"""
|
452 |
)
|
453 |
+
with gr.Accordion("A note on the available models:",open=False):
|
454 |
gr.Markdown(
|
455 |
"""
|
456 |
+
This demo uses open-source language models. Today, these models are less powerful than proprietary commercial tools like ChatGPT, Claude, Bard, or Bing/Sydney.
|
457 |
+
|
458 |
+
Smaller models like OPT-6.7b are designed to "complete" your prompt, and are not fine-tuned to follow instructions.
|
459 |
+
For best results, prompt that model with a few sentences that form the beginning of a paragraph, and then allow it to "continue" your paragraph.
|
460 |
Some examples include the opening paragraph of a wikipedia article, or the first few sentences of a story.
|
461 |
Longer prompts that end mid-sentence will result in more fluent generations.
|
462 |
+
|
463 |
+
The larger models available in this demo are fine-tuned to follow instructions but have different strengths and will showcase different
|
464 |
+
types of watermark behavior. [BLOOMZ (175B)](https://huggingface.co/bigscience/bloomz) is an instruction tuned variant of BLOOM capable of following instructions in dozens of languages zero-shot
|
465 |
+
and can generate long and coherent paragraphs and stories given the right prompt.
|
466 |
+
The FLAN models [FLAN-t5-xxl (11B)](https://huggingface.co/google/flan-t5-xxl) and [FLAN-UL2 (20B)](https://huggingface.co/google/flan-ul2) are fine-tuned on a variety of in-context few-shot learning NLP tasks,
|
467 |
+
such as reasoning, and question answering.
|
468 |
+
|
469 |
+
Generally, short, low entropy scenarios where the model has very few choices in terms of correct/suitable responses to the prompt
|
470 |
+
will not exhibit as strong of a watermark presence, while longer watermarked outputs will produce higher detection statistics.
|
471 |
"""
|
472 |
)
|
473 |
gr.Markdown(
|
|
|
780 |
select_green_tokens.change(fn=detect_partial, inputs=[output_with_watermark,session_args,session_tokenizer], outputs=[with_watermark_detection_result,session_args,session_tokenizer])
|
781 |
select_green_tokens.change(fn=detect_partial, inputs=[detection_input,session_args,session_tokenizer], outputs=[detection_result,session_args,session_tokenizer])
|
782 |
|
|
|
783 |
demo.queue(concurrency_count=3)
|
784 |
|
785 |
if args.demo_public:
|