research14 commited on
Commit
8e9a815
1 Parent(s): d0d39dd

reverted changes

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -75,12 +75,12 @@ def gpt_respond(have_key, tab_name, message, chat_history, max_convo_length = 10
75
  formatted_prompt = format_chat_prompt(message, chat_history, max_convo_length)
76
  print('GPT ling ents Prompt + Context:')
77
  print(formatted_prompt)
78
- bot_message = chat(user_prompt = f'''Output any <{tab_name}> in the following sentence: "{formatted_prompt}"''')
79
  chat_history.insert(0, (message, bot_message))
80
  return "", chat_history
81
 
82
  def vicuna_respond(tab_name, message, chat_history):
83
- formatted_prompt = f'''Output any {tab_name} in the following sentence: "{message}"'''
84
  print('Vicuna Ling Ents Fn - Prompt + Context:')
85
  print(formatted_prompt)
86
  input_ids = vicuna_tokenizer.encode(formatted_prompt, return_tensors="pt")
@@ -97,7 +97,7 @@ def vicuna_respond(tab_name, message, chat_history):
97
  return tab_name, "", chat_history
98
 
99
  def llama_respond(tab_name, message, chat_history):
100
- formatted_prompt = f'''Output any {tab_name} in the following sentence: "{message}"'''
101
  # print('Llama - Prompt + Context:')
102
  # print(formatted_prompt)
103
  input_ids = llama_tokenizer.encode(formatted_prompt, return_tensors="pt")
@@ -119,7 +119,7 @@ def gpt_strategies_respond(have_key, strategy, task_name, task_ling_ent, message
119
  formatted_system_prompt = ""
120
  if (task_name == "POS Tagging"):
121
  if (strategy == "S1"):
122
- formatted_system_prompt = f'''Output any {task_ling_ent} in the following sentence: "{message}"'''
123
  elif (strategy == "S2"):
124
  formatted_system_prompt = f'''POS tag the following sentence using Universal POS tag set: "{message}"'''
125
  elif (strategy == "S3"):
@@ -128,7 +128,7 @@ def gpt_strategies_respond(have_key, strategy, task_name, task_ling_ent, message
128
  formatted_system_prompt = f'''"{demon_pos}". Using the POS tag structure above, POS tag the following sentence: "{message}"'''
129
  elif (task_name == "Chunking"):
130
  if (strategy == "S1"):
131
- formatted_system_prompt = f'''Output any {task_ling_ent} in the following sentence: "{message}"'''
132
  elif (strategy == "S2"):
133
  formatted_system_prompt = f'''Chunk the following sentence in CoNLL 2000 format with BIO tags: "{message}"'''
134
  elif (strategy == "S3"):
@@ -147,7 +147,7 @@ def vicuna_strategies_respond(strategy, task_name, task_ling_ent, message, chat_
147
  formatted_prompt = ""
148
  if (task_name == "POS Tagging"):
149
  if (strategy == "S1"):
150
- formatted_prompt = f'''Output any {task_ling_ent} in the following sentence: "{message}"'''
151
  elif (strategy == "S2"):
152
  formatted_prompt = f'''POS tag the following sentence using Universal POS tag set: "{message}"'''
153
  elif (strategy == "S3"):
@@ -156,7 +156,7 @@ def vicuna_strategies_respond(strategy, task_name, task_ling_ent, message, chat_
156
  formatted_prompt = f'''"{demon_pos}". Using the POS tag structure above, POS tag the following sentence: "{message}"'''
157
  elif (task_name == "Chunking"):
158
  if (strategy == "S1"):
159
- formatted_prompt = f'''Output any {task_ling_ent} in the following sentence: "{message}"'''
160
  elif (strategy == "S2"):
161
  formatted_prompt = f'''Chunk the following sentence in CoNLL 2000 format with BIO tags: "{message}"'''
162
  elif (strategy == "S3"):
@@ -183,7 +183,7 @@ def llama_strategies_respond(strategy, task_name, task_ling_ent, message, chat_h
183
  formatted_prompt = ""
184
  if (task_name == "POS Tagging"):
185
  if (strategy == "S1"):
186
- formatted_prompt = f'''Output any {task_ling_ent} in the following sentence: "{message}"'''
187
  elif (strategy == "S2"):
188
  formatted_prompt = f'''POS tag the following sentence using Universal POS tag set: "{message}"'''
189
  elif (strategy == "S3"):
@@ -192,7 +192,7 @@ def llama_strategies_respond(strategy, task_name, task_ling_ent, message, chat_h
192
  formatted_prompt = f'''"{demon_pos}". Using the POS tag structure above, POS tag the following sentence: "{message}"'''
193
  elif (task_name == "Chunking"):
194
  if (strategy == "S1"):
195
- formatted_prompt = f'''Output any {task_ling_ent} in the following sentence: "{message}"'''
196
  elif (strategy == "S2"):
197
  formatted_prompt = f'''Chunk the following sentence in CoNLL 2000 format with BIO tags: "{message}"'''
198
  elif (strategy == "S3"):
@@ -256,7 +256,7 @@ def interface():
256
  # Outputs
257
 
258
  user_prompt_1 = gr.Textbox(label="Original prompt")
259
- linguistic_features_textbox = gr.Textbox(label="Linguistic Complexity", disabled=True, info="[Definitions for Complexity Indices](https://docs.google.com/spreadsheets/d/1uXtQ1ah0OL9cmHp2Hey0QcHb4bifJcQFLvYlVIAWWwQ/edit#gid=693915416)")
260
 
261
  with gr.Row():
262
  gpt_ling_ents_chatbot = gr.Chatbot(label="gpt-3.5")
@@ -340,7 +340,7 @@ def interface():
340
 
341
  # Outputs
342
  user_prompt_2 = gr.Textbox(label="Original prompt", )
343
- linguistic_features_textbox_2 = gr.Textbox(label="Linguistic Complexity", disabled=True, info="[Definitions for Complexity Indices](https://docs.google.com/spreadsheets/d/1uXtQ1ah0OL9cmHp2Hey0QcHb4bifJcQFLvYlVIAWWwQ/edit#gid=693915416)")
344
 
345
  gr.Markdown("### Strategy 1 - QA-Based Prompting")
346
  strategy1 = gr.Markdown("S1", visible=False)
 
75
  formatted_prompt = format_chat_prompt(message, chat_history, max_convo_length)
76
  print('GPT ling ents Prompt + Context:')
77
  print(formatted_prompt)
78
+ bot_message = chat(user_prompt = f'''Output any <{tab_name}> in the following sentence one per line: "{formatted_prompt}"''')
79
  chat_history.insert(0, (message, bot_message))
80
  return "", chat_history
81
 
82
  def vicuna_respond(tab_name, message, chat_history):
83
+ formatted_prompt = f'''Output any {tab_name} in the following sentence one per line: "{message}"'''
84
  print('Vicuna Ling Ents Fn - Prompt + Context:')
85
  print(formatted_prompt)
86
  input_ids = vicuna_tokenizer.encode(formatted_prompt, return_tensors="pt")
 
97
  return tab_name, "", chat_history
98
 
99
  def llama_respond(tab_name, message, chat_history):
100
+ formatted_prompt = f'''Output any {tab_name} in the following sentence one per line: "{message}"'''
101
  # print('Llama - Prompt + Context:')
102
  # print(formatted_prompt)
103
  input_ids = llama_tokenizer.encode(formatted_prompt, return_tensors="pt")
 
119
  formatted_system_prompt = ""
120
  if (task_name == "POS Tagging"):
121
  if (strategy == "S1"):
122
+ formatted_system_prompt = f'''Output any {task_ling_ent} in the following sentence one per line: "{message}"'''
123
  elif (strategy == "S2"):
124
  formatted_system_prompt = f'''POS tag the following sentence using Universal POS tag set: "{message}"'''
125
  elif (strategy == "S3"):
 
128
  formatted_system_prompt = f'''"{demon_pos}". Using the POS tag structure above, POS tag the following sentence: "{message}"'''
129
  elif (task_name == "Chunking"):
130
  if (strategy == "S1"):
131
+ formatted_system_prompt = f'''Output any {task_ling_ent} in the following sentence one per line: "{message}"'''
132
  elif (strategy == "S2"):
133
  formatted_system_prompt = f'''Chunk the following sentence in CoNLL 2000 format with BIO tags: "{message}"'''
134
  elif (strategy == "S3"):
 
147
  formatted_prompt = ""
148
  if (task_name == "POS Tagging"):
149
  if (strategy == "S1"):
150
+ formatted_prompt = f'''Output any {task_ling_ent} in the following sentence one per line: "{message}"'''
151
  elif (strategy == "S2"):
152
  formatted_prompt = f'''POS tag the following sentence using Universal POS tag set: "{message}"'''
153
  elif (strategy == "S3"):
 
156
  formatted_prompt = f'''"{demon_pos}". Using the POS tag structure above, POS tag the following sentence: "{message}"'''
157
  elif (task_name == "Chunking"):
158
  if (strategy == "S1"):
159
+ formatted_prompt = f'''Output any {task_ling_ent} in the following sentence one per line: "{message}"'''
160
  elif (strategy == "S2"):
161
  formatted_prompt = f'''Chunk the following sentence in CoNLL 2000 format with BIO tags: "{message}"'''
162
  elif (strategy == "S3"):
 
183
  formatted_prompt = ""
184
  if (task_name == "POS Tagging"):
185
  if (strategy == "S1"):
186
+ formatted_prompt = f'''Output any {task_ling_ent} in the following sentence one per line: "{message}"'''
187
  elif (strategy == "S2"):
188
  formatted_prompt = f'''POS tag the following sentence using Universal POS tag set: "{message}"'''
189
  elif (strategy == "S3"):
 
192
  formatted_prompt = f'''"{demon_pos}". Using the POS tag structure above, POS tag the following sentence: "{message}"'''
193
  elif (task_name == "Chunking"):
194
  if (strategy == "S1"):
195
+ formatted_prompt = f'''Output any {task_ling_ent} in the following sentence one per line: "{message}"'''
196
  elif (strategy == "S2"):
197
  formatted_prompt = f'''Chunk the following sentence in CoNLL 2000 format with BIO tags: "{message}"'''
198
  elif (strategy == "S3"):
 
256
  # Outputs
257
 
258
  user_prompt_1 = gr.Textbox(label="Original prompt")
259
+ linguistic_features_textbox = gr.Textbox(label="Linguistic Complexity", disabled=True)
260
 
261
  with gr.Row():
262
  gpt_ling_ents_chatbot = gr.Chatbot(label="gpt-3.5")
 
340
 
341
  # Outputs
342
  user_prompt_2 = gr.Textbox(label="Original prompt", )
343
+ linguistic_features_textbox_2 = gr.Textbox(label="Linguistic Complexity", disabled=True)
344
 
345
  gr.Markdown("### Strategy 1 - QA-Based Prompting")
346
  strategy1 = gr.Markdown("S1", visible=False)