Views
No views yet
[!TIP] The MultiMolecule team has confirmed that the provided model and checkpoints are producing the same intermediate representations as the original implementation.
| Num Layers | Hidden Size | Num Heads | Intermediate Size | Num Parameters (M) | FLOPs (G) | MACs (G) | Max Num Tokens |
|---|---|---|---|---|---|---|---|
| 12 | 768 | 12 | 3072 | 117.07 | 125.83 | 62.92 | 512 |
multimolecule library. You can install it using pip:pip install multimolecule1import multimolecule # you must import multimolecule to register models
2from transformers import pipeline
3
4predictor = pipeline("feature-extraction", model="multimolecule/dnaberts")
5output = predictor("ATCGATCGATCG")1from multimolecule import DnaBertSModel
2from transformers import AutoTokenizer
3
4
5tokenizer = AutoTokenizer.from_pretrained("multimolecule/dnaberts")
6model = DnaBertSModel.from_pretrained("multimolecule/dnaberts")
7
8text = "ATCGATCGATCGATCG"
9input = tokenizer(text, return_tensors="pt")
10
11output = model(**input)[!NOTE] This model is not fine-tuned for any specific task. You will need to fine-tune the model on a downstream task to use it for sequence classification or regression.
1import torch
2from multimolecule import DnaBertSForSequencePrediction
3from transformers import AutoTokenizer
4
5
6tokenizer = AutoTokenizer.from_pretrained("multimolecule/dnaberts")
7model = DnaBertSForSequencePrediction.from_pretrained("multimolecule/dnaberts")
8
9text = "ATCGATCGATCGATCG"
10input = tokenizer(text, return_tensors="pt")
11label = torch.tensor([1])
12
13output = model(**input, labels=label)[!NOTE] This model is not fine-tuned for any specific task. You will need to fine-tune the model on a downstream task to use it for token classification or regression.
1import torch
2from multimolecule import DnaBertSForTokenPrediction
3from transformers import AutoTokenizer
4
5
6tokenizer = AutoTokenizer.from_pretrained("multimolecule/dnaberts")
7model = DnaBertSForTokenPrediction.from_pretrained("multimolecule/dnaberts")
8
9text = "ATCGATCGATCGATCG"
10input = tokenizer(text, return_tensors="pt")
11label = torch.randint(2, (len(text), ))
12
13output = model(**input, labels=label)[!NOTE] This model is not fine-tuned for any specific task. You will need to fine-tune the model on a downstream task to use it for contact classification or regression.
1import torch
2from multimolecule import DnaBertSForContactPrediction
3from transformers import AutoTokenizer
4
5
6tokenizer = AutoTokenizer.from_pretrained("multimolecule/dnaberts")
7model = DnaBertSForContactPrediction.from_pretrained("multimolecule/dnaberts")
8
9text = "ATCGATCGATCGATCG"
10input = tokenizer(text, return_tensors="pt")
11label = torch.randint(2, (len(text), len(text)))
12
13output = model(**input, labels=label)1@article{zhou2025dnaberts,
2 title={{DNABERT-S}: pioneering species differentiation with species-aware {DNA} embeddings},
3 author={Zhou, Zhihan and Wu, Weimin and Ho, Harrison and Wang, Jiayi and Shi, Lizhen and Davuluri, Ramana V and Wang, Zhong and Liu, Han},
4 journal={Bioinformatics},
5 volume={41},
6 pages={i255--i264},
7 year={2025},
8 doi={10.1093/bioinformatics/btaf188}
9}[!NOTE] The artifacts distributed in this repository are part of the MultiMolecule project. If MultiMolecule supports your research, please cite the MultiMolecule project as follows:
1@software{chen_2024_12638419,
2 author = {Chen, Zhiyuan and Zhu, Sophia Y.},
3 title = {MultiMolecule},
4 doi = {10.5281/zenodo.12638419},
5 publisher = {Zenodo},
6 url = {https://doi.org/10.5281/zenodo.12638419},
7 year = 2024,
8 month = may,
9 day = 4
10}SPDX-License-Identifier: AGPL-3.0-or-later