sperfu commited on
Commit
b12ac93
·
verified ·
1 Parent(s): 79a4888

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +107 -9
README.md CHANGED
@@ -12,21 +12,119 @@ base_model: meta-llama/Llama-2-7b-chat-hf
12
  instance_prompt: null
13
  license: mit
14
  ---
15
- # Llama-2-7b-chinese-chat
 
 
 
 
 
 
 
 
16
 
17
- <Gallery />
18
 
19
- ## Model description
20
 
21
- This model is designed to answer ophthalmology-related questions using domain-specific knowledge. It is based on a large language model architectureLlama-2-7b-chat-hf and fine-tuned on expert-curated question-answer (QA) pairs covering eye diseases such as glaucoma, cataracts, and retinal disorders.
22
 
23
- The model supports both direct question answering and retrieval-augmented generation (RAG). In RAG mode, the model first retrieves relevant knowledge snippets from a structured ophthalmic knowledge base and then generates a medically accurate answer grounded in those facts.
24
 
25
- Role-specific prompts (e.g., “as a doctor” or “as a patient”) are also used to control the communication style and adapt the response tone accordingly. The model aims to support medical professionals and patients in understanding, explaining, or verifying ophthalmic conditions.
 
26
 
 
27
 
28
- ## Download model
29
 
30
- Weights for this model are available in Safetensors,PyTorch format.
31
 
32
- [Download](/AI4Bread/Eyedoctor/tree/main) them in the Files & versions tab.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  instance_prompt: null
13
  license: mit
14
  ---
15
+ <div align="center">
16
+ <h1>
17
+ EyeDoc
18
+ </h1>
19
+ <h2>ophthalmic consultation foundation model</h2>
20
+ </div>
21
+ <p align="center">
22
+ 📝 <a href="https://arxiv.org/" target="_blank">Paper</a> • 🤗 <a href="https://huggingface.co/" target="_blank">Hugging Face</a> • 🧩 <a href="https://github.com/sperfu/EyeDoc" target="_blank">Github</a>
23
+ </p>
24
 
 
25
 
 
26
 
 
27
 
28
+ ## Recent News
29
 
30
+ - [6/21/2024] We have upgraded a web-based interface for users to use.
31
+ - [2/18/2024] The first version of the model was released.
32
 
33
+ ## ⚡ Introduction
34
 
35
+ EyeDoc is the first open-source large language model focused on ophthalmic diseases. Our goal in developing EyeDoc is to create a more specialized large language model for the specific medical consultation scenario of ophthalmic diseases. Overall, compared to other medical large language models, our contributions are as follows:
36
 
37
+ 1. We have collected over 40,000 single-turn QA dialogues and nearly 9,000 multi-turn dialogues related to ophthalmic diseases. To standardize the multi-turn dialogue data, we used **gpt-3.5-turbo** for data cleaning.
38
 
39
+ 2. We have gathered knowledge information on 519 common ophthalmic diseases and constructed a specialized knowledge base for auxiliary diagnosis of ophthalmic diseases.
40
+
41
+ 3. We have fully considered the knowledge differences and language characteristics of doctors and patients during consultations, and based on this, we separately represented the features for doctors and patients.
42
+
43
+ ![Model Pipeline](assets/img/eye_main.jpg)
44
+
45
+
46
+ ## 🤖 Installation
47
+
48
+ Use conda to create a new virtual environment with Python 3.9.0. Run the following command:
49
+
50
+ ```
51
+ git clone https://github.com/sperfu/EyeDoc
52
+ conda create --name EyeDoc python=3.9.0
53
+ conda activate EyeDoc
54
+ pip install -r requirements.txt
55
+
56
+ <!-- ```
57
+ python==3.9.0
58
+ torch==2.1.2
59
+ transformers==4.35.2
60
+ peft==0.7.1
61
+ accelerate==0.25.0
62
+ bitsandbytes==0.42.0
63
+ rouge_chinese
64
+ nltk
65
+ ``` -->
66
+
67
+ ## 💭 Preparation
68
+
69
+ EyeDoc is fine-tuned based on a large language model. Before training, please configure or download the base large language model.
70
+
71
+ | Parameter Scale | Large Language Model Name |
72
+ | ----------------| --------------------------------------------------------------|
73
+ | 1B | [TinyLlama](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0) |
74
+ | 3B | [bloom-zh-3b-chat](https://huggingface.co/ikala/bloom-zh-3b-chat) |
75
+ | 7B | [Llama-2-7b-chat-hf](https://huggingface.co/meta-llama/Llama-2-7b-chat-hf) |
76
+
77
+ ## ⚒️ Training
78
+
79
+ ### 1. QA Training
80
+
81
+ ```python
82
+ python A_train.py
83
+ # For more model hyperparameter adjustments, see the main function
84
+ ```
85
+
86
+
87
+ ### 2. Multi-turn Training
88
+
89
+ ```python
90
+ python A_train_doc_specific.py
91
+ # For more model hyperparameter adjustments, see the main function
92
+ ```
93
+
94
+ ## 🧐 Evaluation
95
+
96
+ ```python
97
+ python A_evaluate.py
98
+ # For more model hyperparameter adjustments, see the main function
99
+ ```
100
+
101
+ ## 🚀 Generate
102
+
103
+ ```
104
+ python A_generate.py # # Model response generation
105
+ python A_Flask_web.py # Model API interface call
106
+ ```
107
+
108
+ ## 🌐 Deployment
109
+
110
+ To deploy the EyeDoc model using Streamlit, follow these steps:
111
+
112
+ ### 1. Install the required environment
113
+
114
+ First, ensure you have Python installed (preferably Python 3.9) and a GPU with at least 48GB VRAM for optimal performance. Then, install Streamlit and other necessary packages:
115
+
116
+ ```bash
117
+ pip install streamlit
118
+ pip install -r requirements.txt # Ensure all dependencies listed in the requirements file are installed
119
+ ```
120
+
121
+ ### 2. Start the Streamlit service
122
+
123
+ Run the Streamlit application using the following command:
124
+
125
+ ```bash
126
+ streamlit run st_chat_login.py
127
+ ```
128
+ ### 2. Start the Streamlit service
129
+
130
+ This will start the Streamlit service, and you can access the web interface through the provided local URL (e.g., http://localhost:8501).