dar-tau commited on
Commit
fe6d32c
·
verified ·
1 Parent(s): a79dee8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -12,7 +12,10 @@ from interpret import InterpretationPrompt
12
  MAX_PROMPT_TOKENS = 30
13
 
14
  ## info
15
- dataset_info = [{'name': 'Commonsense', 'hf_repo': 'tau/commonsense_qa', 'text_col': 'question'}]
 
 
 
16
 
17
 
18
 
@@ -198,13 +201,15 @@ with gr.Blocks(theme=gr.themes.Default(), css=css) as demo:
198
  interpretation_prompt = gr.Text(suggested_interpretation_prompts[0], label='Interpretation Prompt')
199
 
200
  gr.Markdown('''
201
- Here are some examples of prompts we can analyze their internal representations
202
  ''')
203
 
204
  for info in dataset_info:
205
  with gr.Tab(info['name']):
206
  num_examples = 10
207
  dataset = load_dataset(info['hf_repo'], split='train', streaming=True)
 
 
208
  dataset = dataset.shuffle(buffer_size=2000).take(num_examples)
209
  dataset = [[row[info['text_col']]] for row in dataset]
210
  gr.Examples(dataset, [original_prompt_raw])
 
12
  MAX_PROMPT_TOKENS = 30
13
 
14
  ## info
15
+ dataset_info = [{'name': 'Commonsense', 'hf_repo': 'tau/commonsense_qa', 'text_col': 'question'},
16
+ {'name': 'Fact Recall', 'hf_repo': 'azhx/counterfact-filtered-gptj6b', 'text_col': 'subject+predicate',
17
+ 'filter': lambda x: x['label'] == 1},
18
+ ]
19
 
20
 
21
 
 
201
  interpretation_prompt = gr.Text(suggested_interpretation_prompts[0], label='Interpretation Prompt')
202
 
203
  gr.Markdown('''
204
+ Here are some examples of prompts we can analyze their internal representations:
205
  ''')
206
 
207
  for info in dataset_info:
208
  with gr.Tab(info['name']):
209
  num_examples = 10
210
  dataset = load_dataset(info['hf_repo'], split='train', streaming=True)
211
+ if 'filter' in info:
212
+ dataset = dataset.filter(info['filter'])
213
  dataset = dataset.shuffle(buffer_size=2000).take(num_examples)
214
  dataset = [[row[info['text_col']]] for row in dataset]
215
  gr.Examples(dataset, [original_prompt_raw])