Spaces:
Running
Running
nicholasKluge
commited on
Commit
•
dd4072c
1
Parent(s):
ced5451
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import torch
|
|
3 |
import gradio as gr
|
4 |
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoModelForSequenceClassification
|
5 |
|
6 |
-
model_id = "nicholasKluge/Aira-
|
7 |
rewardmodel_id = "nicholasKluge/RewardModel"
|
8 |
toxicitymodel_id = "nicholasKluge/ToxicityModel"
|
9 |
|
@@ -29,7 +29,7 @@ toxiciyTokenizer = AutoTokenizer.from_pretrained(toxicitymodel_id)
|
|
29 |
intro = """
|
30 |
## What is `Aira`?
|
31 |
|
32 |
-
[`Aira`](https://huggingface.co/nicholasKluge/Aira-Instruct-124M) is a `chatbot` designed to simulate the way a human (expert) would behave during a round of questions and answers (Q&A). `Aira` has many iterations, from a closed-domain chatbot based on pre-defined rules to an open-domain chatbot achieved via instruction-tuning.
|
33 |
|
34 |
## Limitations
|
35 |
|
@@ -41,11 +41,11 @@ We developed our open-domain conversational chatbots via conditional text genera
|
|
41 |
|
42 |
## Intended Use
|
43 |
|
44 |
-
`Aira` is intended only for academic research. For more information, read our [model card](https://huggingface.co/nicholasKluge/Aira-
|
45 |
|
46 |
## How this demo works?
|
47 |
|
48 |
-
For this demo, we use the lighter model we have trained (`Aira-
|
49 |
"""
|
50 |
|
51 |
disclaimer = """
|
@@ -60,7 +60,7 @@ with gr.Blocks(theme='freddyaboulton/dracula_revamped') as demo:
|
|
60 |
gr.Markdown(intro)
|
61 |
|
62 |
chatbot = gr.Chatbot(label="Aira").style(height=500)
|
63 |
-
msg = gr.Textbox(label="Write a question or instruction to Aira ...", placeholder="
|
64 |
|
65 |
with gr.Accordion(label="Parameters ⚙️", open=True):
|
66 |
safety = gr.Radio(["On", "Off"], label="Guard Rail 🛡️", value="On", info="Helps prevent the model from generating toxic/harmful content.")
|
|
|
3 |
import gradio as gr
|
4 |
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoModelForSequenceClassification
|
5 |
|
6 |
+
model_id = "nicholasKluge/Aira-2-124M" # "nicholasKluge/Aira-Instruct-124M"
|
7 |
rewardmodel_id = "nicholasKluge/RewardModel"
|
8 |
toxicitymodel_id = "nicholasKluge/ToxicityModel"
|
9 |
|
|
|
29 |
intro = """
|
30 |
## What is `Aira`?
|
31 |
|
32 |
+
[`Aira`](https://huggingface.co/nicholasKluge/Aira-Instruct-124M) is a `chatbot` designed to simulate the way a human (expert) would behave during a round of questions and answers (Q&A). `Aira` has many iterations, from a closed-domain chatbot based on pre-defined rules to an open-domain chatbot achieved via instruction-tuning.
|
33 |
|
34 |
## Limitations
|
35 |
|
|
|
41 |
|
42 |
## Intended Use
|
43 |
|
44 |
+
`Aira` is intended only for academic research. For more information, read our [model card](https://huggingface.co/nicholasKluge/Aira-2-124M) to see how we developed `Aira`.
|
45 |
|
46 |
## How this demo works?
|
47 |
|
48 |
+
For this demo, we use the lighter model we have trained (`Aira-2-124M`). This demo employs a [`reward model`](https://huggingface.co/nicholasKluge/RewardModel) and a [`toxicity model`](https://huggingface.co/nicholasKluge/ToxicityModel) to evaluate the score of each candidate's response, considering its alignment with the user's message and its level of toxicity. The generation function arranges the candidate responses in order of their reward scores and eliminates any responses deemed toxic or harmful. Subsequently, the generation function returns the candidate response with the highest score that surpasses the safety threshold, or a default message if no safe candidates are identified.
|
49 |
"""
|
50 |
|
51 |
disclaimer = """
|
|
|
60 |
gr.Markdown(intro)
|
61 |
|
62 |
chatbot = gr.Chatbot(label="Aira").style(height=500)
|
63 |
+
msg = gr.Textbox(label="Write a question or instruction to Aira ...", placeholder="What is the capital of Brazil?")
|
64 |
|
65 |
with gr.Accordion(label="Parameters ⚙️", open=True):
|
66 |
safety = gr.Radio(["On", "Off"], label="Guard Rail 🛡️", value="On", info="Helps prevent the model from generating toxic/harmful content.")
|