Update README.md
Browse files
README.md
CHANGED
@@ -2,4 +2,33 @@
|
|
2 |
license: apache-2.0
|
3 |
tags:
|
4 |
- medical
|
5 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: apache-2.0
|
3 |
tags:
|
4 |
- medical
|
5 |
+
---
|
6 |
+
This repo contains PMC_LLAMA_7B, which is LLaMA-7b finetuned on the S2ORC(PMC_OA papers) dataset.
|
7 |
+
|
8 |
+
The model was trained with the following hyperparameters:
|
9 |
+
|
10 |
+
* Epochs: 5
|
11 |
+
* Batch size: 128
|
12 |
+
* Cutoff length: 512
|
13 |
+
* Learning rate: 2e-5
|
14 |
+
|
15 |
+
Each epoch we sample 512 tokens per paper for training.
|
16 |
+
|
17 |
+
The model can be loaded as following:
|
18 |
+
|
19 |
+
```
|
20 |
+
import transformers
|
21 |
+
tokenizer = transformers.LlamaTokenizer.from_pretrained('chaoyi-wu/PMC_LLAMA_7B')
|
22 |
+
model = transformers.LlamaForCausalLM.from_pretrained('chaoyi-wu/PMC_LLAMA_7B')
|
23 |
+
sentence = 'Hello, doctor'
|
24 |
+
batch = tokenizer(
|
25 |
+
sentence,
|
26 |
+
return_tensors="pt",
|
27 |
+
add_special_tokens=False
|
28 |
+
)
|
29 |
+
with torch.no_grad():
|
30 |
+
generated = model.generate(inputs = batch["input_ids"], max_length=200, do_sample=True, top_k=50)
|
31 |
+
print('model predict: ',tokenizer.decode(generated[0]))
|
32 |
+
```
|
33 |
+
|
34 |
+
|