gsarti commited on
Commit
65c6c48
β€’
1 Parent(s): 06bb18a

Added Inseq citation

Browse files
Files changed (2) hide show
  1. app.py +9 -9
  2. contents.py +42 -13
app.py CHANGED
@@ -194,7 +194,7 @@ with gr.Blocks(css=custom_css) as demo:
194
  )
195
  with gr.Tab("βš™οΈ Parameters") as params_tab:
196
  gr.Markdown(
197
- "## ✨ Presets\nSelect a preset to load default parameters into the fields below."
198
  )
199
  with gr.Row(equal_height=True):
200
  with gr.Column():
@@ -453,7 +453,7 @@ with gr.Blocks(css=custom_css) as demo:
453
  ],
454
  )
455
 
456
- load_model_button.click(
457
  preload_model,
458
  inputs=load_model_args,
459
  outputs=[],
@@ -481,12 +481,12 @@ with gr.Blocks(css=custom_css) as demo:
481
 
482
  # Presets
483
 
484
- default_preset.click(**reset_kwargs).success(preload_model, inputs=load_model_args)
485
 
486
  cora_preset.click(**reset_kwargs).then(
487
  set_cora_preset,
488
  outputs=[model_name_or_path, input_template, contextless_input_current_text],
489
- ).success(preload_model, inputs=load_model_args)
490
 
491
  zephyr_preset.click(**reset_kwargs).then(
492
  set_zephyr_preset,
@@ -496,12 +496,12 @@ with gr.Blocks(css=custom_css) as demo:
496
  contextless_input_current_text,
497
  decoder_input_output_separator,
498
  ],
499
- ).success(preload_model, inputs=load_model_args)
500
 
501
  multilingual_mt_template.click(**reset_kwargs).then(
502
  set_mmt_preset,
503
  outputs=[model_name_or_path, input_template, output_template, tokenizer_kwargs],
504
- ).success(preload_model, inputs=load_model_args)
505
 
506
  chatml_template.click(**reset_kwargs).then(
507
  set_chatml_preset,
@@ -512,7 +512,7 @@ with gr.Blocks(css=custom_css) as demo:
512
  decoder_input_output_separator,
513
  special_tokens_to_keep,
514
  ],
515
- ).success(preload_model, inputs=load_model_args)
516
 
517
  towerinstruct_template.click(**reset_kwargs).then(
518
  set_towerinstruct_preset,
@@ -523,7 +523,7 @@ with gr.Blocks(css=custom_css) as demo:
523
  decoder_input_output_separator,
524
  special_tokens_to_keep,
525
  ],
526
- ).success(preload_model, inputs=load_model_args)
527
 
528
  gemma_template.click(**reset_kwargs).then(
529
  set_gemma_preset,
@@ -534,6 +534,6 @@ with gr.Blocks(css=custom_css) as demo:
534
  decoder_input_output_separator,
535
  special_tokens_to_keep,
536
  ],
537
- ).success(preload_model, inputs=load_model_args)
538
 
539
  demo.launch(allowed_paths=["outputs/"])
 
194
  )
195
  with gr.Tab("βš™οΈ Parameters") as params_tab:
196
  gr.Markdown(
197
+ "## ✨ Presets\nSelect a preset to load default parameters into the fields below. ⚠️ This will overwrite existing parameters."
198
  )
199
  with gr.Row(equal_height=True):
200
  with gr.Column():
 
453
  ],
454
  )
455
 
456
+ load_model_event = load_model_button.click(
457
  preload_model,
458
  inputs=load_model_args,
459
  outputs=[],
 
481
 
482
  # Presets
483
 
484
+ default_preset.click(**reset_kwargs).success(preload_model, inputs=load_model_args, cancels=load_model_event)
485
 
486
  cora_preset.click(**reset_kwargs).then(
487
  set_cora_preset,
488
  outputs=[model_name_or_path, input_template, contextless_input_current_text],
489
+ ).success(preload_model, inputs=load_model_args, cancels=load_model_event)
490
 
491
  zephyr_preset.click(**reset_kwargs).then(
492
  set_zephyr_preset,
 
496
  contextless_input_current_text,
497
  decoder_input_output_separator,
498
  ],
499
+ ).success(preload_model, inputs=load_model_args, cancels=load_model_event)
500
 
501
  multilingual_mt_template.click(**reset_kwargs).then(
502
  set_mmt_preset,
503
  outputs=[model_name_or_path, input_template, output_template, tokenizer_kwargs],
504
+ ).success(preload_model, inputs=load_model_args, cancels=load_model_event)
505
 
506
  chatml_template.click(**reset_kwargs).then(
507
  set_chatml_preset,
 
512
  decoder_input_output_separator,
513
  special_tokens_to_keep,
514
  ],
515
+ ).success(preload_model, inputs=load_model_args, cancels=load_model_event)
516
 
517
  towerinstruct_template.click(**reset_kwargs).then(
518
  set_towerinstruct_preset,
 
523
  decoder_input_output_separator,
524
  special_tokens_to_keep,
525
  ],
526
+ ).success(preload_model, inputs=load_model_args, cancels=load_model_event)
527
 
528
  gemma_template.click(**reset_kwargs).then(
529
  set_gemma_preset,
 
534
  decoder_input_output_separator,
535
  special_tokens_to_keep,
536
  ],
537
+ ).success(preload_model, inputs=load_model_args, cancels=load_model_event)
538
 
539
  demo.launch(allowed_paths=["outputs/"])
contents.py CHANGED
@@ -27,20 +27,49 @@ how_to_use = r"""
27
  citation = r"""
28
  <details>
29
  <summary><h3 class="summary-label">πŸ“š Citing PECoRe</h3></summary>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
- @inproceedings{sarti-etal-2023-quantifying,
32
- title = "Quantifying the Plausibility of Context Reliance in Neural Machine Translation",
33
- author = "Sarti, Gabriele and
34
- Chrupa{\l}a, Grzegorz and
35
- Nissim, Malvina and
36
- Bisazza, Arianna",
37
- booktitle = "The Twelfth International Conference on Learning Representations (ICLR 2024)",
38
- month = may,
39
- year = "2024",
40
- address = "Vienna, Austria",
41
- publisher = "OpenReview",
42
- url = "https://openreview.net/forum?id=XTHfNGI3zT"
43
- }
 
 
 
 
 
 
 
 
 
 
44
 
45
  </details>
46
  """
 
27
  citation = r"""
28
  <details>
29
  <summary><h3 class="summary-label">πŸ“š Citing PECoRe</h3></summary>
30
+ <p>To refer to the PECoRe framework for context usage detection, cite:</p>
31
+ <div class="code_wrap"><button class="copy_code_button" title="copy">
32
+ <span class="copy-text"><svg viewBox="0 0 32 32" height="100%" width="100%" xmlns="http://www.w3.org/2000/svg"><path d="M28 10v18H10V10h18m0-2H10a2 2 0 0 0-2 2v18a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2Z" fill="currentColor"></path><path d="M4 18H2V4a2 2 0 0 1 2-2h14v2H4Z" fill="currentColor"></path></svg></span>
33
+ <span class="check"><svg stroke-linejoin="round" stroke-linecap="round" stroke-width="3" stroke="currentColor" fill="none" viewBox="0 0 24 24" height="100%" width="100%" xmlns="http://www.w3.org/2000/svg"><polyline points="20 6 9 17 4 12"></polyline></svg></span>
34
+ </button><pre><code>
35
+ @inproceedings{sarti-etal-2023-quantifying,
36
+ title = "Quantifying the Plausibility of Context Reliance in Neural Machine Translation",
37
+ author = "Sarti, Gabriele and
38
+ Chrupa{\l}a, Grzegorz and
39
+ Nissim, Malvina and
40
+ Bisazza, Arianna",
41
+ booktitle = "The Twelfth International Conference on Learning Representations (ICLR 2024)",
42
+ month = may,
43
+ year = "2024",
44
+ address = "Vienna, Austria",
45
+ publisher = "OpenReview",
46
+ url = "https://openreview.net/forum?id=XTHfNGI3zT"
47
+ }
48
+ </code></pre></div>
49
 
50
+
51
+ If you use the Inseq implementation of PECoRe (<a href="https://inseq.org/en/latest/main_classes/cli.html#attribute-context"><code>inseq attribute-context</code></a>), please also cite:
52
+ <div class="code_wrap"><button class="copy_code_button" title="copy">
53
+ <span class="copy-text"><svg viewBox="0 0 32 32" height="100%" width="100%" xmlns="http://www.w3.org/2000/svg"><path d="M28 10v18H10V10h18m0-2H10a2 2 0 0 0-2 2v18a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2Z" fill="currentColor"></path><path d="M4 18H2V4a2 2 0 0 1 2-2h14v2H4Z" fill="currentColor"></path></svg></span>
54
+ <span class="check"><svg stroke-linejoin="round" stroke-linecap="round" stroke-width="3" stroke="currentColor" fill="none" viewBox="0 0 24 24" height="100%" width="100%" xmlns="http://www.w3.org/2000/svg"><polyline points="20 6 9 17 4 12"></polyline></svg></span>
55
+ </button><pre><code>
56
+ @inproceedings{sarti-etal-2023-inseq,
57
+ title = "Inseq: An Interpretability Toolkit for Sequence Generation Models",
58
+ author = "Sarti, Gabriele and
59
+ Feldhus, Nils and
60
+ Sickert, Ludwig and
61
+ van der Wal, Oskar and
62
+ Nissim, Malvina and
63
+ Bisazza, Arianna",
64
+ booktitle = "Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 3: System Demonstrations)",
65
+ month = jul,
66
+ year = "2023",
67
+ address = "Toronto, Canada",
68
+ publisher = "Association for Computational Linguistics",
69
+ url = "https://aclanthology.org/2023.acl-demo.40",
70
+ pages = "421--435",
71
+ }
72
+ </code></pre></div>
73
 
74
  </details>
75
  """