zirui3 commited on
Commit
35adf36
1 Parent(s): 9567282

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +96 -4
README.md CHANGED
@@ -1,7 +1,99 @@
1
- # instruction-tuning on medical data base on LLaMA
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  # TODO
4
 
5
- - [x] self-instruct data(english + chinese)
6
- - [ ] medical data(english)
7
- - [ ] medical data(chinese)
 
 
 
 
 
 
 
1
+
2
+
3
+
4
+ # Model summary
5
+
6
+ * instruction-tuning on medical data based on LLaMA
7
+
8
+
9
+ # data
10
+
11
+ * Common
12
+ * alpaca-5.2k
13
+ * unatural-instruct 80k
14
+ * OIG-40M
15
+ * Chinese
16
+ * english/chinese translation data
17
+ * zhihu QA
18
+ * pCLUE
19
+ * Medical Domain:
20
+ * MedDialog-200k
21
+ * Chinese-medical-dialogue-data
22
+ * WebMedQA
23
+ * code
24
+ * alpaca_code-20k
25
+
26
+
27
+ # training
28
+
29
+ ## Model
30
+
31
+ * LLaMA-7B
32
+
33
+ ## Hardware
34
+ * 6 x A100 40G using NVLink 4 inter-gpu connects
35
+
36
+ ## Software
37
+
38
+ * tokenizers==0.12.1
39
+ * sentencepiece==0.1.97
40
+ * transformers==4.28
41
+ * torch==2.0.0+cu117
42
+
43
+
44
+
45
+ # How to use
46
+
47
+ ```
48
+ import torch
49
+ from transformers import LlamaTokenizer, LlamaForCausalLM, GenerationConfig
50
+ from peft import PeftModel
51
+
52
+ base_model="llma-7b"
53
+ LORA_WEIGHTS = "llma-med-alpaca-7b"
54
+ LOAD_8BIT = False
55
+
56
+ tokenizer = LlamaTokenizer.from_pretrained(base_model)
57
+
58
+ model = LlamaForCausalLM.from_pretrained(
59
+ base_model
60
+ load_in_8bit=LOAD_8BIT,
61
+ torch_dtype=torch.float16,
62
+ device_map="auto",
63
+ )
64
+ model = PeftModel.from_pretrained(
65
+ model,
66
+ LORA_WEIGHTS,
67
+ torch_dtype=torch.float16,
68
+ )
69
+
70
+ config = {
71
+ "temperature": 0 ,
72
+ "max_new_tokens": 1024,
73
+ "top_p": 0.5
74
+ }
75
+
76
+ prompt = "Translate to English: Je t’aime."
77
+ input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(model.device)
78
+ outputs = model.generate(input_ids=input_ids, max_new_tokens=config["max_new_tokens"], temperature=config["temperature"])
79
+ decoded = tokenizer.decode(outputs[0], skip_special_tokens=True).strip()
80
+ print(decoded[len(prompt):])
81
+
82
+
83
+ ```
84
+
85
+ # Limitations
86
+
87
+ * This model may output harmful, biased, toxic, and illusory things, and currently does not undergo RLHF training, so this model is only for research purposes
88
 
89
  # TODO
90
 
91
+ - [x] self-instruct data
92
+ - [x] english medical data
93
+ - [ ] code data
94
+ - [ ] chinese corpus/medical dialog data
95
+
96
+
97
+ # Reference
98
+ * [LLaMA: Open and Efficient Foundation Language Models](https://arxiv.org/abs/2302.13971)
99
+ * [Alpaca: A strong open-source instruction-following model](https://crfm.stanford.edu/2023/03/13/alpaca.html)