Hazzzardous commited on
Commit
3fc10cf
1 Parent(s): b24db59

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -2,17 +2,14 @@
2
  RWKV RNN Model - Gradio Space for HuggingFace
3
  YT - Mean Gene Hacks - https://www.youtube.com/@MeanGeneHacks
4
  (C) Gene Ruebsamen - 2/7/2023
5
-
6
  This program is free software: you can redistribute it and/or modify
7
  it under the terms of the GNU General Public License as published by
8
  the Free Software Foundation, either version 3 of the License, or
9
  (at your option) any later version.
10
-
11
  This program is distributed in the hope that it will be useful,
12
  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
  GNU General Public License for more details.
15
-
16
  You should have received a copy of the GNU General Public License
17
  along with this program. If not, see <http://www.gnu.org/licenses/>.
18
  """
@@ -85,7 +82,13 @@ def infer(
85
  # Clear model state for generative mode
86
  model.resetState()
87
  if (mode == "Q/A"):
88
- prompt = f"Ask Expert\n\nQuestion:\n{prompt}\n\nExpert Full Answer:\n"
 
 
 
 
 
 
89
 
90
  print(f"PROMPT ({datetime.now()}):\n-------\n{prompt}")
91
  print(f"OUTPUT ({datetime.now()}):\n-------\n")
@@ -146,7 +149,6 @@ def chat(
146
  username = username or "USER"
147
 
148
  intro = f'''The following is a verbose and detailed conversation between an AI assistant called FRITZ, and a human user called USER. FRITZ is intelligent, knowledgeable, wise and polite.
149
-
150
  {username}: What year was the french revolution?
151
  FRITZ: The French Revolution started in 1789, and lasted 10 years until 1799.
152
  {username}: 3+5=?
@@ -218,7 +220,6 @@ examples = [
218
  [
219
  # Chatbot
220
  '''This is a conversation between two AI large language models named Alex and Fritz. They are exploring each other's capabilities, and trying to ask interesting questions of one another to explore the limits of each others AI.
221
-
222
  Conversation:
223
  Alex: Good morning, Fritz, what type of LLM are you based upon?
224
  Fritz: Morning Alex, I am an RNN with transformer level performance. My language model is 100% attention free.
@@ -226,9 +227,7 @@ Alex:''', "generative", 220, 0.9, 0.9, "\\n\\n,<|endoftext|>"],
226
  [
227
  # Generate List
228
  '''Task given:
229
-
230
  Please Write a Short story about a cat learning python
231
-
232
  Best Full Response:
233
  ''', "generative", 140, 0.85, 0.8, "<|endoftext|>"],
234
  [
@@ -244,7 +243,7 @@ iface = gr.Interface(
244
  allow_flagging="never",
245
  inputs=[
246
  gr.Textbox(lines=20, label="Prompt"), # prompt
247
- gr.Radio(["generative", "Q/A"],
248
  value="generative", label="Choose Mode"),
249
  gr.Slider(1, 256, value=40), # max_tokens
250
  gr.Slider(0.0, 1.0, value=0.8), # temperature
@@ -282,4 +281,4 @@ demo = gr.TabbedInterface(
282
  )
283
 
284
  demo.queue()
285
- demo.launch(share=False)
 
2
  RWKV RNN Model - Gradio Space for HuggingFace
3
  YT - Mean Gene Hacks - https://www.youtube.com/@MeanGeneHacks
4
  (C) Gene Ruebsamen - 2/7/2023
 
5
  This program is free software: you can redistribute it and/or modify
6
  it under the terms of the GNU General Public License as published by
7
  the Free Software Foundation, either version 3 of the License, or
8
  (at your option) any later version.
 
9
  This program is distributed in the hope that it will be useful,
10
  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
  GNU General Public License for more details.
 
13
  You should have received a copy of the GNU General Public License
14
  along with this program. If not, see <http://www.gnu.org/licenses/>.
15
  """
 
82
  # Clear model state for generative mode
83
  model.resetState()
84
  if (mode == "Q/A"):
85
+ prompt = f"\nQ: {prompt}\n\nA:"
86
+ if (mode == "ELDR"):
87
+ prompt = f"\n{prompt}\n\nExpert Long Detailed Response:"
88
+ if (mode == "EFA"):
89
+ prompt = f'\nAsk Expert\n\nQuestion:\n{prompt}\n\nExpert Full Answer:\n'
90
+ if (mode == "BFR"):
91
+ prompt = f"Task given:\n\n{prompt}\n\nBest Full Response:"
92
 
93
  print(f"PROMPT ({datetime.now()}):\n-------\n{prompt}")
94
  print(f"OUTPUT ({datetime.now()}):\n-------\n")
 
149
  username = username or "USER"
150
 
151
  intro = f'''The following is a verbose and detailed conversation between an AI assistant called FRITZ, and a human user called USER. FRITZ is intelligent, knowledgeable, wise and polite.
 
152
  {username}: What year was the french revolution?
153
  FRITZ: The French Revolution started in 1789, and lasted 10 years until 1799.
154
  {username}: 3+5=?
 
220
  [
221
  # Chatbot
222
  '''This is a conversation between two AI large language models named Alex and Fritz. They are exploring each other's capabilities, and trying to ask interesting questions of one another to explore the limits of each others AI.
 
223
  Conversation:
224
  Alex: Good morning, Fritz, what type of LLM are you based upon?
225
  Fritz: Morning Alex, I am an RNN with transformer level performance. My language model is 100% attention free.
 
227
  [
228
  # Generate List
229
  '''Task given:
 
230
  Please Write a Short story about a cat learning python
 
231
  Best Full Response:
232
  ''', "generative", 140, 0.85, 0.8, "<|endoftext|>"],
233
  [
 
243
  allow_flagging="never",
244
  inputs=[
245
  gr.Textbox(lines=20, label="Prompt"), # prompt
246
+ gr.Radio(["generative", "Q/A","ELDR","EFR","BFR"],
247
  value="generative", label="Choose Mode"),
248
  gr.Slider(1, 256, value=40), # max_tokens
249
  gr.Slider(0.0, 1.0, value=0.8), # temperature
 
281
  )
282
 
283
  demo.queue()
284
+ demo.launch(share=False)