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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
- es
|
6 |
+
- fr
|
7 |
+
- it
|
8 |
+
library_name: transformers
|
9 |
+
pipeline_tag: text2text-generation
|
10 |
+
tags:
|
11 |
+
- medical
|
12 |
+
- multilingual
|
13 |
+
- medic
|
14 |
---
|
15 |
+
|
16 |
+
<p align="center">
|
17 |
+
<br>
|
18 |
+
<img src="http://www.ixa.eus/sites/default/files/anitdote.png" style="height: 250px;">
|
19 |
+
<h2 align="center">MedMT5: An Open-Source Multilingual Text-to-Text LLM
|
20 |
+
for The Medical Domain</h2>
|
21 |
+
<br>
|
22 |
+
|
23 |
+
|
24 |
+
# Model Card for MedMT5-large
|
25 |
+
|
26 |
+
<p align="justify">
|
27 |
+
We present MedMT5, the first open-source text-to-text multilingual model for the medical domain. MedMT5 is an encoder-decoder model developed by continuing the training of publicly available mT5 checkpoints on medical domain data for English, Spanish, French, and Italian.
|
28 |
+
</p>
|
29 |
+
- 📖 Paper: ** Coming soon **
|
30 |
+
|
31 |
+
|
32 |
+
<table border="1" cellspacing="0" cellpadding="5">
|
33 |
+
<caption>Pre-Training settings for MedMT5.</caption>
|
34 |
+
<thead>
|
35 |
+
<tr>
|
36 |
+
<th></th>
|
37 |
+
<th>MedMT5-Large (<a href="https://huggingface.co/HiTZ/MedMT5-large">HiTZ/MedMT5-large</a>)</th>
|
38 |
+
<th>MedMT5-XL (<a href="https://huggingface.co/HiTZ/MedMT5-xl">HiTZ/MedMT5-xl</a>)</th>
|
39 |
+
</tr>
|
40 |
+
</thead>
|
41 |
+
<tbody>
|
42 |
+
<tr>
|
43 |
+
<td>Param. no.</td>
|
44 |
+
<td>738M</td>
|
45 |
+
<td>3B</td>
|
46 |
+
</tr>
|
47 |
+
<tr>
|
48 |
+
<td>Sequence Length</td>
|
49 |
+
<td>1024</td>
|
50 |
+
<td>480</td>
|
51 |
+
</tr>
|
52 |
+
<tr>
|
53 |
+
<td>Token/step</td>
|
54 |
+
<td>65536</td>
|
55 |
+
<td>30720</td>
|
56 |
+
</tr>
|
57 |
+
<tr>
|
58 |
+
<td>Epochs</td>
|
59 |
+
<td>1</td>
|
60 |
+
<td>1</td>
|
61 |
+
</tr>
|
62 |
+
<tr>
|
63 |
+
<td>Total Tokens</td>
|
64 |
+
<td>4.5B</td>
|
65 |
+
<td>4.5B</td>
|
66 |
+
</tr>
|
67 |
+
<tr>
|
68 |
+
<td>Optimizer</td>
|
69 |
+
<td>Adafactor</td>
|
70 |
+
<td>Adafactor</td>
|
71 |
+
</tr>
|
72 |
+
<tr>
|
73 |
+
<td>LR</td>
|
74 |
+
<td>0.001</td>
|
75 |
+
<td>0.001</td>
|
76 |
+
</tr>
|
77 |
+
<tr>
|
78 |
+
<td>Scheduler</td>
|
79 |
+
<td>Constant</td>
|
80 |
+
<td>Constant</td>
|
81 |
+
</tr>
|
82 |
+
<tr>
|
83 |
+
<td>Hardware</td>
|
84 |
+
<td>4xA100</td>
|
85 |
+
<td>4xA100</td>
|
86 |
+
</tr>
|
87 |
+
<tr>
|
88 |
+
<td>Time (h)</td>
|
89 |
+
<td>10.5</td>
|
90 |
+
<td>20.5</td>
|
91 |
+
</tr>
|
92 |
+
<tr>
|
93 |
+
<td>CO<sub>2</sub>eq (kg)</td>
|
94 |
+
<td>2.9</td>
|
95 |
+
<td>5.6</td>
|
96 |
+
</tr>
|
97 |
+
</tbody>
|
98 |
+
</table>
|
99 |
+
|
100 |
+
|
101 |
+
# Model Description
|
102 |
+
|
103 |
+
- **Developed by**: Iker García-Ferrero, Rodrigo Agerri, Aitziber Atutxa Salazar, Elena Cabrio, Iker de la Iglesia, Alberto Lavelli, Bernardo Magnini, Benjamin Molinet, Johana Ramirez-Romero, German Rigau, Jose Maria Villa-Gonzalez, Serena Villata and Andrea Zaninello
|
104 |
+
- **Founding**: Antidote (PCI2020-120717-2) funded by MCIN/AEI /10.13039/501100011033 and by European Union NextGenerationEU/PRTR
|
105 |
+
- **Model type**: text2text-generation
|
106 |
+
- **Language(s) (NLP)**: English, Spanish, French, Italian
|
107 |
+
- **License**: apache-2.0
|
108 |
+
- **Finetuned from model**: MT5
|
109 |
+
|
110 |
+
## How to Get Started with the Model
|
111 |
+
|
112 |
+
Then you can load the model using
|
113 |
+
|
114 |
+
```python
|
115 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
116 |
+
|
117 |
+
tokenizer = AutoTokenizer.from_pretrained("HiTZ/MedMT5-xl")
|
118 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("HiTZ/MedMT5-xl")
|
119 |
+
```
|
120 |
+
|
121 |
+
The model has been trained using the T5 masked language modeling tasks. You need to finetune the model for your task.
|
122 |
+
|
123 |
+
<p align="center">
|
124 |
+
<br>
|
125 |
+
<img src="https://miro.medium.com/v2/0*yeXSc6Qs-SGKDzZP.png" style="height: 250px;">
|
126 |
+
<br>
|
127 |
+
|
128 |
+
### MedMT5 for Sequence Labelling
|
129 |
+
|
130 |
+
If you want to use MedMT5 for Sequence Labeling, we recommend you use this code: https://github.com/ikergarcia1996/Sequence-Labeling-LLMs
|
131 |
+
|
132 |
+
## Training Data
|
133 |
+
|
134 |
+
|
135 |
+
<table border="1" cellspacing="0" cellpadding="5">
|
136 |
+
<caption>Data sources and word counts by language.</caption>
|
137 |
+
<thead>
|
138 |
+
<tr>
|
139 |
+
<th>Language</th>
|
140 |
+
<th>Source</th>
|
141 |
+
<th>Words</th>
|
142 |
+
</tr>
|
143 |
+
</thead>
|
144 |
+
<tbody>
|
145 |
+
<tr>
|
146 |
+
<td rowspan="3">English</td>
|
147 |
+
<td>ClinicalTrials</td>
|
148 |
+
<td>127.4M</td>
|
149 |
+
</tr>
|
150 |
+
<tr>
|
151 |
+
<td>EMEA</td>
|
152 |
+
<td>12M</td>
|
153 |
+
</tr>
|
154 |
+
<tr>
|
155 |
+
<td>PubMed</td>
|
156 |
+
<td>968.4M</td>
|
157 |
+
</tr>
|
158 |
+
<tr>
|
159 |
+
<td rowspan="6">Spanish</td>
|
160 |
+
<td>EMEA</td>
|
161 |
+
<td>13.6M</td>
|
162 |
+
</tr>
|
163 |
+
<tr>
|
164 |
+
<td>PubMed</td>
|
165 |
+
<td>8.4M</td>
|
166 |
+
</tr>
|
167 |
+
<tr>
|
168 |
+
<td>Medical Crawler</td>
|
169 |
+
<td>918M</td>
|
170 |
+
</tr>
|
171 |
+
<tr>
|
172 |
+
<td>SPACC</td>
|
173 |
+
<td>350K</td>
|
174 |
+
</tr>
|
175 |
+
<tr>
|
176 |
+
<td>UFAL</td>
|
177 |
+
<td>10.5M</td>
|
178 |
+
</tr>
|
179 |
+
<tr>
|
180 |
+
<td>WikiMed</td>
|
181 |
+
<td>5.2M</td>
|
182 |
+
</tr>
|
183 |
+
<tr>
|
184 |
+
<td rowspan="5">French</td>
|
185 |
+
<td>PubMed</td>
|
186 |
+
<td>1.4M</td>
|
187 |
+
</tr>
|
188 |
+
<tr>
|
189 |
+
<td>Science Direct</td>
|
190 |
+
<td>15.2M</td>
|
191 |
+
</tr>
|
192 |
+
<tr>
|
193 |
+
<td>Wikipedia - Médecine</td>
|
194 |
+
<td>5M</td>
|
195 |
+
</tr>
|
196 |
+
<tr>
|
197 |
+
<td>EDP</td>
|
198 |
+
<td>48K</td>
|
199 |
+
</tr>
|
200 |
+
<tr>
|
201 |
+
<td>Google Patents</td>
|
202 |
+
<td>654M</td>
|
203 |
+
</tr>
|
204 |
+
<tr>
|
205 |
+
<td rowspan="13">Italian</td>
|
206 |
+
<td>Medical Commoncrawl - IT</td>
|
207 |
+
<td>67M</td>
|
208 |
+
</tr>
|
209 |
+
<tr>
|
210 |
+
<td>Drug instructions</td>
|
211 |
+
<td>30.5M</td>
|
212 |
+
</tr>
|
213 |
+
<tr>
|
214 |
+
<td>Wikipedia - Medicina</td>
|
215 |
+
<td>13.3M</td>
|
216 |
+
</tr>
|
217 |
+
<tr>
|
218 |
+
<td>E3C Corpus - IT</td>
|
219 |
+
<td>11.6M</td>
|
220 |
+
</tr>
|
221 |
+
<tr>
|
222 |
+
<td>Medicine descriptions</td>
|
223 |
+
<td>6.3M</td>
|
224 |
+
</tr>
|
225 |
+
<tr>
|
226 |
+
<td>Medical theses</td>
|
227 |
+
<td>5.8M</td>
|
228 |
+
</tr>
|
229 |
+
<tr>
|
230 |
+
<td>Medical websites</td>
|
231 |
+
<td>4M</td>
|
232 |
+
</tr>
|
233 |
+
<tr>
|
234 |
+
<td>PubMed</td>
|
235 |
+
<td>2.3M</td>
|
236 |
+
</tr>
|
237 |
+
<tr>
|
238 |
+
<td>Supplement description</td>
|
239 |
+
<td>1.3M</td>
|
240 |
+
</tr>
|
241 |
+
<tr>
|
242 |
+
<td>Medical notes</td>
|
243 |
+
<td>975K</td>
|
244 |
+
</tr>
|
245 |
+
<tr>
|
246 |
+
<td>Pathologies</td>
|
247 |
+
<td>157K</td>
|
248 |
+
</tr>
|
249 |
+
<tr>
|
250 |
+
<td>Medical test simulations</td>
|
251 |
+
<td>26K</td>
|
252 |
+
</tr>
|
253 |
+
<tr>
|
254 |
+
<td>Clinical cases</td>
|
255 |
+
<td>20K</td>
|
256 |
+
</tr>
|
257 |
+
</tbody>
|
258 |
+
</table>
|
259 |
+
|
260 |
+
|
261 |
+
|
262 |
+
|
263 |
+
## Evaluation
|
264 |
+
|
265 |
+
### Single-task supervised F1 scores for Sequence Labelling
|
266 |
+
<p align="center">
|
267 |
+
<br>
|
268 |
+
<img src="https://huggingface.co/HiTZ/MedMT5-large/resolve/main/single.png" style="height: 600px;">
|
269 |
+
<br>
|
270 |
+
|
271 |
+
### Multi-task supervised F1 scores for Sequence Labelling
|
272 |
+
<p align="center">
|
273 |
+
<br>
|
274 |
+
<img src="https://huggingface.co/HiTZ/MedMT5-large/resolve/main/multi.png" style="height: 600px;">
|
275 |
+
<br>
|
276 |
+
|
277 |
+
### Zero-shot F1 scores for Argument Mining. Models have been trained in English and evaluated in Spanish, French and Italian.
|
278 |
+
<p align="center">
|
279 |
+
<br>
|
280 |
+
<img src="https://huggingface.co/HiTZ/MedMT5-large/resolve/main/cross.png" style="height: 320px;">
|
281 |
+
<br>
|
282 |
+
|
283 |
+
|
284 |
+
## Ethical Statement
|
285 |
+
<p align="justify">
|
286 |
+
Our research in developing MedMT5, a multilingual text-to-text model for the medical domain, has ethical implications that we acknowledge. Firstly, the broader impact of this work lies in its potential to improve medical communication and understanding across languages, which can enhance healthcare access and quality for diverse linguistic communities. However, it also raises ethical considerations related to privacy and data security. To create our multilingual corpus, we have taken measures to anonymize and protect sensitive patient information, adhering to data protection regulations in each language's jurisdiction or deriving our data from sources that explicitly address this issue in line with privacy and safety regulations and guidelines. Furthermore, we are committed to transparency and fairness in our model's development and evaluation. We have worked to ensure that our benchmarks are representative and unbiased, and we will continue to monitor and address any potential biases in the future. Finally, we emphasize our commitment to open source by making our data, code, and models publicly available, with the aim of promoting collaboration within the research community.
|
287 |
+
</p>
|