Update README.md
Browse files
README.md
CHANGED
@@ -3,199 +3,219 @@ library_name: transformers
|
|
3 |
tags: []
|
4 |
---
|
5 |
|
6 |
-
# Model Card for Model ID
|
7 |
|
8 |
-
|
9 |
|
|
|
|
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
15 |
|
16 |
-
<!--
|
17 |
|
18 |
-
This is the model
|
|
|
19 |
|
20 |
-
- **Developed by:** [More Information Needed]
|
21 |
-
- **Funded by [optional]:** [More Information Needed]
|
22 |
-
- **Shared by [optional]:** [More Information Needed]
|
23 |
-
- **Model type:** [More Information Needed]
|
24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
|
28 |
-
### Model Sources [optional]
|
29 |
|
30 |
-
<!-- Provide the basic links for the model. -->
|
31 |
|
32 |
-
|
33 |
-
- **Paper [optional]:** [More Information Needed]
|
34 |
-
- **Demo [optional]:** [More Information Needed]
|
35 |
|
36 |
-
|
|
|
|
|
37 |
|
38 |
-
|
39 |
|
40 |
-
|
41 |
|
42 |
-
|
|
|
43 |
|
44 |
-
[More Information Needed]
|
45 |
|
46 |
-
|
|
|
|
|
47 |
|
48 |
-
|
49 |
|
50 |
-
|
|
|
51 |
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
|
|
55 |
|
56 |
-
|
57 |
|
58 |
-
|
|
|
59 |
|
60 |
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
61 |
|
62 |
-
[
|
|
|
63 |
|
64 |
-
|
65 |
|
66 |
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
67 |
|
68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
69 |
|
70 |
-
## How to Get Started with the Model
|
71 |
|
72 |
-
Use the code below to get started with the model.
|
73 |
|
74 |
-
|
|
|
75 |
|
76 |
-
## Training
|
77 |
|
78 |
-
|
79 |
|
80 |
-
<!--
|
81 |
|
82 |
-
[More Information Needed]
|
83 |
|
84 |
-
|
85 |
|
86 |
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
87 |
|
88 |
-
|
89 |
|
90 |
-
|
91 |
|
92 |
-
|
93 |
-
#### Training Hyperparameters
|
94 |
-
|
95 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
96 |
-
|
97 |
-
#### Speeds, Sizes, Times [optional]
|
98 |
|
99 |
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
|
105 |
<!-- This section describes the evaluation protocols and provides the results. -->
|
106 |
|
107 |
-
|
108 |
|
109 |
-
|
110 |
|
111 |
-
<!-- This should link to a
|
112 |
|
113 |
-
|
114 |
|
115 |
-
|
|
|
116 |
|
117 |
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
|
119 |
-
|
120 |
|
121 |
-
|
122 |
|
123 |
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
124 |
|
125 |
-
|
126 |
-
|
127 |
-
### Results
|
128 |
-
|
129 |
-
[More Information Needed]
|
130 |
|
131 |
-
|
132 |
|
|
|
133 |
|
|
|
134 |
|
135 |
-
|
136 |
|
137 |
-
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
-
|
141 |
-
## Environmental Impact
|
142 |
|
143 |
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
-
|
145 |
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).
|
146 |
|
147 |
-
- **Hardware Type:**
|
148 |
-
- **Hours used:**
|
149 |
-
- **Cloud Provider:**
|
150 |
-
- **Compute Region:**
|
151 |
-
- **Carbon Emitted:**
|
152 |
|
153 |
-
|
154 |
|
155 |
-
|
156 |
|
157 |
-
|
158 |
|
159 |
-
|
160 |
|
161 |
-
|
162 |
|
163 |
-
|
164 |
|
165 |
-
|
166 |
|
167 |
-
|
168 |
|
169 |
-
|
170 |
|
171 |
-
|
172 |
|
173 |
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
|
175 |
**BibTeX:**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
|
177 |
-
|
178 |
-
|
179 |
-
**APA:**
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
|
183 |
-
|
184 |
|
185 |
-
<!--
|
186 |
|
187 |
-
|
188 |
|
189 |
-
|
190 |
|
191 |
-
|
192 |
|
193 |
-
|
194 |
|
195 |
-
|
196 |
|
197 |
-
|
198 |
|
199 |
-
[More Information Needed]
|
200 |
|
201 |
|
|
|
3 |
tags: []
|
4 |
---
|
5 |
|
|
|
6 |
|
7 |
+
## Model Description
|
8 |
|
9 |
+
<!-- Provide a longer summary of what this model is/does. -->
|
10 |
+
LoRA adapter weights from fine-tuning [BioMobileBERT](https://huggingface.co/nlpie/bio-mobilebert) on the MIMIC-III mortality prediction task. The [PEFT](https://github.com/huggingface/peft) was used and the model was trained for a maximum of 5 epochs with early stopping, full details can be found at the [github repo](https://github.com/nlpie-research/efficient-ml).
|
11 |
|
12 |
+
<!-- - **Developed by:** Niall Taylor -->
|
13 |
+
<!-- - **Shared by [Optional]:** More information needed -->
|
14 |
+
- **Model type:** Language model LoRA adapter
|
15 |
+
- **Language(s) (NLP):** en
|
16 |
+
- **License:** apache-2.0
|
17 |
+
- **Parent Model:** Llama-2-7b-hf
|
18 |
+
- **Resources for more information:**
|
19 |
+
- [GitHub Repo](https://github.com/nlpie-research/efficient-ml)
|
20 |
+
- [Associated Paper](https://arxiv.org/abs/2402.10597)
|
21 |
|
22 |
+
<!-- # Uses -->
|
23 |
|
24 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
25 |
|
26 |
+
<!-- ## Direct Use -->
|
27 |
|
28 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
29 |
+
<!-- If the user enters content, print that. If not, but they enter a task in the list, use that. If neither, say "more info needed." -->
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
|
34 |
+
<!-- ## Downstream Use [Optional] -->
|
|
|
|
|
35 |
|
36 |
+
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
37 |
+
<!-- If the user enters content, print that. If not, but they enter a task in the list, use that. If neither, say "more info needed." -->
|
38 |
+
|
39 |
|
40 |
+
# How to Get Started with the Model
|
41 |
|
42 |
+
Use the code below to get started with the model.
|
43 |
|
44 |
+
<details>
|
45 |
+
<summary> Click to expand </summary>
|
46 |
|
|
|
47 |
|
48 |
+
```python
|
49 |
+
from peft import AutoPeftModelForCausalLM, AutoPeftModelForSequenceClassification
|
50 |
+
from transformers import AutoTokenizer
|
51 |
|
52 |
+
model_name = "NTaylor/bio-mobilebert-mimic-mp-lora"
|
53 |
|
54 |
+
# load using AutoPeftModelForSequenceClassification
|
55 |
+
model = AutoPeftModelForSequenceClassification.from_pretrained(lora_id)
|
56 |
|
57 |
+
# use base llama tokenizer
|
58 |
+
tokenizer = AutoTokenizer.from_pretrained("nlpie/bio-mobilebert")
|
59 |
+
|
60 |
+
# example input
|
61 |
+
text = "Clinical note..."
|
62 |
+
inputs = tokenizer(text, return_tensors="pt")
|
63 |
+
outputs = reloaded_model(**inputs)
|
64 |
+
# extract prediction from outputs based on argmax of logits
|
65 |
+
pred = torch.argmax(outputs.logits, axis = -1)
|
66 |
+
print(f"Prediction is: {pred}") # binary classification: 1 for mortality
|
67 |
+
```
|
68 |
+
|
69 |
+
|
70 |
+
</details>
|
71 |
+
|
72 |
+
## Out-of-Scope Use
|
73 |
|
74 |
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
75 |
+
<!-- If the user enters content, print that. If not, but they enter a task in the list, use that. If neither, say "more info needed." -->
|
76 |
|
77 |
+
This model and LoRA weights were trained on the MIMIC-III dataset and are not intended for use on other datasets, nor be used in any real clinical setting. The experiments were conducted as a means of exploring the potential of LoRA adapters for clinical NLP tasks, and the model should not be used for any other purpose.
|
78 |
|
79 |
+
|
80 |
+
<!-- # Bias, Risks, and Limitations -->
|
81 |
|
82 |
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
83 |
|
84 |
+
<!-- Significant research has explored bias and fairness issues with language models (see, e.g., [Sheng et al. (2021)](https://aclanthology.org/2021.acl-long.330.pdf) and [Bender et al. (2021)](https://dl.acm.org/doi/pdf/10.1145/3442188.3445922)). Predictions generated by the model may include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups. -->
|
85 |
+
|
86 |
|
87 |
+
<!-- ## Recommendations -->
|
88 |
|
89 |
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
|
93 |
|
94 |
+
<!--
|
95 |
+
# Training Details
|
96 |
|
97 |
+
## Training Data
|
98 |
|
99 |
+
<!-- This should link to a Data 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. -->
|
100 |
|
101 |
+
<!-- More information on training data needed -->
|
102 |
|
|
|
103 |
|
104 |
+
<!-- ## Training Procedure -->
|
105 |
|
106 |
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
107 |
|
108 |
+
<!-- ### Preprocessing
|
109 |
|
110 |
+
More information needed -->
|
111 |
|
112 |
+
<!-- ### Speeds, Sizes, Times -->
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
115 |
|
116 |
+
<!-- More information needed -->
|
117 |
+
|
118 |
+
<!-- # Evaluation -->
|
119 |
|
120 |
<!-- This section describes the evaluation protocols and provides the results. -->
|
121 |
|
122 |
+
<!-- ## Testing Data, Factors & Metrics
|
123 |
|
124 |
+
### Testing Data -->
|
125 |
|
126 |
+
<!-- This should link to a Data Card if possible. -->
|
127 |
|
128 |
+
<!-- More information needed -->
|
129 |
|
130 |
+
|
131 |
+
<!-- ### Factors -->
|
132 |
|
133 |
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
134 |
|
135 |
+
<!-- More information needed -->
|
136 |
|
137 |
+
<!-- ### Metrics -->
|
138 |
|
139 |
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
140 |
|
141 |
+
<!-- More information needed -->
|
|
|
|
|
|
|
|
|
142 |
|
143 |
+
<!-- ## Results
|
144 |
|
145 |
+
More information needed
|
146 |
|
147 |
+
# Model Examination
|
148 |
|
149 |
+
More information needed
|
150 |
|
151 |
+
# Environmental Impact -->
|
|
|
|
|
|
|
|
|
152 |
|
153 |
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
154 |
+
<!--
|
155 |
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).
|
156 |
|
157 |
+
- **Hardware Type:** More information needed
|
158 |
+
- **Hours used:** More information needed
|
159 |
+
- **Cloud Provider:** More information needed
|
160 |
+
- **Compute Region:** More information needed
|
161 |
+
- **Carbon Emitted:** More information needed
|
162 |
|
163 |
+
# Technical Specifications [optional]
|
164 |
|
165 |
+
## Model Architecture and Objective
|
166 |
|
167 |
+
More information needed
|
168 |
|
169 |
+
## Compute Infrastructure
|
170 |
|
171 |
+
More information needed
|
172 |
|
173 |
+
### Hardware
|
174 |
|
175 |
+
More information needed
|
176 |
|
177 |
+
### Software
|
178 |
|
179 |
+
More information needed -->
|
180 |
|
181 |
+
# Citation
|
182 |
|
183 |
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
184 |
|
185 |
**BibTeX:**
|
186 |
+
``````
|
187 |
+
@misc{taylor2024efficiency,
|
188 |
+
title={Efficiency at Scale: Investigating the Performance of Diminutive Language Models in Clinical Tasks},
|
189 |
+
author={Niall Taylor and Upamanyu Ghose and Omid Rohanian and Mohammadmahdi Nouriborji and Andrey Kormilitzin and David Clifton and Alejo Nevado-Holgado},
|
190 |
+
year={2024},
|
191 |
+
eprint={2402.10597},
|
192 |
+
archivePrefix={arXiv},
|
193 |
+
primaryClass={cs.CL}
|
194 |
+
}
|
195 |
+
``````
|
196 |
+
<!-- **APA:** -->
|
197 |
+
|
198 |
+
<!-- More information needed -->
|
199 |
+
|
200 |
+
<!-- # Glossary [optional] -->
|
201 |
|
202 |
+
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
|
|
|
|
|
|
|
|
203 |
|
204 |
+
<!-- More information needed -->
|
205 |
|
206 |
+
<!-- # More Information [optional] -->
|
207 |
|
208 |
+
<!-- More information needed -->
|
209 |
|
210 |
+
<!-- # Model Card Authors [optional] -->
|
211 |
|
212 |
+
<!-- This section provides another layer of transparency and accountability. Whose views is this model card representing? How many voices were included in its construction? Etc. -->
|
213 |
|
214 |
+
<!-- More information needed -->
|
215 |
|
216 |
+
<!-- # Model Card Contact -->
|
217 |
|
218 |
+
<!-- More information needed -->
|
219 |
|
|
|
220 |
|
221 |
|