YixuanWeng commited on
Commit ·
4f98676
1
Parent(s): f71ca3c
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
| 1 |
# MedCPT
|
| 2 |
|
| 3 |
-
### LingYi system pre training medical model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# MedCPT
|
| 2 |
|
| 3 |
+
### LingYi system pre training medical model
|
| 4 |
+
|
| 5 |
+
### Prease load the model from [**CPT**](https://huggingface.co/fnlp/cpt-large)
|
| 6 |
+
|
| 7 |
+
## Usage
|
| 8 |
+
|
| 9 |
+
```python
|
| 10 |
+
>>> from modeling_cpt import CPTForConditionalGeneration
|
| 11 |
+
>>> from transformers import BertTokenizer
|
| 12 |
+
>>> tokenizer = BertTokenizer.from_pretrained("WENGSYX/MedCPT")
|
| 13 |
+
>>> model = CPTForConditionalGeneration.from_pretrained("WENGSYX/MedCPT")
|
| 14 |
+
>>> inputs = tokenizer.encode("医生你好,腹泻难受应该怎么办?", return_tensors='pt')
|
| 15 |
+
>>> pred_ids = model.generate(input_ids, num_beams=4, max_length=20)
|
| 16 |
+
>>> print(tokenizer.convert_ids_to_tokens(pred_ids[i]))
|
| 17 |
+
```
|