TheBloke commited on
Commit
0b9bfd1
1 Parent(s): 12190f7

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +226 -92
README.md CHANGED
@@ -1,13 +1,31 @@
1
  ---
2
- license: cc
 
3
  language:
4
  - en
5
  library_name: transformers
 
 
 
 
6
  pipeline_tag: text-generation
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  tags:
8
  - medical
9
- inference: false
10
  ---
 
11
  <!-- header start -->
12
  <!-- 200823 -->
13
  <div style="width: auto; margin-left: auto; margin-right: auto">
@@ -25,86 +43,197 @@ inference: false
25
  <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
26
  <!-- header end -->
27
 
28
- # medalpaca-13B GPTQ 4bit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
- This is a [GPTQ-for-LLaMa](https://github.com/qwopqwop200/GPTQ-for-LLaMa) 4bit quantisation of [medalpaca-13b](https://huggingface.co/medalpaca/medalpaca-13b).
 
 
 
 
 
 
31
 
32
- ## GIBBERISH OUTPUT IN `text-generation-webui`?
33
 
34
- Please read the Provided Files section below. You should use `medalpaca-13B-GPTQ-4bit-128g.no-act-order.safetensors` unless you are able to use the latest Triton branch of GPTQ-for-LLaMa.
 
 
35
 
36
- ## How to easily download and use this model in text-generation-webui
37
 
38
- Open the text-generation-webui UI as normal.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  1. Click the **Model tab**.
41
- 2. Under **Download custom model or LoRA**, enter `TheBloke/medalpaca-13B-GPTQ-4bit`.
 
 
42
  3. Click **Download**.
43
- 4. Wait until it says it's finished downloading.
44
- 5. Click the **Refresh** icon next to **Model** in the top left.
45
- 6. In the **Model drop-down**: choose the model you just downloaded,`medalpaca-13B-GPTQ-4bit`.
46
- 7. If you see an error in the bottom right, ignore it - it's temporary.
47
- 8. Fill out the `GPTQ parameters` on the right: `Bits = 4`, `Groupsize = 128`, `model_type = Llama`
48
- 9. Click **Save settings for this model** in the top right.
49
- 10. Click **Reload the Model** in the top right.
50
- 11. Once it says it's loaded, click the **Text Generation tab** and enter a prompt!
51
-
52
- ## Provided files
53
-
54
- Two files are provided. **The second file will not work unless you use a recent version of the Triton branch of GPTQ-for-LLaMa**
55
-
56
- Specifically, the second file uses `--act-order` for maximum quantisation quality and will not work with oobabooga's fork of GPTQ-for-LLaMa. Therefore at this time it will also not work with the CUDA branch of GPTQ-for-LLaMa, or `text-generation-webui` one-click installers.
57
-
58
- Unless you are able to use the latest GPTQ-for-LLaMa code, please use `medalpaca-13B-GPTQ-4bit-128g.no-act-order.safetensors`
59
-
60
- * `medalpaca-13B-GPTQ-4bit-128g.no-act-order.safetensors`
61
- * Works with all versions of GPTQ-for-LLaMa code, both Triton and CUDA branches
62
- * Works with text-generation-webui one-click-installers
63
- * Works on Windows
64
- * Parameters: Groupsize = 128g. No act-order.
65
- * Command used to create the GPTQ:
66
- ```
67
- CUDA_VISIBLE_DEVICES=0 python3 llama.py medalpaca-13b c4 --wbits 4 --true-sequential --groupsize 128 --save_safetensors medalpaca-13B-GPTQ-4bit-128g.no-act-order.safetensors
68
- ```
69
- * `medalpaca-13B-GPTQ-4bit-128g.safetensors`
70
- * Only works with the latest Triton branch of GPTQ-for-LLaMa
71
- * **Does not** work with text-generation-webui one-click-installers
72
- * **Does not** work on Windows
73
- * Parameters: Groupsize = 128g. act-order.
74
- * Offers highest quality quantisation, but requires recent GPTQ-for-LLaMa code
75
- * Command used to create the GPTQ:
76
- ```
77
- CUDA_VISIBLE_DEVICES=0 python3 llama.py medalpaca-13b c4 --wbits 4 --true-sequential --act-order --groupsize 128 --save_safetensors medalpaca-13B-GPTQ-4bit-128g.safetensors
78
- ```
79
-
80
- ## How to run in `text-generation-webui`
81
-
82
- File `medalpaca-13B-GPTQ-4bit-128g.no-act-order.safetensors` can be loaded the same as any other GPTQ file, without requiring any updates to [oobaboogas text-generation-webui](https://github.com/oobabooga/text-generation-webui).
83
-
84
- [Instructions on using GPTQ 4bit files in text-generation-webui are here](https://github.com/oobabooga/text-generation-webui/wiki/GPTQ-models-\(4-bit-mode\)).
85
-
86
- The other `safetensors` model file was created with the latest GPTQ code, and uses `--act-order` to give the maximum possible quantisation quality, but this means it requires that the latest GPTQ-for-LLaMa is used inside the UI.
87
-
88
- If you want to use the act-order `safetensors` file and need to update the Triton branch of GPTQ-for-LLaMa, here are the commands I used to clone the Triton branch of GPTQ-for-LLaMa, clone text-generation-webui, and install GPTQ into the UI:
89
  ```
90
- # Clone text-generation-webui, if you don't already have it
91
- git clone https://github.com/oobabooga/text-generation-webui
92
- # Make a repositories directory
93
- mkdir text-generation-webui/repositories
94
- cd text-generation-webui/repositories
95
- # Clone the latest GPTQ-for-LLaMa code inside text-generation-webui
96
- git clone https://github.com/qwopqwop200/GPTQ-for-LLaMa
 
97
  ```
98
 
99
- Then install this model into `text-generation-webui/models` and launch the UI as follows:
 
 
 
 
 
100
  ```
101
- cd text-generation-webui
102
- python server.py --model medalpaca-13B-GPTQ-4bit --wbits 4 --groupsize 128 --model_type Llama # add any other command line args you want
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  ```
 
 
 
 
 
 
104
 
105
- The above commands assume you have installed all dependencies for GPTQ-for-LLaMa and text-generation-webui. Please see their respective repositories for further information.
106
 
107
- If you can't update GPTQ-for-LLaMa to the latest Triton branch, or don't want to, you can use `medalpaca-13B-GPTQ-4bit-128g.no-act-order.safetensors` as mentioned above, which should work without any upgrades to text-generation-webui.
 
108
 
109
  <!-- footer start -->
110
  <!-- 200823 -->
@@ -114,10 +243,12 @@ For further support, and discussions on these models and AI in general, join us
114
 
115
  [TheBloke AI's Discord server](https://discord.gg/theblokeai)
116
 
117
- ## Thanks, and how to contribute.
118
 
119
  Thanks to the [chirper.ai](https://chirper.ai) team!
120
 
 
 
121
  I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
122
 
123
  If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
@@ -129,7 +260,7 @@ Donaters will get priority support on any and all AI/LLM/model questions and req
129
 
130
  **Special thanks to**: Aemon Algiz.
131
 
132
- **Patreon special mentions**: Sam, theTransient, Jonathan Leane, Steven Wood, webtim, Johann-Peter Hartmann, Geoffrey Montalvo, Gabriel Tamborski, Willem Michiel, John Villwock, Derek Yates, Mesiah Bishop, Eugene Pentland, Pieter, Chadd, Stephen Murray, Daniel P. Andersen, terasurfer, Brandon Frisco, Thomas Belote, Sid, Nathan LeClaire, Magnesian, Alps Aficionado, Stanislav Ovsiannikov, Alex, Joseph William Delisle, Nikolai Manek, Michael Davis, Junyu Yang, K, J, Spencer Kim, Stefan Sabev, Olusegun Samson, transmissions 11, Michael Levine, Cory Kujawski, Rainer Wilmers, zynix, Kalila, Luke @flexchar, Ajan Kanaga, Mandus, vamX, Ai Maven, Mano Prime, Matthew Berman, subjectnull, Vitor Caleffi, Clay Pascal, biorpg, alfie_i, 阿明, Jeffrey Morgan, ya boyyy, Raymond Fosdick, knownsqashed, Olakabola, Leonard Tan, ReadyPlayerEmma, Enrico Ros, Dave, Talal Aujan, Illia Dulskyi, Sean Connelly, senxiiz, Artur Olbinski, Elle, Raven Klaugh, Fen Risland, Deep Realms, Imad Khwaja, Fred von Graf, Will Dee, usrbinkat, SuperWojo, Alexandros Triantafyllidis, Swaroop Kallakuri, Dan Guido, John Detwiler, Pedro Madruga, Iucharbius, Viktor Bowallius, Asp the Wyvern, Edmond Seymore, Trenton Dambrowitz, Space Cruiser, Spiking Neurons AB, Pyrater, LangChain4j, Tony Hughes, Kacper Wikieł, Rishabh Srivastava, David Ziegler, Luke Pendergrass, Andrey, Gabriel Puliatti, Lone Striker, Sebastain Graf, Pierre Kircher, Randy H, NimbleBox.ai, Vadim, danny, Deo Leter
133
 
134
 
135
  Thank you to all my generous patrons and donaters!
@@ -137,35 +268,38 @@ Thank you to all my generous patrons and donaters!
137
  And thank you again to a16z for their generous grant.
138
 
139
  <!-- footer end -->
140
- # Original model card: MedAlpaca 13b
 
 
 
141
 
142
 
143
  ## Table of Contents
144
 
145
- [Model Description](#model-description)
146
- - [Architecture](#architecture)
147
- - [Training Data](#trainig-data)
148
- [Model Usage](#model-usage)
149
- [Limitations](#limitations)
150
 
151
  ## Model Description
152
  ### Architecture
153
- `medalpaca-13b` is a large language model specifically fine-tuned for medical domain tasks.
154
- It is based on LLaMA (Large Language Model Meta AI) and contains 13 billion parameters.
155
  The primary goal of this model is to improve question-answering and medical dialogue tasks.
156
 
157
  ### Training Data
158
- The training data for this project was sourced from various resources.
159
- Firstly, we used Anki flashcards to automatically generate questions,
160
- from the front of the cards and anwers from the back of the card.
161
- Secondly, we generated medical question-answer pairs from [Wikidoc](https://www.wikidoc.org/index.php/Main_Page).
162
- We extracted paragraphs with relevant headings, and used Chat-GPT 3.5
163
- to generate questions from the headings and using the corresponding paragraphs
164
- as answers. This dataset is still under development and we believe
165
- that approximately 70% of these question answer pairs are factual correct.
166
- Thirdly, we used StackExchange to extract question-answer pairs, taking the
167
- top-rated question from five categories: Academia, Bioinformatics, Biology,
168
- Fitness, and Health. Additionally, we used a dataset from [ChatDoctor](https://arxiv.org/abs/2303.14070)
169
  consisting of 200,000 question-answer pairs, available at https://github.com/Kent0n-Li/ChatDoctor.
170
 
171
  | Source | n items |
@@ -190,16 +324,16 @@ You can use the model for inference tasks like question-answering and medical di
190
 
191
  from transformers import pipeline
192
 
193
- qa_pipeline = pipeline("question-answering", model="medalpaca/medalpaca-7b", tokenizer="medalpaca/medalpaca-7b")
194
  question = "What are the symptoms of diabetes?"
195
  context = "Diabetes is a metabolic disease that causes high blood sugar. The symptoms include increased thirst, frequent urination, and unexplained weight loss."
196
- answer = qa_pipeline({"question": question, "context": context})
197
  print(answer)
198
  ```
199
 
200
  ## Limitations
201
  The model may not perform effectively outside the scope of the medical domain.
202
- The training data primarily targets the knowledge level of medical students,
203
  which may result in limitations when addressing the needs of board-certified physicians.
204
- The model has not been tested in real-world applications, so its efficacy and accuracy are currently unknown.
205
  It should never be used as a substitute for a doctor's opinion and must be treated as a research tool only.
 
1
  ---
2
+ base_model: https://huggingface.co/medalpaca/medalpaca-13b
3
+ inference: false
4
  language:
5
  - en
6
  library_name: transformers
7
+ license: cc
8
+ model_creator: medalpaca
9
+ model_name: Medalpaca 13B
10
+ model_type: llama
11
  pipeline_tag: text-generation
12
+ prompt_template: 'Below is an instruction that describes a task. Write a response
13
+ that appropriately completes the request.
14
+
15
+
16
+ ### Instruction:
17
+
18
+ {prompt}
19
+
20
+
21
+ ### Response:
22
+
23
+ '
24
+ quantized_by: TheBloke
25
  tags:
26
  - medical
 
27
  ---
28
+
29
  <!-- header start -->
30
  <!-- 200823 -->
31
  <div style="width: auto; margin-left: auto; margin-right: auto">
 
43
  <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
44
  <!-- header end -->
45
 
46
+ # Medalpaca 13B - GPTQ
47
+ - Model creator: [medalpaca](https://huggingface.co/medalpaca)
48
+ - Original model: [Medalpaca 13B](https://huggingface.co/medalpaca/medalpaca-13b)
49
+
50
+ <!-- description start -->
51
+ ## Description
52
+
53
+ This repo contains GPTQ model files for [medalpaca's Medalpaca 13B](https://huggingface.co/medalpaca/medalpaca-13b).
54
+
55
+ Multiple GPTQ parameter permutations are provided; see Provided Files below for details of the options provided, their parameters, and the software used to create them.
56
+
57
+ <!-- description end -->
58
+ <!-- repositories-available start -->
59
+ ## Repositories available
60
+
61
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/medalpaca-13B-AWQ)
62
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/medalpaca-13B-GPTQ)
63
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/medalpaca-13B-GGUF)
64
+ * [medalpaca's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/medalpaca/medalpaca-13b)
65
+ <!-- repositories-available end -->
66
+
67
+ <!-- prompt-template start -->
68
+ ## Prompt template: Alpaca
69
+
70
+ ```
71
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
72
+
73
+ ### Instruction:
74
+ {prompt}
75
+
76
+ ### Response:
77
+
78
+ ```
79
+
80
+ <!-- prompt-template end -->
81
+ <!-- licensing start -->
82
+ ## Licensing
83
+
84
+ The creator of the source model has listed its license as `cc`, and this quantization has therefore used that same license.
85
+
86
+ As this model is based on Llama 2, it is also subject to the Meta Llama 2 license terms, and the license files for that are additionally included. It should therefore be considered as being claimed to be licensed under both licenses. I contacted Hugging Face for clarification on dual licensing but they do not yet have an official position. Should this change, or should Meta provide any feedback on this situation, I will update this section accordingly.
87
+
88
+ In the meantime, any questions regarding licensing, and in particular how these two licenses might interact, should be directed to the original model repository: [medalpaca's Medalpaca 13B](https://huggingface.co/medalpaca/medalpaca-13b).
89
+ <!-- licensing end -->
90
+ <!-- README_GPTQ.md-provided-files start -->
91
+ ## Provided files and GPTQ parameters
92
+
93
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
94
+
95
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
96
+
97
+ All recent GPTQ files are made with AutoGPTQ, and all files in non-main branches are made with AutoGPTQ. Files in the `main` branch which were uploaded before August 2023 were made with GPTQ-for-LLaMa.
98
+
99
+ <details>
100
+ <summary>Explanation of GPTQ parameters</summary>
101
 
102
+ - Bits: The bit size of the quantised model.
103
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
104
+ - Act Order: True or False. Also known as `desc_act`. True results in better quantisation accuracy. Some GPTQ clients have had issues with models that use Act Order plus Group Size, but this is generally resolved now.
105
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
106
+ - GPTQ dataset: The dataset used for quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ dataset is not the same as the dataset used to train the model - please refer to the original model repo for details of the training dataset(s).
107
+ - Sequence Length: The length of the dataset sequences used for quantisation. Ideally this is the same as the model sequence length. For some very long sequence models (16+K), a lower sequence length may have to be used. Note that a lower sequence length does not limit the sequence length of the quantised model. It only impacts the quantisation accuracy on longer inference sequences.
108
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
109
 
110
+ </details>
111
 
112
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
113
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
114
+ | [main](https://huggingface.co/TheBloke/medalpaca-13B-GPTQ/tree/main) | 4 | 128 | No | 0.01 | [c4](https://huggingface.co/datasets/allenai/c4) | 2048 | 7.26 GB | Yes | 4-bit, without Act Order and group size 128g. |
115
 
116
+ <!-- README_GPTQ.md-provided-files end -->
117
 
118
+ <!-- README_GPTQ.md-download-from-branches start -->
119
+ ## How to download from branches
120
+
121
+ - In text-generation-webui, you can add `:branch` to the end of the download name, eg `TheBloke/medalpaca-13B-GPTQ:main`
122
+ - With Git, you can clone a branch with:
123
+ ```
124
+ git clone --single-branch --branch main https://huggingface.co/TheBloke/medalpaca-13B-GPTQ
125
+ ```
126
+ - In Python Transformers code, the branch is the `revision` parameter; see below.
127
+ <!-- README_GPTQ.md-download-from-branches end -->
128
+ <!-- README_GPTQ.md-text-generation-webui start -->
129
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
130
+
131
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
132
+
133
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
134
 
135
  1. Click the **Model tab**.
136
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/medalpaca-13B-GPTQ`.
137
+ - To download from a specific branch, enter for example `TheBloke/medalpaca-13B-GPTQ:main`
138
+ - see Provided Files above for the list of branches for each option.
139
  3. Click **Download**.
140
+ 4. The model will start downloading. Once it's finished it will say "Done".
141
+ 5. In the top left, click the refresh icon next to **Model**.
142
+ 6. In the **Model** dropdown, choose the model you just downloaded: `medalpaca-13B-GPTQ`
143
+ 7. The model will automatically load, and is now ready for use!
144
+ 8. If you want any custom settings, set them and then click **Save settings for this model** followed by **Reload the Model** in the top right.
145
+ * Note that you do not need to and should not set manual GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
146
+ 9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
147
+ <!-- README_GPTQ.md-text-generation-webui end -->
148
+
149
+ <!-- README_GPTQ.md-use-from-python start -->
150
+ ## How to use this GPTQ model from Python code
151
+
152
+ ### Install the necessary packages
153
+
154
+ Requires: Transformers 4.32.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
155
+
156
+ ```shell
157
+ pip3 install transformers>=4.32.0 optimum>=1.12.0
158
+ pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  ```
160
+
161
+ If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
162
+
163
+ ```shell
164
+ pip3 uninstall -y auto-gptq
165
+ git clone https://github.com/PanQiWei/AutoGPTQ
166
+ cd AutoGPTQ
167
+ pip3 install .
168
  ```
169
 
170
+ ### For CodeLlama models only: you must use Transformers 4.33.0 or later.
171
+
172
+ If 4.33.0 is not yet released when you read this, you will need to install Transformers from source:
173
+ ```shell
174
+ pip3 uninstall -y transformers
175
+ pip3 install git+https://github.com/huggingface/transformers.git
176
  ```
177
+
178
+ ### You can then use the following code
179
+
180
+ ```python
181
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
182
+
183
+ model_name_or_path = "TheBloke/medalpaca-13B-GPTQ"
184
+ # To use a different branch, change revision
185
+ # For example: revision="main"
186
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
187
+ device_map="auto",
188
+ trust_remote_code=False,
189
+ revision="main")
190
+
191
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
192
+
193
+ prompt = "Tell me about AI"
194
+ prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
195
+
196
+ ### Instruction:
197
+ {prompt}
198
+
199
+ ### Response:
200
+
201
+ '''
202
+
203
+ print("\n\n*** Generate:")
204
+
205
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
206
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
207
+ print(tokenizer.decode(output[0]))
208
+
209
+ # Inference can also be done using transformers' pipeline
210
+
211
+ print("*** Pipeline:")
212
+ pipe = pipeline(
213
+ "text-generation",
214
+ model=model,
215
+ tokenizer=tokenizer,
216
+ max_new_tokens=512,
217
+ do_sample=True,
218
+ temperature=0.7,
219
+ top_p=0.95,
220
+ top_k=40,
221
+ repetition_penalty=1.1
222
+ )
223
+
224
+ print(pipe(prompt_template)[0]['generated_text'])
225
  ```
226
+ <!-- README_GPTQ.md-use-from-python end -->
227
+
228
+ <!-- README_GPTQ.md-compatibility start -->
229
+ ## Compatibility
230
+
231
+ The files provided are tested to work with AutoGPTQ, both via Transformers and using AutoGPTQ directly. They should also work with [Occ4m's GPTQ-for-LLaMa fork](https://github.com/0cc4m/KoboldAI).
232
 
233
+ [ExLlama](https://github.com/turboderp/exllama) is compatible with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
234
 
235
+ [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is compatible with all GPTQ models.
236
+ <!-- README_GPTQ.md-compatibility end -->
237
 
238
  <!-- footer start -->
239
  <!-- 200823 -->
 
243
 
244
  [TheBloke AI's Discord server](https://discord.gg/theblokeai)
245
 
246
+ ## Thanks, and how to contribute
247
 
248
  Thanks to the [chirper.ai](https://chirper.ai) team!
249
 
250
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
251
+
252
  I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
253
 
254
  If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
 
260
 
261
  **Special thanks to**: Aemon Algiz.
262
 
263
+ **Patreon special mentions**: Alicia Loh, Stephen Murray, K, Ajan Kanaga, RoA, Magnesian, Deo Leter, Olakabola, Eugene Pentland, zynix, Deep Realms, Raymond Fosdick, Elijah Stavena, Iucharbius, Erik Bjäreholt, Luis Javier Navarrete Lozano, Nicholas, theTransient, John Detwiler, alfie_i, knownsqashed, Mano Prime, Willem Michiel, Enrico Ros, LangChain4j, OG, Michael Dempsey, Pierre Kircher, Pedro Madruga, James Bentley, Thomas Belote, Luke @flexchar, Leonard Tan, Johann-Peter Hartmann, Illia Dulskyi, Fen Risland, Chadd, S_X, Jeff Scroggin, Ken Nordquist, Sean Connelly, Artur Olbinski, Swaroop Kallakuri, Jack West, Ai Maven, David Ziegler, Russ Johnson, transmissions 11, John Villwock, Alps Aficionado, Clay Pascal, Viktor Bowallius, Subspace Studios, Rainer Wilmers, Trenton Dambrowitz, vamX, Michael Levine, 준교 김, Brandon Frisco, Kalila, Trailburnt, Randy H, Talal Aujan, Nathan Dryer, Vadim, 阿明, ReadyPlayerEmma, Tiffany J. Kim, George Stoitzev, Spencer Kim, Jerry Meng, Gabriel Tamborski, Cory Kujawski, Jeffrey Morgan, Spiking Neurons AB, Edmond Seymore, Alexandros Triantafyllidis, Lone Striker, Cap'n Zoog, Nikolai Manek, danny, ya boyyy, Derek Yates, usrbinkat, Mandus, TL, Nathan LeClaire, subjectnull, Imad Khwaja, webtim, Raven Klaugh, Asp the Wyvern, Gabriel Puliatti, Caitlyn Gatomon, Joseph William Delisle, Jonathan Leane, Luke Pendergrass, SuperWojo, Sebastain Graf, Will Dee, Fred von Graf, Andrey, Dan Guido, Daniel P. Andersen, Nitin Borwankar, Elle, Vitor Caleffi, biorpg, jjj, NimbleBox.ai, Pieter, Matthew Berman, terasurfer, Michael Davis, Alex, Stanislav Ovsiannikov
264
 
265
 
266
  Thank you to all my generous patrons and donaters!
 
268
  And thank you again to a16z for their generous grant.
269
 
270
  <!-- footer end -->
271
+
272
+ # Original model card: medalpaca's Medalpaca 13B
273
+
274
+ # MedAlpaca 13b
275
 
276
 
277
  ## Table of Contents
278
 
279
+ [Model Description](#model-description)
280
+ - [Architecture](#architecture)
281
+ - [Training Data](#trainig-data)
282
+ [Model Usage](#model-usage)
283
+ [Limitations](#limitations)
284
 
285
  ## Model Description
286
  ### Architecture
287
+ `medalpaca-13b` is a large language model specifically fine-tuned for medical domain tasks.
288
+ It is based on LLaMA (Large Language Model Meta AI) and contains 13 billion parameters.
289
  The primary goal of this model is to improve question-answering and medical dialogue tasks.
290
 
291
  ### Training Data
292
+ The training data for this project was sourced from various resources.
293
+ Firstly, we used Anki flashcards to automatically generate questions,
294
+ from the front of the cards and anwers from the back of the card.
295
+ Secondly, we generated medical question-answer pairs from [Wikidoc](https://www.wikidoc.org/index.php/Main_Page).
296
+ We extracted paragraphs with relevant headings, and used Chat-GPT 3.5
297
+ to generate questions from the headings and using the corresponding paragraphs
298
+ as answers. This dataset is still under development and we believe
299
+ that approximately 70% of these question answer pairs are factual correct.
300
+ Thirdly, we used StackExchange to extract question-answer pairs, taking the
301
+ top-rated question from five categories: Academia, Bioinformatics, Biology,
302
+ Fitness, and Health. Additionally, we used a dataset from [ChatDoctor](https://arxiv.org/abs/2303.14070)
303
  consisting of 200,000 question-answer pairs, available at https://github.com/Kent0n-Li/ChatDoctor.
304
 
305
  | Source | n items |
 
324
 
325
  from transformers import pipeline
326
 
327
+ pl = pipeline("text-generation", model="medalpaca/medalpaca-13b", tokenizer="medalpaca/medalpaca-13b")
328
  question = "What are the symptoms of diabetes?"
329
  context = "Diabetes is a metabolic disease that causes high blood sugar. The symptoms include increased thirst, frequent urination, and unexplained weight loss."
330
+ answer = pl(f"Context: {context}\n\nQuestion: {question}\n\nAnswer: ")
331
  print(answer)
332
  ```
333
 
334
  ## Limitations
335
  The model may not perform effectively outside the scope of the medical domain.
336
+ The training data primarily targets the knowledge level of medical students,
337
  which may result in limitations when addressing the needs of board-certified physicians.
338
+ The model has not been tested in real-world applications, so its efficacy and accuracy are currently unknown.
339
  It should never be used as a substitute for a doctor's opinion and must be treated as a research tool only.