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