nmitchko commited on
Commit
7f8a63b
1 Parent(s): f179a48

Initial Commit

Browse files
README.md CHANGED
@@ -1,3 +1,87 @@
1
  ---
2
  license: cc
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: cc
3
+ language:
4
+ - en
5
+ library_name: transformers
6
+ pipeline_tag: text-generation
7
+ tags:
8
+ - medical
9
  ---
10
+ # Medguanaco LoRA 33b 8bit
11
+
12
+
13
+ ## Table of Contents
14
+
15
+ [Model Description](#model-description)
16
+ - [Architecture](#architecture)
17
+ - [Training Data](#trainig-data)
18
+ [Model Usage](#model-usage)
19
+ [Limitations](#limitations)
20
+
21
+ ## Model Description
22
+ ### Architecture
23
+ `nmitchko/medguanaco-lora-33b-8bit` is a large language model LoRa specifically fine-tuned for medical domain tasks.
24
+ It is based on the Guanaco LORA of LLaMA weighing in at 33B parameters.
25
+ The primary goal of this model is to improve question-answering and medical dialogue tasks.
26
+ It was trained using [LoRA](https://arxiv.org/abs/2106.09685) and reduced to 8bit, to reduce memory footprint.
27
+
28
+ Steps to load this model:
29
+ 1. Load Guanaco-33b-merged https://huggingface.co/timdettmers/guanaco-33b-merged **in 8-bit**
30
+ * I recommend using text-generation-ui to test it out: https://github.com/oobabooga/text-generation-webui/tree/main
31
+ 2. Apply this LoRA to the model, this was trainied in 8-bit mode and results may vary in higher dimensions.
32
+
33
+
34
+ ```python
35
+ # Some llama or alpaca model 65b
36
+ base_model = "timdettmers/guanaco-33b-merged"
37
+ model = LlamaForCausalLM.from_pretrained(
38
+ base_model,
39
+ load_in_8bit=load_8bit,
40
+ torch_dtype=torch.float16
41
+ )
42
+ # Load the LORA on top
43
+ lora_weights = "nmitchko/medguanaco-lora-33b-8bit"
44
+ model = PeftModel.from_pretrained(
45
+ model,
46
+ lora_weights,
47
+ torch_dtype=torch.float16
48
+ )
49
+ ```
50
+
51
+ ---
52
+
53
+ > The following README is taken from the source page [medalpaca](https://huggingface.co/medalpaca/medalpaca-lora-13b-8bit)
54
+
55
+ ### Training Data
56
+ The training data for this project was sourced from various resources.
57
+ Firstly, we used Anki flashcards to automatically generate questions,
58
+ from the front of the cards and anwers from the back of the card.
59
+ Secondly, we generated medical question-answer pairs from [Wikidoc](https://www.wikidoc.org/index.php/Main_Page).
60
+ We extracted paragraphs with relevant headings, and used Chat-GPT 3.5
61
+ to generate questions from the headings and using the corresponding paragraphs
62
+ as answers. This dataset is still under development and we believe
63
+ that approximately 70% of these question answer pairs are factual correct.
64
+ Thirdly, we used StackExchange to extract question-answer pairs, taking the
65
+ top-rated question from five categories: Academia, Bioinformatics, Biology,
66
+ Fitness, and Health. Additionally, we used a dataset from [ChatDoctor](https://arxiv.org/abs/2303.14070)
67
+ consisting of 200,000 question-answer pairs, available at https://github.com/Kent0n-Li/ChatDoctor.
68
+
69
+ | Source | n items |
70
+ |------------------------------|--------|
71
+ | ChatDoc large | 200000 |
72
+ | wikidoc | 67704 |
73
+ | Stackexchange academia | 40865 |
74
+ | Anki flashcards | 33955 |
75
+ | Stackexchange biology | 27887 |
76
+ | Stackexchange fitness | 9833 |
77
+ | Stackexchange health | 7721 |
78
+ | Wikidoc patient information | 5942 |
79
+ | Stackexchange bioinformatics | 5407 |
80
+
81
+
82
+ ## Limitations
83
+ The model may not perform effectively outside the scope of the medical domain.
84
+ The training data primarily targets the knowledge level of medical students,
85
+ which may result in limitations when addressing the needs of board-certified physicians.
86
+ The model has not been tested in real-world applications, so its efficacy and accuracy are currently unknown.
87
+ It should never be used as a substitute for a doctor's opinion and must be treated as a research tool only.
adapter_config.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "base_model_name_or_path": "models/timdettmers_guanaco-33b-merged",
3
+ "bias": "none",
4
+ "fan_in_fan_out": false,
5
+ "inference_mode": true,
6
+ "init_lora_weights": true,
7
+ "lora_alpha": 64,
8
+ "lora_dropout": 0.05,
9
+ "modules_to_save": null,
10
+ "peft_type": "LORA",
11
+ "r": 32,
12
+ "target_modules": [
13
+ "q_proj",
14
+ "v_proj"
15
+ ],
16
+ "task_type": "CAUSAL_LM"
17
+ }
adapter_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f71cefb236fb5a3e0037e473243fa21d7f02b7a6e113cea25528d8b155e34a13
3
+ size 204559498
training_parameters.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"lora_name": "medguanaco-33b-lora-8bit", "always_override": false, "save_steps": 0.0, "micro_batch_size": 1, "batch_size": 128, "epochs": 3.0, "learning_rate": "3e-4", "lr_scheduler_type": "linear", "lora_rank": 32, "lora_alpha": 64, "lora_dropout": 0.05, "cutoff_len": 256, "dataset": "medical_meadow_small", "eval_dataset": "None", "format": "alpaca-format", "eval_steps": 100.0, "raw_text_file": "None", "overlap_len": 128, "newline_favor_len": 128, "higher_rank_limit": false, "warmup_steps": 100.0, "optimizer": "adamw_torch", "hard_cut_string": "\\n\\n\\n", "train_only_after": ""}