Added NLLB preset
Browse files- app.py +23 -10
- presets.py +10 -1
app.py
CHANGED
@@ -24,7 +24,8 @@ from presets import (
|
|
24 |
set_chatml_preset,
|
25 |
set_cora_preset,
|
26 |
set_default_preset,
|
27 |
-
|
|
|
28 |
set_towerinstruct_preset,
|
29 |
set_zephyr_preset,
|
30 |
set_gemma_preset,
|
@@ -242,22 +243,24 @@ with gr.Blocks(css=custom_css) as demo:
|
|
242 |
"Preset for the <a href='https://huggingface.co/gsarti/cora_mgen' target='_blank'>CORA Multilingual QA</a> model.\nUses special templates for inputs."
|
243 |
)
|
244 |
with gr.Column():
|
245 |
-
|
246 |
gr.Markdown(
|
247 |
-
"Preset for models using the <a href='https://
|
248 |
)
|
249 |
with gr.Row(equal_height=True):
|
250 |
with gr.Column(scale=1):
|
251 |
-
|
252 |
-
"Multilingual MT", variant="secondary"
|
253 |
)
|
254 |
gr.Markdown(
|
255 |
-
"Preset for
|
256 |
)
|
257 |
with gr.Column(scale=1):
|
258 |
-
|
|
|
|
|
259 |
gr.Markdown(
|
260 |
-
"Preset for
|
261 |
)
|
262 |
with gr.Column(scale=1):
|
263 |
towerinstruct_template = gr.Button(
|
@@ -267,6 +270,11 @@ with gr.Blocks(css=custom_css) as demo:
|
|
267 |
"Preset for models using the <a href='https://huggingface.co/Unbabel/TowerInstruct-7B-v0.1' target='_blank'>Unbabel TowerInstruct</a> conversational template.\nUses <code><|im_start|></code>, <code><|im_end|></code> special tokens."
|
268 |
)
|
269 |
with gr.Row(equal_height=True):
|
|
|
|
|
|
|
|
|
|
|
270 |
with gr.Column(scale=1):
|
271 |
gemma_template = gr.Button(
|
272 |
"Gemma Chat Template", variant="secondary", interactive=False
|
@@ -624,8 +632,13 @@ with gr.Blocks(css=custom_css) as demo:
|
|
624 |
],
|
625 |
).success(preload_model, inputs=load_model_args, cancels=load_model_event)
|
626 |
|
627 |
-
|
628 |
-
|
|
|
|
|
|
|
|
|
|
|
629 |
outputs=[model_name_or_path, input_template, output_template, tokenizer_kwargs],
|
630 |
).success(preload_model, inputs=load_model_args, cancels=load_model_event)
|
631 |
|
|
|
24 |
set_chatml_preset,
|
25 |
set_cora_preset,
|
26 |
set_default_preset,
|
27 |
+
set_mbart_mmt_preset,
|
28 |
+
set_nllb_mmt_preset,
|
29 |
set_towerinstruct_preset,
|
30 |
set_zephyr_preset,
|
31 |
set_gemma_preset,
|
|
|
243 |
"Preset for the <a href='https://huggingface.co/gsarti/cora_mgen' target='_blank'>CORA Multilingual QA</a> model.\nUses special templates for inputs."
|
244 |
)
|
245 |
with gr.Column():
|
246 |
+
chatml_template = gr.Button("Qwen ChatML", variant="secondary")
|
247 |
gr.Markdown(
|
248 |
+
"Preset for models using the <a href='https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/ai-services/openai/includes/chat-markup-language.md' target='_blank'>ChatML conversational template</a>.\nUses <code><|im_start|></code>, <code><|im_end|></code> special tokens."
|
249 |
)
|
250 |
with gr.Row(equal_height=True):
|
251 |
with gr.Column(scale=1):
|
252 |
+
mbart_mmt_template = gr.Button(
|
253 |
+
"mBART Multilingual MT", variant="secondary"
|
254 |
)
|
255 |
gr.Markdown(
|
256 |
+
"Preset for the <a href='https://huggingface.co/facebook/mbart-large-50-many-to-many-mmt' target='_blank'>mBART Many-to-Many</a> multilingual MT model using language tags (default: English to French)."
|
257 |
)
|
258 |
with gr.Column(scale=1):
|
259 |
+
nllb_mmt_template = gr.Button(
|
260 |
+
"NLLB Multilingual MT", variant="secondary"
|
261 |
+
)
|
262 |
gr.Markdown(
|
263 |
+
"Preset for the <a href='https://huggingface.co/facebook/nllb-200-distilled-600M' target='_blank'>NLLB 600M</a> multilingual MT model using language tags (default: English to French)."
|
264 |
)
|
265 |
with gr.Column(scale=1):
|
266 |
towerinstruct_template = gr.Button(
|
|
|
270 |
"Preset for models using the <a href='https://huggingface.co/Unbabel/TowerInstruct-7B-v0.1' target='_blank'>Unbabel TowerInstruct</a> conversational template.\nUses <code><|im_start|></code>, <code><|im_end|></code> special tokens."
|
271 |
)
|
272 |
with gr.Row(equal_height=True):
|
273 |
+
with gr.Column():
|
274 |
+
zephyr_preset = gr.Button("Zephyr Template", variant="secondary", interactive=False)
|
275 |
+
gr.Markdown(
|
276 |
+
"Preset for models using the <a href='https://huggingface.co/stabilityai/stablelm-2-zephyr-1_6b' target='_blank'>StableLM 2 Zephyr conversational template</a>.\nUses <code><|system|></code>, <code><|user|></code> and <code><|assistant|></code> special tokens."
|
277 |
+
)
|
278 |
with gr.Column(scale=1):
|
279 |
gemma_template = gr.Button(
|
280 |
"Gemma Chat Template", variant="secondary", interactive=False
|
|
|
632 |
],
|
633 |
).success(preload_model, inputs=load_model_args, cancels=load_model_event)
|
634 |
|
635 |
+
mbart_mmt_template.click(**reset_kwargs).then(
|
636 |
+
set_mbart_mmt_preset,
|
637 |
+
outputs=[model_name_or_path, input_template, output_template, tokenizer_kwargs],
|
638 |
+
).success(preload_model, inputs=load_model_args, cancels=load_model_event)
|
639 |
+
|
640 |
+
nllb_mmt_template.click(**reset_kwargs).then(
|
641 |
+
set_nllb_mmt_preset,
|
642 |
outputs=[model_name_or_path, input_template, output_template, tokenizer_kwargs],
|
643 |
).success(preload_model, inputs=load_model_args, cancels=load_model_event)
|
644 |
|
presets.py
CHANGED
@@ -46,7 +46,7 @@ def set_chatml_preset():
|
|
46 |
)
|
47 |
|
48 |
|
49 |
-
def
|
50 |
return (
|
51 |
"facebook/mbart-large-50-one-to-many-mmt", # model_name_or_path
|
52 |
"{context} {current}", # input_template
|
@@ -55,6 +55,15 @@ def set_mmt_preset():
|
|
55 |
)
|
56 |
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
def set_towerinstruct_preset():
|
59 |
return (
|
60 |
"Unbabel/TowerInstruct-7B-v0.1", # model_name_or_path
|
|
|
46 |
)
|
47 |
|
48 |
|
49 |
+
def set_mbart_mmt_preset():
|
50 |
return (
|
51 |
"facebook/mbart-large-50-one-to-many-mmt", # model_name_or_path
|
52 |
"{context} {current}", # input_template
|
|
|
55 |
)
|
56 |
|
57 |
|
58 |
+
def set_nllb_mmt_preset():
|
59 |
+
return (
|
60 |
+
"facebook/nllb-200-distilled-600M", # model_name_or_path
|
61 |
+
"{context} {current}", # input_template
|
62 |
+
"{context} {current}", # output_template
|
63 |
+
'{\n\t"src_lang": "eng_Latn",\n\t"tgt_lang": "fra_Latn"\n}', # tokenizer_kwargs
|
64 |
+
)
|
65 |
+
|
66 |
+
|
67 |
def set_towerinstruct_preset():
|
68 |
return (
|
69 |
"Unbabel/TowerInstruct-7B-v0.1", # model_name_or_path
|