first commit read_me
Browse files
README.md
CHANGED
@@ -1,3 +1,73 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
license_link: https://huggingface.co/microsoft/phi-2/resolve/main/LICENSE
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
tags:
|
8 |
+
- nlp
|
9 |
+
- Medicine
|
10 |
+
datasets:
|
11 |
+
- medalpaca/medical_meadow_health_advice
|
12 |
+
- medalpaca/medical_meadow_mediqa
|
13 |
+
- medalpaca/medical_meadow_mmmlu
|
14 |
+
- medalpaca/medical_meadow_medical_flashcards
|
15 |
+
- medalpaca/medical_meadow_wikidoc_patient_information
|
16 |
+
- medalpaca/medical_meadow_wikidoc
|
17 |
+
- medalpaca/medical_meadow_pubmed_causal
|
18 |
+
- medalpaca/medical_meadow_medqa
|
19 |
+
- medalpaca/medical_meadow_cord19
|
20 |
+
base_model: microsoft/phi-2
|
21 |
+
|
22 |
+
---
|
23 |
+
|
24 |
+
## Model Summary
|
25 |
+
Phi2_med_seg is a fine-tuned version of the Phi-2 model, specifically optimized for medical applications. This model has been trained using the Trainer framework on several different datasets from the MedAlpaca collection, which focuses on medical question answering and conversational AI.
|
26 |
+
This model can answer information about different excplicit ideas in medicine
|
27 |
+
|
28 |
+
|
29 |
+
## How to Get Started with the Model
|
30 |
+
|
31 |
+
|
32 |
+
## Sample Code
|
33 |
+
|
34 |
+
|
35 |
+
```python
|
36 |
+
import torch
|
37 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
38 |
+
|
39 |
+
torch.set_default_device("cuda")
|
40 |
+
|
41 |
+
model = AutoModelForCausalLM.from_pretrained("segestic/phi2_medical_seg", torch_dtype="auto", trust_remote_code=True)
|
42 |
+
tokenizer = AutoTokenizer.from_pretrained("segestic/phi2_medical_seg", trust_remote_code=True)
|
43 |
+
|
44 |
+
inputs = tokenizer('''def print_prime(n):
|
45 |
+
"""
|
46 |
+
What is Medcine?
|
47 |
+
"""''', return_tensors="pt", return_attention_mask=False)
|
48 |
+
|
49 |
+
outputs = model.generate(**inputs, max_length=200)
|
50 |
+
text = tokenizer.batch_decode(outputs)[0]
|
51 |
+
print(text)
|
52 |
+
```
|
53 |
+
|
54 |
+
|
55 |
+
## Training
|
56 |
+
The fine-tuning process involved leveraging various medical datasets to enhance the model's ability to understand and generate relevant medical information. This approach aims to improve the model's performance in medical contexts, making it a valuable tool for healthcare professionals and researchers alike. By utilizing the Trainer framework, Phi2_med_seg benefits from advanced training techniques that help refine its responses and accuracy in medical scenarios.
|
57 |
+
|
58 |
+
### Model
|
59 |
+
|
60 |
+
* Architecture: a Transformer-based model with next-word prediction objective
|
61 |
+
|
62 |
+
* Context length: 2048 tokens
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
+
### Software
|
67 |
+
|
68 |
+
* [PyTorch](https://github.com/pytorch/pytorch)
|
69 |
+
|
70 |
+
* [DeepSpeed](https://github.com/microsoft/DeepSpeed)
|
71 |
+
|
72 |
+
* [Flash-Attention](https://github.com/HazyResearch/flash-attention)
|
73 |
+
|