DongfuJiang commited on
Commit
508850f
·
1 Parent(s): 1dbdb66
Files changed (2) hide show
  1. app.py +9 -11
  2. requirements.txt +0 -1
app.py CHANGED
@@ -13,17 +13,15 @@ We present ***TIGERScore***, a **T**rained metric that follows **I**nstruction *
13
 
14
  """
15
 
16
- EXAMPLES_DATASET = load_dataset("TIGER-Lab/MetricInstruct", split="train")
17
  SHUFFLED_EXAMPLES_DATASET = EXAMPLES_DATASET.shuffle(seed=42)
18
  EXAMPLES = []
19
  fields = ["instruction", "input_context", "hypo_output"]
20
  print("Loading examples...")
21
- for i, ex in enumerate(SHUFFLED_EXAMPLES_DATASET):
22
- if any([not ex[field] for field in fields]):
23
- continue
24
  EXAMPLES.append([ex[field] for field in fields])
25
- if i >= 100:
26
- break
27
 
28
  scorer = TIGERScorer("TIGER-Lab/TIGERScore-7B-GGUF", use_llamacpp=True)
29
 
@@ -35,15 +33,15 @@ def submit_fn(input_context, generation_instruction, hypo_output, max_new_tokens
35
  max_new_tokens=max_new_tokens,
36
  temperature=temperature,
37
  top_p=top_p,
38
- )[0]['raw_output'].strip()
39
 
40
 
41
 
42
- def get_examples(task, inst_textbox, input_textbox, hypo_output_textbox):
43
- return gr.Dropdown.update(value=task), inst_textbox, input_textbox, hypo_output_textbox
44
 
45
- def clear_all(task, inst_textbox, input_textbox, hypo_output_textbox):
46
- return gr.Dropdown.update(value=task), "", "", ""
47
 
48
  with gr.Blocks(theme='gradio/soft') as demo:
49
 
 
13
 
14
  """
15
 
16
+ EXAMPLES_DATASET = load_dataset("TIGER-Lab/MetricInstruct", split="train", streaming=True)
17
  SHUFFLED_EXAMPLES_DATASET = EXAMPLES_DATASET.shuffle(seed=42)
18
  EXAMPLES = []
19
  fields = ["instruction", "input_context", "hypo_output"]
20
  print("Loading examples...")
21
+ for i, ex in enumerate(SHUFFLED_EXAMPLES_DATASET.take(100)):
22
+ # if any([not ex[field] for field in fields]):
23
+ # continue
24
  EXAMPLES.append([ex[field] for field in fields])
 
 
25
 
26
  scorer = TIGERScorer("TIGER-Lab/TIGERScore-7B-GGUF", use_llamacpp=True)
27
 
 
33
  max_new_tokens=max_new_tokens,
34
  temperature=temperature,
35
  top_p=top_p,
36
+ )[0]['raw_output'].strip()
37
 
38
 
39
 
40
+ def get_examples(inst_textbox, input_textbox, hypo_output_textbox):
41
+ return inst_textbox, input_textbox, hypo_output_textbox
42
 
43
+ def clear_all(inst_textbox, input_textbox, hypo_output_textbox):
44
+ return "", "", ""
45
 
46
  with gr.Blocks(theme='gradio/soft') as demo:
47
 
requirements.txt CHANGED
@@ -1,3 +1,2 @@
1
  git+https://github.com/TIGER-AI-Lab/TIGERScore.git
2
- transformers==4.33.2
3
  datasets==2.14.5
 
1
  git+https://github.com/TIGER-AI-Lab/TIGERScore.git
 
2
  datasets==2.14.5