SentenceTransformer
This is a sentence-transformers model trained on the geo_7k_cellxgene_3_5k_multiplets dataset. It maps sentences & paragraphs to a None-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
Model Details
Model Description
- Model Type: Sentence Transformer
- Maximum Sequence Length: None tokens
- Output Dimensionality: None dimensions
- Similarity Function: Cosine Similarity
- Training Dataset:
- Language: code
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): MMContextEncoder(
(text_encoder): BertModel(
(embeddings): BertEmbeddings(
(word_embeddings): Embedding(28996, 768, padding_idx=0)
(position_embeddings): Embedding(512, 768)
(token_type_embeddings): Embedding(2, 768)
(LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)
(dropout): Dropout(p=0.1, inplace=False)
)
(encoder): BertEncoder(
(layer): ModuleList(
(0-11): 12 x BertLayer(
(attention): BertAttention(
(self): BertSdpaSelfAttention(
(query): Linear(in_features=768, out_features=768, bias=True)
(key): Linear(in_features=768, out_features=768, bias=True)
(value): Linear(in_features=768, out_features=768, bias=True)
(dropout): Dropout(p=0.1, inplace=False)
)
(output): BertSelfOutput(
(dense): Linear(in_features=768, out_features=768, bias=True)
(LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)
(dropout): Dropout(p=0.1, inplace=False)
)
)
(intermediate): BertIntermediate(
(dense): Linear(in_features=768, out_features=3072, bias=True)
(intermediate_act_fn): GELUActivation()
)
(output): BertOutput(
(dense): Linear(in_features=3072, out_features=768, bias=True)
(LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)
(dropout): Dropout(p=0.1, inplace=False)
)
)
)
)
(pooler): BertPooler(
(dense): Linear(in_features=768, out_features=768, bias=True)
(activation): Tanh()
)
)
(text_adapter): AdapterModule(
(net): Sequential(
(0): Linear(in_features=768, out_features=512, bias=True)
(1): ReLU(inplace=True)
(2): Linear(in_features=512, out_features=2048, bias=True)
(3): BatchNorm1d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(omics_adapter): AdapterModule(
(net): Sequential(
(0): Linear(in_features=64, out_features=512, bias=True)
(1): ReLU(inplace=True)
(2): Linear(in_features=512, out_features=2048, bias=True)
(3): BatchNorm1d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
)
)
Usage
Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("jo-mengr/mmcontext-geo7k-cellxgene3.5k-multiplets")
# Run inference
sentences = [
'{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/A2Kgip3knb4xmFj/download", "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/HHeBR7Q9QnLM85E/download", "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/rkHBdRGpy7qAspj/download", "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/KXJjqrsrjnPKD3b/download", "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/sLBtSQxQ3HxiMyE/download"}}, "sample_id": "census_e84f2780-51e8-4cfa-8aa0-13bbfef677c7_184"}',
"A 46-year old female's liver sample, specifically conventional dendritic cell type 1 (cDC1s) enriched in CD45+ cell suspension, with no reported liver-related diseases.",
'Sample is an ON-bipolar cell derived from the peripheral region of the retina of a 60-year-old male with European self-reported ethnicity, mapped to GENCODE 24 reference annotation.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
Evaluation
Metrics
Triplet
- Evaluated with
TripletEvaluator
Metric | Value |
---|---|
cosine_accuracy | 0.4829 |
Triplet
- Evaluated with
TripletEvaluator
Metric | Value |
---|---|
cosine_accuracy | 0.9771 |
Training Details
Training Dataset
geo_7k_cellxgene_3_5k_multiplets
- Dataset: geo_7k_cellxgene_3_5k_multiplets at d5af8a2
- Size: 3,150 training samples
- Columns:
anndata_ref
,positive
,negative_1
, andnegative_2
- Approximate statistics based on the first 1000 samples:
anndata_ref positive negative_1 negative_2 type string string string string details - min: 510 characters
- mean: 512.73 characters
- max: 514 characters
- min: 43 characters
- mean: 163.06 characters
- max: 1070 characters
- min: 43 characters
- mean: 156.65 characters
- max: 764 characters
- min: 43 characters
- mean: 165.76 characters
- max: 688 characters
- Samples:
anndata_ref positive negative_1 negative_2 {"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/SdjgCqfW9YsTHgF/download", "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/73e2b7YMmDT3ttw/download", "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/qZLgaMPS9iDNTwL/download", "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/CK9Zp3RrHnXxWNS/download", "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/qyH8D8eJnKHyNE7/download"}}, "sample_id": "census_a37f857c-779f-464e-9310-3db43a1811e7_2741"}
Sample is a macrophage cell type derived from the ileal epithelium tissue of a female human in her fourth decade.
Endothelial cells derived from the lamina propria of small intestine in a 10-year old male, with potential immune regulatory functions.
Neuron cell type from cerebral cortex tissue of a 29-year old male, classified as Deep-layer intratelencephalic.
{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/SdjgCqfW9YsTHgF/download", "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/73e2b7YMmDT3ttw/download", "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/qZLgaMPS9iDNTwL/download", "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/CK9Zp3RrHnXxWNS/download", "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/qyH8D8eJnKHyNE7/download"}}, "sample_id": "census_4724c395-0c46-46d2-81f7-60fd271fb488_1016"}
Central nervous system macrophage (microglia) derived from the hippocampal formation of a 42-year-old male, specifically from the Head of hippocampus (HiH) - Uncal DG-CA4 dissection.
Plasmablast cells derived from a 6-year-old female human tonsil sample, characterized by IGH_FUNCTIONAL: TRUE, IGH_IN_FRAME: TRUE, IGH_JUNCTION_LENGTH: 48.0, IGH_J_CALL: IGHJ201, IGH_STOP: FALSE, IGH_UMIS: 7.0, IGH_V_CALL_GENOTYPED: IGHV4-30-201, IGL_C_Gene: IGLC2, IGL_FullLength: 2, IGL_Productive: 2, IGL_UMIS: 49.0, IGL_VDJ_Gene: IGLV1-47 None IGLJ2, ISOTYPE: IgG2.
Enteric neuron cells derived from the ileum tissue of a 10-week-old post-fertilization human stage.
{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/SdjgCqfW9YsTHgF/download", "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/73e2b7YMmDT3ttw/download", "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/qZLgaMPS9iDNTwL/download", "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/CK9Zp3RrHnXxWNS/download", "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/qyH8D8eJnKHyNE7/download"}}, "sample_id": "census_43b7e156-65b3-4a7b-8c7a-08528e4b21d0_761"}
Neuron cell type from the cerebral nuclei, specifically from the Basal forebrain (BF) - substantia innominata and nearby nuclei - SI region, of a 42-year old male human. The neuron falls under the deep-layer corticothalamic and 6b supercluster term.
Stromal cell derived from decidua tissue, with cell type prediction Epi1 and coarse annotation dS_uSMC, taken from a female individual at 12-13 post conception week (PCW).
Tonsil germinal center B cell derived from a 3-year-old male with recurrent tonsillitis.
- Loss:
MultipleNegativesRankingLoss
with these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim" }
Evaluation Dataset
geo_7k_cellxgene_3_5k_multiplets
- Dataset: geo_7k_cellxgene_3_5k_multiplets at d5af8a2
- Size: 350 evaluation samples
- Columns:
anndata_ref
,positive
,negative_1
, andnegative_2
- Approximate statistics based on the first 350 samples:
anndata_ref positive negative_1 negative_2 type string string string string details - min: 510 characters
- mean: 512.77 characters
- max: 514 characters
- min: 50 characters
- mean: 161.36 characters
- max: 924 characters
- min: 61 characters
- mean: 155.67 characters
- max: 924 characters
- min: 50 characters
- mean: 161.63 characters
- max: 924 characters
- Samples:
anndata_ref positive negative_1 negative_2 {"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/A2Kgip3knb4xmFj/download", "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/HHeBR7Q9QnLM85E/download", "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/rkHBdRGpy7qAspj/download", "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/KXJjqrsrjnPKD3b/download", "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/sLBtSQxQ3HxiMyE/download"}}, "sample_id": "census_b46237d1-19c6-4af2-9335-9854634bad16_7973"}
Sample contains stem cells (LGR5 stem) derived from the duodeno-jejunal junction of a human fetus at Carnegie stage 23.
Sample is a 71-year old European female with managed systemic lupus erythematosus (SLE). The cell type identified is a CD4-positive, alpha-beta T cell.
Mesenchymal cell derived from gonadal tissue of a male individual at the 15th week post-fertilization stage, exhibiting high mitochondrial content, identified as a doublet cell, with lineage Mesenchymal_LHX9, and in G1 phase.
{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/A2Kgip3knb4xmFj/download", "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/HHeBR7Q9QnLM85E/download", "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/rkHBdRGpy7qAspj/download", "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/KXJjqrsrjnPKD3b/download", "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/sLBtSQxQ3HxiMyE/download"}}, "sample_id": "census_381aa407-317a-40ef-8048-7ce0eacc4266_934"}
Endothelial cell sample from the lateral posterior nucleus of thalamus (thalamic complex) of a 29-year-old European male.
Epithelial cells from the ileal epithelium of a male human in his sixties, classified as cycling cells.
Astrocyte cell type from the pons tissue of a 29-year old male, specifically from the Pons (Pn) - afferent nuclei of cranial nerves in pons - PnAN dissection.
{"file_record": {"dataset_path": "https://nxc-fredato.imbi.uni-freiburg.de/s/A2Kgip3knb4xmFj/download", "embeddings": {"X_hvg": "https://nxc-fredato.imbi.uni-freiburg.de/s/HHeBR7Q9QnLM85E/download", "X_pca": "https://nxc-fredato.imbi.uni-freiburg.de/s/rkHBdRGpy7qAspj/download", "X_scvi": "https://nxc-fredato.imbi.uni-freiburg.de/s/KXJjqrsrjnPKD3b/download", "X_geneformer": "https://nxc-fredato.imbi.uni-freiburg.de/s/sLBtSQxQ3HxiMyE/download"}}, "sample_id": "census_c05e6940-729c-47bd-a2a6-6ce3730c4919_349"}
GABAergic neuron from the Brodmann (1909) area 4 of a 74-year-old female.
Basal cell from the transition zone of prostate epithelium, taken from a healthy 29-year-old European male.
Classical monocyte cell sample taken from a 27-year-old female of European ethnicity, with elevated expression of type 1 interferon-stimulated genes (ISGs), indicating a potential link to systemic lupus erythematosus (SLE).
- Loss:
MultipleNegativesRankingLoss
with these parameters:{ "scale": 20.0, "similarity_fct": "cos_sim" }
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy
: stepsper_device_train_batch_size
: 16per_device_eval_batch_size
: 16learning_rate
: 2e-05num_train_epochs
: 10warmup_ratio
: 0.1
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: stepsprediction_loss_only
: Trueper_device_train_batch_size
: 16per_device_eval_batch_size
: 16per_gpu_train_batch_size
: Noneper_gpu_eval_batch_size
: Nonegradient_accumulation_steps
: 1eval_accumulation_steps
: Nonetorch_empty_cache_steps
: Nonelearning_rate
: 2e-05weight_decay
: 0.0adam_beta1
: 0.9adam_beta2
: 0.999adam_epsilon
: 1e-08max_grad_norm
: 1.0num_train_epochs
: 10max_steps
: -1lr_scheduler_type
: linearlr_scheduler_kwargs
: {}warmup_ratio
: 0.1warmup_steps
: 0log_level
: passivelog_level_replica
: warninglog_on_each_node
: Truelogging_nan_inf_filter
: Truesave_safetensors
: Truesave_on_each_node
: Falsesave_only_model
: Falserestore_callback_states_from_checkpoint
: Falseno_cuda
: Falseuse_cpu
: Falseuse_mps_device
: Falseseed
: 42data_seed
: Nonejit_mode_eval
: Falseuse_ipex
: Falsebf16
: Falsefp16
: Falsefp16_opt_level
: O1half_precision_backend
: autobf16_full_eval
: Falsefp16_full_eval
: Falsetf32
: Nonelocal_rank
: 0ddp_backend
: Nonetpu_num_cores
: Nonetpu_metrics_debug
: Falsedebug
: []dataloader_drop_last
: Falsedataloader_num_workers
: 0dataloader_prefetch_factor
: Nonepast_index
: -1disable_tqdm
: Falseremove_unused_columns
: Truelabel_names
: Noneload_best_model_at_end
: Falseignore_data_skip
: Falsefsdp
: []fsdp_min_num_params
: 0fsdp_config
: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap
: Noneaccelerator_config
: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}deepspeed
: Nonelabel_smoothing_factor
: 0.0optim
: adamw_torchoptim_args
: Noneadafactor
: Falsegroup_by_length
: Falselength_column_name
: lengthddp_find_unused_parameters
: Noneddp_bucket_cap_mb
: Noneddp_broadcast_buffers
: Falsedataloader_pin_memory
: Truedataloader_persistent_workers
: Falseskip_memory_metrics
: Trueuse_legacy_prediction_loop
: Falsepush_to_hub
: Falseresume_from_checkpoint
: Nonehub_model_id
: Nonehub_strategy
: every_savehub_private_repo
: Falsehub_always_push
: Falsegradient_checkpointing
: Falsegradient_checkpointing_kwargs
: Noneinclude_inputs_for_metrics
: Falseeval_do_concat_batches
: Truefp16_backend
: autopush_to_hub_model_id
: Nonepush_to_hub_organization
: Nonemp_parameters
:auto_find_batch_size
: Falsefull_determinism
: Falsetorchdynamo
: Noneray_scope
: lastddp_timeout
: 1800torch_compile
: Falsetorch_compile_backend
: Nonetorch_compile_mode
: Nonedispatch_batches
: Nonesplit_batches
: Noneinclude_tokens_per_second
: Falseinclude_num_input_tokens_seen
: Falseneftune_noise_alpha
: Noneoptim_target_modules
: Nonebatch_eval_metrics
: Falseeval_on_start
: Falseeval_use_gather_object
: Falseprompts
: Nonebatch_sampler
: batch_samplermulti_dataset_batch_sampler
: proportional
Training Logs
Epoch | Step | Training Loss | Validation Loss | cosine_accuracy |
---|---|---|---|---|
0.5076 | 100 | 5.7387 | 10.2443 | 0.4886 |
1.0152 | 200 | 4.7896 | 10.5003 | 0.4829 |
1.5228 | 300 | 4.5846 | 10.8012 | 0.4829 |
0.5076 | 100 | 4.1704 | 14.0689 | 0.5229 |
1.0152 | 200 | 3.0912 | 10.8158 | 0.6057 |
1.5228 | 300 | 2.1032 | 7.4590 | 0.6543 |
2.0305 | 400 | 1.6312 | 6.1226 | 0.7371 |
2.5381 | 500 | 1.2939 | 4.4580 | 0.8000 |
3.0457 | 600 | 1.045 | 3.0087 | 0.8829 |
3.5533 | 700 | 0.8881 | 2.5046 | 0.8971 |
4.0609 | 800 | 0.8475 | 1.7699 | 0.9457 |
4.5685 | 900 | 0.7472 | 1.4685 | 0.9600 |
5.0761 | 1000 | 0.6621 | 1.4347 | 0.9514 |
5.5838 | 1100 | 0.6726 | 1.2745 | 0.9657 |
6.0914 | 1200 | 0.6506 | 1.2249 | 0.9629 |
6.5990 | 1300 | 0.5821 | 1.3031 | 0.9600 |
7.1066 | 1400 | 0.6018 | 1.1388 | 0.9743 |
7.6142 | 1500 | 0.5703 | 1.1026 | 0.9714 |
8.1218 | 1600 | 0.5566 | 1.0797 | 0.9714 |
8.6294 | 1700 | 0.5368 | 1.1245 | 0.9657 |
9.1371 | 1800 | 0.5186 | 1.1179 | 0.9686 |
9.6447 | 1900 | 0.5169 | 1.1024 | 0.9771 |
Framework Versions
- Python: 3.11.6
- Sentence Transformers: 3.5.0.dev0
- Transformers: 4.43.4
- PyTorch: 2.6.0
- Accelerate: 0.33.0
- Datasets: 2.14.4
- Tokenizers: 0.19.1
Citation
BibTeX
Sentence Transformers
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
MultipleNegativesRankingLoss
@misc{henderson2017efficient,
title={Efficient Natural Language Response Suggestion for Smart Reply},
author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
year={2017},
eprint={1705.00652},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
Inference Providers
NEW
This model is not currently available via any of the supported Inference Providers.
Evaluation results
- Cosine Accuracy on Unknownself-reported0.483
- Cosine Accuracy on Unknownself-reported0.977