Downloads · 30 days
23
45% of all-time downloads
igemugm/dnabert-nicotiana
dnabert-nicotiana is a machine learning model from igemugm. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This model is a domain-adaptively pre-trained DNABERT-2 on Nicotiana tabacum DNA sequences. The purpose of this pretraining is to adapt the base DNABERT-2 model to capture plant-specific DNA patterns before fine-tunin…
Downloads · 30 days
23
45% of all-time downloads
All-time downloads
51
Public
Repo size
1.4 GB
Likes
0
Public
Click a slice to open those files.
.bin468 MB · 100%
From the Hugging Face model README
This model is a domain-adaptively pre-trained DNABERT-2 on Nicotiana tabacum DNA sequences.
The purpose of this pretraining is to adapt the base DNABERT-2 model to capture plant-specific DNA patterns before fine-tuning on downstream tasks.
zhihan1996/DNABERT-2-117MDataCollatorForLanguageModelingTraining procedure:
Both training and validation losses gradually decreased, showing that the model learned patterns in Nicotiana tabacum DNA sequences without overfitting.
Final training loss: ~5.55, validation loss: ~5.53. Final loss are relatively high due to the limited dataset (1% of total available data).
This model can be used for masked language modeling tasks or as a pretraining checkpoint for downstream tasks like stress region prediction or other plant DNA sequence analyses.
from transformers import AutoTokenizer, BertModel
import torch
# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained("igemugm/dnabert-nicotiana", trust_remote_code=True)
model = BertModel.from_pretrained("igemugm/dnabert-nicotiana", trust_remote_code=True)
# Input DNA sequence
sequence = "ACGTAGCATCGGATCTATCTATCGACACTTGGTTATCGATCTACGAGCATCTCGTTAGC"
inputs = tokenizer(sequence, return_tensors="pt")
# Forward pass for hidden states
with torch.no_grad():
outputs = model(**inputs)
hidden_states = outputs.last_hidden_state # [batch, seq_len, hidden_dim]
# CLS token embedding
cls_embedding = hidden_states[:, 0, :] # [batch, hidden_dim]
# Mean pooling embedding
mean_embedding = hidden_states.mean(dim=1) # [batch, hidden_dim]
print("CLS embedding shape:", cls_embedding.shape)
print("Mean embedding shape:", mean_embedding.shape)