Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,13 +51,28 @@ def generate_pairs(context):
|
|
| 51 |
output += f"## Instruction {index + 1}:\n{pair['Q']}\n## Response {index + 1}:\n{pair['A']}\n\n"
|
| 52 |
return output
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
# Create Gradio interface
|
| 55 |
iface = gr.Interface(
|
| 56 |
fn=generate_pairs,
|
| 57 |
inputs=gr.Textbox(lines=5, label="Enter context here"),
|
| 58 |
outputs=gr.Textbox(lines=20, label="Generated Instruction-Response Pairs"),
|
| 59 |
title="Instruction-Response Pair Generator",
|
| 60 |
-
description=
|
| 61 |
)
|
| 62 |
|
| 63 |
# Launch the interface
|
|
|
|
| 51 |
output += f"## Instruction {index + 1}:\n{pair['Q']}\n## Response {index + 1}:\n{pair['A']}\n\n"
|
| 52 |
return output
|
| 53 |
|
| 54 |
+
description = """
|
| 55 |
+
## Instruction Pre-Training: Language Models as Supervised Multitask Learners
|
| 56 |
+
|
| 57 |
+
This demo implements the instruction synthesis approach from the paper ["Instruction Pre-Training: Language Models are Supervised Multitask Learners"](https://huggingface.co/papers/2406.14491).
|
| 58 |
+
|
| 59 |
+
### Method:
|
| 60 |
+
1. An instruction synthesizer is trained on diverse datasets to generate instruction-response pairs from raw text.
|
| 61 |
+
2. The synthesizer augments raw pre-training corpora with synthesized instruction-response pairs.
|
| 62 |
+
3. Language models are then pre-trained on this augmented data, combining unsupervised and supervised multitask learning.
|
| 63 |
+
|
| 64 |
+
This approach enhances model performance and generalization, particularly benefiting from further instruction tuning.
|
| 65 |
+
|
| 66 |
+
Try it out by entering some text below!
|
| 67 |
+
"""
|
| 68 |
+
|
| 69 |
# Create Gradio interface
|
| 70 |
iface = gr.Interface(
|
| 71 |
fn=generate_pairs,
|
| 72 |
inputs=gr.Textbox(lines=5, label="Enter context here"),
|
| 73 |
outputs=gr.Textbox(lines=20, label="Generated Instruction-Response Pairs"),
|
| 74 |
title="Instruction-Response Pair Generator",
|
| 75 |
+
description=description
|
| 76 |
)
|
| 77 |
|
| 78 |
# Launch the interface
|