nielsr HF staff commited on
Commit
7e80eea
verified
1 Parent(s): 38c2a05

Add pipeline tag and link to paper

Browse files

This PR ensures the model can be found at https://huggingface.co/models?pipeline_tag=feature-extraction as well as links the model to the paper
page. Also, it specifies the library with which it is compatible with.

Files changed (1) hide show
  1. README.md +129 -2
README.md CHANGED
@@ -9,11 +9,14 @@ tags:
9
  - metagene-1
10
  language:
11
  - en
 
 
12
  ---
 
13
  # METAGENE-1
14
 
15
  ## **Model Overview**
16
- **METAGENE-1** is a 7B parameter metagenomic foundation model designed for pandemic monitoring, trained on over 1.5T base pairs of DNA and RNA sequenced from wastewater.
17
 
18
  https://metagene.ai
19
 
@@ -151,4 +154,128 @@ We have included more in-depth discussions on safety considerations in our [pape
151
  journal={arXiv preprint arXiv:2501.02045},
152
  year={2025}
153
  }
154
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  - metagene-1
10
  language:
11
  - en
12
+ pipeline_tag: feature-extraction
13
+ library_name: transformers
14
  ---
15
+
16
  # METAGENE-1
17
 
18
  ## **Model Overview**
19
+ **METAGENE-1** is a 7B parameter metagenomic foundation model designed for pandemic monitoring, trained on over 1.5T base pairs of DNA and RNA sequenced from wastewater. It is presented in the paper [METAGENE-1: Metagenomic Foundation Model for Pandemic Monitoring](https://huggingface.co/papers/2501.02045).
20
 
21
  https://metagene.ai
22
 
 
154
  journal={arXiv preprint arXiv:2501.02045},
155
  year={2025}
156
  }
157
+ ```
158
+
159
+
160
+ ## reasoning
161
+ A reasoning section regarding which metadata is most appropriate for the given model to put in the `content` section as YAML, given the available
162
+ context about the paper (abstract, Github README content and project page content if provided). Formatted as plain text
163
+
164
+ ## Title
165
+ Add pipeline tag and library name
166
+
167
+ ## Comment
168
+ This PR ensures the model can be found at https://huggingface.co/models?pipeline_tag=feature-extraction and adds library_name=transformers.
169
+
170
+ ## Metadata
171
+ license: apache-2.0
172
+ tags:
173
+ - DNA
174
+ - RNA
175
+ - genomic
176
+ - metagenomic
177
+ - metagene
178
+ - metagene-1
179
+ language:
180
+ - en
181
+ pipeline_tag: feature-extraction
182
+ library_name: transformers
183
+
184
+ ## Content
185
+ # METAGENE-1
186
+
187
+ ## **Model Overview**
188
+ **METAGENE-1** is a 7B parameter metagenomic foundation model designed for pandemic monitoring, trained on over 1.5T base pairs of DNA and RNA sequenced from wastewater.
189
+
190
+ https://metagene.ai
191
+
192
+ ![METAGENE-1 Overview](overview.png)
193
+
194
+ **METAGENE-1** is a 7-billion-parameter autoregressive transformer language model, which we refer to as a *metagenomic foundation model*, that was trained on a novel corpus of diverse metagenomic DNA and RNA sequences comprising over 1.5 trillion base pairs. This dataset is sourced from a large collection of human wastewater samples, processed and sequenced using deep metagenomic (next-generation) sequencing methods. Unlike genomic models that focus on individual genomes or curated sets of specific species, the aim of METAGENE-1 is to capture the full distribution of genomic information present across the human microbiome. After pretraining, this model is designed to aid in tasks in the areas of biosurveillance, pandemic monitoring, and pathogen detection.
195
+
196
+ We carry out byte-pair encoding (BPE) tokenization on our dataset, tailored for metagenomic sequences, and then pretrain our model. We detail the pretraining data, tokenization strategy, and model architecture, highlighting the considerations and design choices that enable the effective modeling of metagenomic data, in our technical report.
197
+
198
+ ## **Usage**
199
+ ```python
200
+ import torch
201
+ from transformers import AutoTokenizer, AutoModelForCausalLM
202
+
203
+ # Load the tokenizer and model
204
+ tokenizer = AutoTokenizer.from_pretrained("metagene-ai/METAGENE-1")
205
+ model = AutoModelForCausalLM.from_pretrained("metagene-ai/METAGENE-1", torch_dtype=torch.bfloat16)
206
+
207
+ # Example input sequence
208
+ input_sequence = "TCACCGTTCTACAATCCCAAGCTGGAGTCAAGCTCAACAGGGTCTTC"
209
+
210
+ # Tokenize the input sequence and remove the [EOS] token for generation
211
+ input_tokens = tokenizer.encode(input_sequence, return_tensors="pt", add_special_tokens=False)
212
+
213
+ # Generate output from the model
214
+ generated_tokens = model.generate(input_tokens, max_length=32)
215
+
216
+ # Decode the generated output and clean up the result
217
+ generated_sequence = tokenizer.decode(generated_tokens[0], skip_special_tokens=True)
218
+ generated_sequence = generated_sequence.replace(" ", "").replace("_", "")
219
+
220
+ # Generated output: A Hexamita inflata 5.8S ribosomal RNA gene sequence
221
+ print(f"馃敩 Generated Sequence:\n{generated_sequence}")
222
+ # TCACCGTTCTACAATCCCAAGCTGGAGTCAAGCTCAACAGGGTCTTCTTGCCCCGCTGAGGGTTACACTCGCCCGTTCCCGAGTCTGTGGTTTCGCGAAGATATGACCAGGGACAGTAAGAACC
223
+ ```
224
+
225
+ ## **Benchmark Performance**
226
+ We evaluate METAGENE-1 across three tasks: pathogen detection, zero-shot embedding benchmarks (**Gene-MTEB**), and genome understanding (**GUE**), achieving state-of-the-art performance on most benchmarks. For more details, check out our [paper](https://arxiv.org/abs/2501.02045).
227
+ ### **Pathogen Detection**
228
+ The pathogen detection benchmark evaluates **METAGENE-1**鈥檚 ability to classify sequencing reads as human pathogens or non-pathogens across four distinct datasets, each derived from different sequencing deliveries and designed to mimic real-world conditions with limited training data.
229
+ | | **DNABERT-2** | **DNABERT-S** | **NT-2.5b-Multi** | **NT-2.5b-1000g** | **METAGENE-1** |
230
+ |-------------------------------|---------------|---------------|-------------------|-------------------|----------------|
231
+ | **Pathogen-Detect (avg.)** | 87.92 | 87.02 | 82.43 | 79.02 | **92.96** |
232
+ | **Pathogen-Detect-1** | 86.73 | 85.43 | 83.80 | 77.52 | **92.14** |
233
+ | **Pathogen-Detect-2** | 86.90 | 85.23 | 83.53 | 80.38 | **90.91** |
234
+ | **Pathogen-Detect-3** | 88.30 | 89.01 | 82.48 | 79.83 | **93.70** |
235
+ | **Pathogen-Detect-4** | 89.77 | 88.41 | 79.91 | 78.37 | **95.10** |
236
+
237
+ ### **Gene-MTEB**
238
+ The Gene-MTEB benchmark evaluates **METAGENE-1**鈥檚 ability to produce high-quality, zero-shot genomic representations through eight classification and eight clustering tasks.
239
+ | | **DNABERT-2** | **DNABERT-S** | **NT-2.5b-Multi** | **NT-2.5b-1000g** | **METAGENE-1** |
240
+ |--------------------------------|---------------|---------------|-------------------|-------------------|----------------|
241
+ | **Human-Virus (avg.)** | 0.564 | 0.570 | 0.675 | 0.710 | **0.775** |
242
+ | Human-Virus-1 | 0.594 | 0.605 | 0.671 | 0.721 | **0.828** |
243
+ | Human-Virus-2 | 0.507 | 0.510 | 0.652 | 0.624 | **0.742** |
244
+ | Human-Virus-3 | 0.606 | 0.612 | 0.758 | 0.740 | **0.835** |
245
+ | Human-Virus-4 | 0.550 | 0.551 | 0.620 | **0.755** | 0.697 |
246
+ | **HMPD (avg.)** | 0.397 | 0.403 | 0.449 | 0.451 | **0.465** |
247
+ | HMPD-single | 0.292 | 0.293 | 0.285 | 0.292 | **0.297** |
248
+ | HMPD-disease | 0.480 | 0.486 | 0.498 | 0.489 | **0.542** |
249
+ | HMPD-sex | 0.366 | 0.367 | 0.487 | 0.476 | **0.495** |
250
+ | HMPD-source | 0.451 | 0.465 | 0.523 | **0.545** | 0.526 |
251
+ | **HVR (avg.)** | 0.479 | 0.479 | 0.546 | 0.524 | **0.550** |
252
+ | HVR-p2p | 0.548 | 0.550 | 0.559 | **0.650** | 0.466 |
253
+ | HVR-s2s-align | 0.243 | 0.241 | 0.266 | **0.293** | 0.267 |
254
+ | HVR-s2s-small | 0.373 | 0.372 | 0.357 | 0.371 | **0.467** |
255
+ | HVR-s2s-tiny | 0.753 | 0.753 | 1.000 | 0.782 | **1.000** |
256
+ | **HMPR (avg.)** | 0.347 | 0.351 | 0.348 | 0.403 | **0.476** |
257
+ | HMPR-p2p | 0.566 | **0.580** | 0.471 | 0.543 | 0.479 |
258
+ | HMPR-s2s-align | 0.127 | 0.129 | 0.144 | **0.219** | 0.140 |
259
+ | HMPR-s2s-small | 0.419 | 0.421 | 0.443 | **0.459** | 0.432 |
260
+ | HMPR-s2s-tiny | 0.274 | 0.274 | 0.332 | 0.391 | **0.855** |
261
+ | **Global Average** | 0.475 | 0.479 | 0.525 | 0.545 | **0.590** |
262
+
263
+ ### **GUE**
264
+
265
+ Next, we evaluate **METAGENE-1** on the GUE multi-species classification benchmark proposed in [DNABERT-2](https://arxiv.org/abs/2306.15006). This experiment is designed to assess the viability of **METAGENE-1** as a general-purpose genome foundation model.
266
+ | | **CNN** | **HyenaDNA** | **DNABERT** | **NT-2.5B-Multi** | **DNABERT-2** | **METAGENE-1** |
267
+ |--------------------------------|---------|--------------|-------------|-------------------|---------------|----------------|
268
+ | **TF-Mouse (avg.)** | 45.3 | 51.0 | 57.7 | 67.0 | 68.0 | **71.4** |
269
+ | 0 | 31.1 | 35.6 | 42.3 | **63.3** | 56.8 | 61.5 |
270
+ | 1 | 59.7 | 80.5 | 79.1 | 83.8 | **84.8** | 83.7 |
271
+ | 2 | 63.2 | 65.3 | 69.9 | 71.5 | 79.3 | **83.0** |
272
+ | 3 | 45.5 | 54.2 | 55.4 | 69.4 | 66.5 | **82.2** |
273
+ | 4 | 27.2 | 19.2 | 42.0 | 47.1 | **52.7** | 46.6 |
274
+ | **TF-Human (avg.)** | 50.7 | 56.0 | 64.4 | 62.6 | **70.1** | 68.3 |
275
+ | 0 | 54.0 | 62.3 | 68.0 | 66.6 | **72.0** | 68.9 |
276
+ | 1 | 63.2 | 67.9 | 70.9 | 66.6 | **76.1** | 70.8 |
277
+ | 2 | 45.2 | 46.9 | 60.5 | 58.7 | **66.5** | 65.9 |
278
+ | 3 | 29.8 | 41.8 | 53.0 | 51.7 | **58.5** | 58.1 |
279
+ | 4 | 61.5 | 61.2 | 69.8 | 69.3 | 77.4 | **77.9** |
280
+ | **EMP (avg.)** | 37.6 | 44.9 | 49.5 | 58.1 | 56.0 | **66.0** |
281
+ | H3 | 61.5 | 67.2 | 74