Views
No views yet
| architecture | BERT, 24 layers, 768 hidden, 12 heads |
| parameters | ~430M |
| input | 1000 bp DNA sequence (ACGT) |
| output | 768-dim embedding per position |
| pretraining | metagenomic contigs + microbial genomes |
1import tensorflow as tf
2from huggingface_hub import hf_hub_download
3
4# download model
5model_path = hf_hub_download(
6 repo_id="genomenet/bert-metagenome",
7 filename="bert_1k_3.h5"
8)
9
10# load with custom objects (if needed)
11model = tf.keras.models.load_model(model_path, compile=False)
12
13# get embeddings from layer 21
14embedding_model = tf.keras.Model(
15 inputs=model.input,
16 outputs=model.get_layer("layer_transformer_block_21").output
17)
18
19# input: one-hot encoded DNA (batch, 1000, 4)
20# output: embeddings (batch, 1000, 768)(batch_size, 1000, 4)