Downloads · 30 days
14
13% of all-time downloads
ShuaiAnwo/PoreBERT-DNA-VQI-110M-530
PoreBERT-DNA-VQI-110M-530 is a fill-mask model from ShuaiAnwo. Use it when you need the model to fill a missing word. It is set up for transformers. The card lists the license as openrail.
A BERT-style foundation model for nanopore DNA sequencing signal representation learning.
Downloads · 30 days
14
13% of all-time downloads
All-time downloads
110
Public
Parameters
90.2M
361 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors361 MB · 100%
From the Hugging Face model README
A BERT-style foundation model for nanopore DNA sequencing signal representation learning.
PoreBERT-DNA-VQI-110M-530 learns contextual representations from discretized nanopore electrical signal tokens generated by a Vector Quantization (VQ) tokenizer.
The model is pretrained with a Masked Language Modeling (MLM) objective, following the BERT architecture paradigm, and is designed for downstream nanopore sequencing applications.
| Property | Description |
|---|---|
| Model Type | BERT Encoder |
| Domain | Nanopore DNA sequencing |
| Parameters | ~110M |
| Training Objective | Masked Language Modeling (MLM) |
| Input | Discrete nanopore signal tokens |
| Tokenizer | VQ-based tokenizer |
| Vocabulary | Minimal vocabulary tokenizer |
| Development Release | 530 |
PoreBERT-DNA-VQI-110M-530
Nanopore sequencing foundation model based on the BERT encoder architecture.
The model is trained on nanopore DNA sequencing electrical signal representations.
Vector Quantization tokenizer.
The raw nanopore electrical signal is first converted into discrete tokens through a neural codec based on vector quantization.
Minimal vocabulary tokenizer.
The VQI tokenizer is designed with a compact vocabulary to provide efficient signal token representation while preserving important sequencing information.
Approximately 110 million model parameters.
Internal development release identifier.
The complete pipeline is:
Nanopore Electrical Signal
|
v
PoreCodec
(CNN Encoder + Vector Quantization)
|
v
Discrete Signal Tokens
|
v
PoreBERT-DNA-VQI-110M-530
|
v
Downstream Applications
The BERT model itself operates on token sequences rather than raw electrical signals.
This model uses the following tokenizer:
ShuaiAnwo/pore-codec-rsq742c12a-511
The tokenizer converts nanopore electrical signals into discrete token IDs.
Tokenizer repository:
https://huggingface.co/ShuaiAnwo/pore-codec-rsq742c12a-511
The workflow is:
Raw signal
|
v
Pore Codec Tokenizer
|
v
Token IDs
|
v
PoreBERT
Configuration:
| Parameter | Value |
|---|---|
| Architecture | Transformer Encoder |
| Hidden Size | 768 |
| Transformer Layers | 12 |
| Attention Heads | 12 |
| Intermediate Size | 3076 |
| Maximum Sequence Length | 1536 |
| Vocabulary Size | 2560 |
| Parameters | ~110M |
The architecture follows the standard BERT-style encoder design:
Token Embedding
|
Position Embedding
|
LayerNorm + Dropout
|
12 Transformer Encoder Layers
|
LayerNorm
|
Contextual Token Representation
The model is pretrained using Masked Language Modeling.
During training:
Example:
Input:
A B [MASK] D E
Prediction:
C
Training configuration:
| Parameter | Value |
|---|---|
| MLM Probability | 0.25 |
| Optimizer | AdamW |
| Precision | BF16 |
| Sequence Length | 1536 |
PoreBERT-DNA-VQI-110M-530 operates on discrete signal tokens generated by the corresponding PoreCodec VQ tokenizer.
Pipeline:
Nanopore Raw Signal
|
v
PoreCodec VQ Tokenizer
|
v
Discrete Token IDs
|
v
PoreBERT
|
v
Contextual Signal Embeddings
import numpy as np
import torch
from transformers import AutoFeatureExtractor, AutoModel
# Load PoreCodec tokenizer and PoreBERT model
codec_name = "ShuaiAnwo/pore-codec-rsq742c12a-511"
bert_name = "ShuaiAnwo/PoreBERT-DNA-VQI-110M-530"
codec = AutoModel.from_pretrained(
codec_name,
trust_remote_code=True,
).eval()
feature_extractor = AutoFeatureExtractor.from_pretrained(
codec_name,
trust_remote_code=True,
)
bert = AutoModel.from_pretrained(
bert_name,
).eval()
# Example nanopore electrical signal
raw_signal = np.random.normal(
70,
8,
1855,
).astype(np.float32)
with torch.no_grad():
# Raw signal -> VQ token IDs
signal = feature_extractor(
raw_signal,
return_tensors="pt",
)["signal"]
token_ids = codec.encode_signal(
signal,
layer=2,
)
# Token IDs -> PoreBERT contextual embeddings
outputs = bert(
input_ids=token_ids,
)
embeddings = outputs.last_hidden_state
print("Embedding shape:", embeddings.shape)
Output:
Embedding shape:
(batch_size, sequence_length, 768)
The generated embeddings can be used for downstream nanopore sequencing tasks, including:
The model was pretrained on nanopore DNA sequencing signal token sequences.
The training data pipeline:
Nanopore signal
|
v
PoreCodec tokenizer
|
v
Discrete token sequence
|
v
Masked Language Modeling
|
v
PoreBERT
This model supports gradient checkpointing during training.
Gradient checkpointing reduces GPU memory usage by recomputing intermediate activations during backward propagation.
Benefits:
Trade-off:
Coming soon.
Please refer to the LICENSE file for usage conditions.