Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
+
# BioHopR
|
| 5 |
+
|
| 6 |
+
[**Paper**]() |
|
| 7 |
+
|
| 8 |
+
## Description
|
| 9 |
+
|
| 10 |
+
We introduce BioHopR, a novel benchmark designed to evaluate multi-hop, multi-answer reasoning in structured biomedical knowledge graphs.
|
| 11 |
+
Built from the comprehensive PrimeKG, BioHopR includes 1-hop and 2-hop reasoning tasks that reflect real-world biomedical complexities.
|
| 12 |
+
|
| 13 |
+
## Prompt
|
| 14 |
+
We used the below to get the response of the open source LLMs.
|
| 15 |
+
```
|
| 16 |
+
def generate_single(model, tokenizer, question):
|
| 17 |
+
q="You are an expert biomedical researcher.\n"+question+"\nJust give me the answer without any explanations.\nAnswer:\n"
|
| 18 |
+
inputs = tokenizer(q, return_tensors="pt", return_attention_mask=False).to(DEVICE)
|
| 19 |
+
response = model.generate(**inputs,
|
| 20 |
+
do_sample=False,
|
| 21 |
+
temperature=0.0,
|
| 22 |
+
top_p=None,
|
| 23 |
+
num_beams=1,
|
| 24 |
+
no_repeat_ngram_size=3,
|
| 25 |
+
eos_token_id=tokenizer.eos_token_id, # End of sequence token
|
| 26 |
+
pad_token_id=tokenizer.eos_token_id, # Pad token
|
| 27 |
+
max_new_tokens=32,
|
| 28 |
+
)
|
| 29 |
+
output = tokenizer.decode(response.squeeze()[len(inputs['input_ids'][0]):], skip_special_tokens=True)
|
| 30 |
+
return output
|
| 31 |
+
|
| 32 |
+
def generate_multi(model, tokenizer, question):
|
| 33 |
+
q="You are an expert biomedical researcher.\n"+question+"\nJust give me the answers without any explanations in a bullet-pointed list.\nAnswer:\n"
|
| 34 |
+
inputs = tokenizer(q, return_tensors="pt", return_attention_mask=False).to(DEVICE)
|
| 35 |
+
response = model.generate(**inputs,
|
| 36 |
+
do_sample=False,
|
| 37 |
+
temperature=0.0,
|
| 38 |
+
top_p=None,
|
| 39 |
+
num_beams=1,
|
| 40 |
+
no_repeat_ngram_size=3,
|
| 41 |
+
eos_token_id=tokenizer.eos_token_id, # End of sequence token
|
| 42 |
+
pad_token_id=tokenizer.eos_token_id, # Pad token
|
| 43 |
+
max_new_tokens=256,
|
| 44 |
+
)
|
| 45 |
+
output = tokenizer.decode(response.squeeze()[len(inputs['input_ids'][0]):], skip_special_tokens=True)
|
| 46 |
+
return output
|
| 47 |
+
```
|