adhisetiawan
commited on
Commit
•
72bcc1a
1
Parent(s):
113939d
Update README.md
Browse files
README.md
CHANGED
@@ -8,219 +8,57 @@ tags:
|
|
8 |
- text-generation-inference
|
9 |
---
|
10 |
|
11 |
-
#
|
|
|
12 |
|
13 |
-
|
|
|
14 |
|
|
|
|
|
|
|
15 |
|
|
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
|
20 |
|
21 |
-
|
22 |
|
|
|
|
|
23 |
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
- **Shared by [optional]:** [More Information Needed]
|
28 |
-
- **Model type:** [More Information Needed]
|
29 |
-
- **Language(s) (NLP):** [More Information Needed]
|
30 |
-
- **License:** [More Information Needed]
|
31 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
32 |
|
33 |
-
###
|
34 |
-
|
35 |
-
<!-- Provide the basic links for the model. -->
|
36 |
-
|
37 |
-
- **Repository:** [More Information Needed]
|
38 |
-
- **Paper [optional]:** [More Information Needed]
|
39 |
-
- **Demo [optional]:** [More Information Needed]
|
40 |
-
|
41 |
-
## Uses
|
42 |
-
|
43 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
44 |
-
|
45 |
-
###
|
46 |
-
Direct Use
|
47 |
-
|
48 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
49 |
-
|
50 |
-
[More Information Needed]
|
51 |
-
|
52 |
-
### Downstream Use [optional]
|
53 |
-
|
54 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
55 |
-
|
56 |
-
[More Information Needed]
|
57 |
-
|
58 |
-
### Out-of-Scope Use
|
59 |
-
|
60 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
61 |
-
|
62 |
-
[More Information Needed]
|
63 |
-
|
64 |
-
## Bias, Risks, and Limitations
|
65 |
-
|
66 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
67 |
-
|
68 |
-
[More Information Needed]
|
69 |
-
|
70 |
-
### Recommendations
|
71 |
-
|
72 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
73 |
-
|
74 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
75 |
-
|
76 |
-
## How to Get Started with the Model
|
77 |
-
|
78 |
-
Use the code below to get started with the model.
|
79 |
-
|
80 |
-
[More Information Needed]
|
81 |
-
|
82 |
-
## Training Details
|
83 |
-
|
84 |
-
### Training Data
|
85 |
-
|
86 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
87 |
-
|
88 |
-
[More Information Needed]
|
89 |
-
|
90 |
-
### Training Procedure
|
91 |
-
|
92 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
93 |
-
|
94 |
-
#### Preprocessing [optional]
|
95 |
-
|
96 |
-
[More Information Needed]
|
97 |
-
|
98 |
-
|
99 |
-
#### Training Hyperparameters
|
100 |
-
|
101 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
102 |
-
|
103 |
-
#### Speeds, Sizes, Times [optional]
|
104 |
-
|
105 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
106 |
-
|
107 |
-
[More Information Needed]
|
108 |
|
109 |
## Evaluation
|
110 |
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
130 |
-
|
131 |
-
[More Information Needed]
|
132 |
-
|
133 |
-
### Results
|
134 |
-
|
135 |
-
[More Information Needed]
|
136 |
-
|
137 |
-
#### Summary
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
## Model Examination [optional]
|
142 |
-
|
143 |
-
<!-- Relevant interpretability work for the model goes here -->
|
144 |
-
|
145 |
-
[More Information Needed]
|
146 |
-
|
147 |
-
## Environmental Impact
|
148 |
-
|
149 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
150 |
-
|
151 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
152 |
-
|
153 |
-
- **Hardware Type:** [More Information Needed]
|
154 |
-
- **Hours used:** [More Information Needed]
|
155 |
-
- **Cloud Provider:** [More Information Needed]
|
156 |
-
- **Compute Region:** [More Information Needed]
|
157 |
-
- **Carbon Emitted:** [More Information Needed]
|
158 |
-
|
159 |
-
## Technical Specifications [optional]
|
160 |
-
|
161 |
-
### Model Architecture and Objective
|
162 |
-
|
163 |
-
[More Information Needed]
|
164 |
-
|
165 |
-
### Compute Infrastructure
|
166 |
-
|
167 |
-
[More Information Needed]
|
168 |
-
|
169 |
-
#### Hardware
|
170 |
-
|
171 |
-
[More Information Needed]
|
172 |
-
|
173 |
-
#### Software
|
174 |
-
|
175 |
-
[More Information Needed]
|
176 |
-
|
177 |
-
## Citation [optional]
|
178 |
-
|
179 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
180 |
-
|
181 |
-
**BibTeX:**
|
182 |
-
|
183 |
-
[More Information Needed]
|
184 |
-
|
185 |
-
**APA:**
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
## Glossary [optional]
|
190 |
-
|
191 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
192 |
-
|
193 |
-
[More Information Needed]
|
194 |
-
|
195 |
-
## More Information [optional]
|
196 |
-
|
197 |
-
[More Information Needed]
|
198 |
-
|
199 |
-
## Model Card Authors [optional]
|
200 |
-
|
201 |
-
[More Information Needed]
|
202 |
-
|
203 |
-
## Model Card Contact
|
204 |
-
|
205 |
-
[More Information Needed]
|
206 |
-
|
207 |
-
|
208 |
-
## Training procedure
|
209 |
-
|
210 |
-
|
211 |
-
The following `bitsandbytes` quantization config was used during training:
|
212 |
-
- quant_method: bitsandbytes
|
213 |
-
- load_in_8bit: True
|
214 |
-
- load_in_4bit: False
|
215 |
-
- llm_int8_threshold: 6.0
|
216 |
-
- llm_int8_skip_modules: None
|
217 |
-
- llm_int8_enable_fp32_cpu_offload: False
|
218 |
-
- llm_int8_has_fp16_weight: False
|
219 |
-
- bnb_4bit_quant_type: fp4
|
220 |
-
- bnb_4bit_use_double_quant: False
|
221 |
-
- bnb_4bit_compute_dtype: float32
|
222 |
-
|
223 |
-
### Framework versions
|
224 |
-
|
225 |
-
|
226 |
-
- PEFT 0.6.2.dev0
|
|
|
8 |
- text-generation-inference
|
9 |
---
|
10 |
|
11 |
+
# About :
|
12 |
+
AlpaRA 7B, a model for medical dialogue understanding. Fine-tuned using the Alpaca configuration on a curated 5,000-instruction dataset capturing nuances in patient-doctor conversations. Use Parameter Efficient Fine Tuning (PEFT) and Low Rank Adaptation (LoRA), make this model efficient on consumer-grade GPUs.
|
13 |
|
14 |
+
## How to Use :
|
15 |
+
## Load the Donkey model
|
16 |
|
17 |
+
```python
|
18 |
+
from peft import PeftModel
|
19 |
+
from transformers import LlamaTokenizer, LlamaForCausalLM, GenerationConfig
|
20 |
|
21 |
+
tokenizer = LlamaTokenizer.from_pretrained("yahma/llama-7b-hf")
|
22 |
|
23 |
+
model = LlamaForCausalLM.from_pretrained(
|
24 |
+
"yahma/llama-7b-hf",
|
25 |
+
load_in_8bit=True,
|
26 |
+
device_map="auto"
|
27 |
+
)
|
28 |
+
model = PeftModel.from_pretrained(model, "KalbeDigitalLab/alpara-7b-peft")
|
29 |
+
```
|
30 |
|
31 |
+
## Prompt Template :
|
32 |
|
33 |
+
Feel free to change the instruction
|
34 |
|
35 |
+
```python
|
36 |
+
PROMPT = """Below is an instruction that describes a task. Write a response that appropriately completes the request.
|
37 |
|
38 |
|
39 |
+
### Instruction:
|
40 |
+
"how to cure flu?"
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
+
### Response:"""
|
43 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
## Evaluation
|
46 |
|
47 |
+
```python
|
48 |
+
inputs = tokenizer(
|
49 |
+
PROMPT,
|
50 |
+
return_tensors="pt"
|
51 |
+
)
|
52 |
+
input_ids = inputs["input_ids"].cuda()
|
53 |
+
|
54 |
+
print("Generating...")
|
55 |
+
generation_output = model.generate(
|
56 |
+
input_ids=input_ids,
|
57 |
+
return_dict_in_generate=True,
|
58 |
+
output_scores=True,
|
59 |
+
max_new_tokens=512,
|
60 |
+
)
|
61 |
+
for s in generation_output.sequences:
|
62 |
+
result = tokenizer.decode(s).split("### Response:")[1]
|
63 |
+
print(result)
|
64 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|