RamAnanth1 commited on
Commit
b2b46dc
·
1 Parent(s): 52f5395

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -40,8 +40,9 @@ def process(model_A, model_B):
40
  input_text = "POST: "+ prompt+ "\n\n RESPONSE A: "+response_A+"\n\n RESPONSE B: "+response_B+"\n\n Which response is better? RESPONSE"
41
  x = tokenizer([input_text], return_tensors='pt').input_ids.to(device)
42
  y = model.generate(x, max_new_tokens=1)
43
- prefered = tokenizer.batch_decode(y, skip_special_tokens=True)[0]
44
- return prompt,df[df['model'].isin([model_A, model_B])], prefered
 
45
 
46
  title = "Compare Instruction Models to see which one is more helpful"
47
  description = "This app compares the outputs of various open-source, instruction-trained models from a [dataset](https://huggingface.co/datasets/{OUTPUTS_DATASET}) of human demonstrations using a reward model trained on the [Stanford Human Preferences Dataset (SHP)](https://huggingface.co/datasets/stanfordnlp/SHP)"
 
40
  input_text = "POST: "+ prompt+ "\n\n RESPONSE A: "+response_A+"\n\n RESPONSE B: "+response_B+"\n\n Which response is better? RESPONSE"
41
  x = tokenizer([input_text], return_tensors='pt').input_ids.to(device)
42
  y = model.generate(x, max_new_tokens=1)
43
+ prefered = tokenizer.batch_decode(y, skip_special_tokens=True)[0]
44
+ result = model_A if prefered == 'A' else model_B
45
+ return prompt,df[df['model'].isin([model_A, model_B])], result
46
 
47
  title = "Compare Instruction Models to see which one is more helpful"
48
  description = "This app compares the outputs of various open-source, instruction-trained models from a [dataset](https://huggingface.co/datasets/{OUTPUTS_DATASET}) of human demonstrations using a reward model trained on the [Stanford Human Preferences Dataset (SHP)](https://huggingface.co/datasets/stanfordnlp/SHP)"