Views
No views yet
transformers-compatible format.pip install bulkformer1from bulkformer import BulkFormerModel, extract_features
2from bulkformer.preprocessing import normalize_data, align_to_vocab
3
4model = BulkFormerModel.from_pretrained("zhfanrui/BulkFormer-50M")
5
6# counts_df: [n_samples, n_genes] raw counts, columns = Ensembl gene IDs
7log_tpm = normalize_data(counts_df)
8aligned, mask_prob = align_to_vocab(log_tpm, model.config.gene_ids)
9
10sample_emb = extract_features(
11 model, aligned.values, output_feature_type="sample_level",
12 aggregate_type="mean", mask_prob=mask_prob, device="cuda", batch_size=32,
13)model.safetensors as non-trainable buffers -- no separate graph file
needed. config.json includes the exact gene vocabulary (gene_ids,
20,010 Ensembl IDs) this checkpoint expects, in order.1@article{kang2026bulkformer,
2 title = {BulkFormer: A large-scale foundation model for bulk transcriptomes},
3 author = {Kang, Boming and Fan, Rui and Yi, Meizheng and Cui, Chunmei and Cui, Qinghua},
4 journal = {Cell Systems},
5 year = {2026},
6 pages = {101657},
7 doi = {10.1016/j.cels.2026.101657}
8}