SentenceTransformer based on google/embeddinggemma-2

This is a sentence-transformers model finetuned from google/embeddinggemma-2 on the img2img and img2text datasets. It maps inputs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: google/embeddinggemma-2
  • Maximum Sequence Length: 1000000000000000019884624838656 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity
  • Supported Modalities: Text, Image, Audio, Video, Message
  • Training Datasets:
    • img2img
    • img2text

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}, 'image': {'method': 'forward', 'method_output_name': 'last_hidden_state'}, 'audio': {'method': 'forward', 'method_output_name': 'last_hidden_state'}, 'video': {'method': 'forward', 'method_output_name': 'last_hidden_state'}, 'message': {'method': 'forward', 'method_output_name': 'last_hidden_state', 'format': 'structured'}}, 'module_output_name': 'token_embeddings', 'architecture': 'EmbeddingGemma2Model'})
  (1): Pooling({'embedding_dimension': 768, 'pooling_mode': 'mean', 'include_prompt': True})
  (2): Normalize({'module_input_name': 'sentence_embedding', 'module_output_name': 'sentence_embedding'})
)

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("sentence_transformers_model_id")
# Run inference
queries = [
    'https://huggingface.co/AIFurryArt/Furrender4/resolve/main/images/image_20260429_124316_00001_.png',
]
documents = [
    'https://huggingface.co/AIFurryArt/Furrender4/resolve/main/images/image_20260429_143546_00001_.png',
    'https://huggingface.co/Airmongsity/Qwen-Image-2.1-Sts2-Cards-Drawer/resolve/main/samples/bicycle_cfg3.png',
    'https://huggingface.co/Alex995647/loras-qwen-image/resolve/main/luisap-cyber-hard-edge-refiner-qwen-sd-1-5/example_images/01_poster.jpg',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 768] [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[0.7789, 0.2734, 0.3807]])

Training Details

Training Datasets

img2img

img2text

  • Dataset: img2text
  • Size: 1,281 training samples
  • Columns: anchor, positive, and label
  • Approximate statistics based on the first 100 samples:
    anchor positive label
    type string string int
    modality image text
    details
    • min: 90 tokens
    • mean: 136.13 tokens
    • max: 215 tokens
    • 0: ~0.96%
    • 1: ~2.88%
    • 2: ~2.88%
    • 3: ~24.04%
    • 4: ~3.85%
    • 5: ~2.88%
    • 6: ~2.88%
    • 7: ~0.96%
    • 8: ~3.85%
    • 9: ~1.92%
    • 10: ~1.92%
    • 11: ~0.96%
    • 12: ~2.88%
    • 13: ~0.96%
    • 14: ~4.81%
    • 15: ~17.31%
    • 16: ~0.96%
    • 17: ~4.81%
    • 18: ~4.81%
    • 19: ~5.77%
    • 20: ~6.73%
    • 21: ~0.96%
  • Samples:
    anchor positive label
    https://huggingface.co/1G1/model_1/resolve/main/images/DreamShaper_v7_bugatti_chiron_car_gold_black_and_brown_color_f_1.jpg model 1. tags: - text-to-image - lora - diffusers - template:diffusion-lora widget: - output: url: - images/DreamShaper v7 bugatti chiron car gold black and brown color f 0.jpg text: '-' - output: url: - images/DreamShaper v7 bugatti chiron car gold black and brown color f 1.jpg text: '-' base model: Qwen/Qwen-Image instance prompt: null license: unknown --- model 0
    https://huggingface.co/AIFurryArt/Furrender4/resolve/main/images/image_20260429_124316_00001_.png Furrender4. tags: - text-to-image - lora - diffusers - template:diffusion-lora widget: - output: url: images/image 20260429 143400 00001 .png text: '-' - output: url: images/image 20260429 143546 00001 .png text: '-' - output: url: images/image 20260429 124316 00001 .png text: '-' - output: url: images/image 20260429 144246 00001 .png text: '-' base model: Qwen/Qwen-Image-2512 instance prompt: null licens 1
    https://huggingface.co/AIFurryArt/Furrender4/resolve/main/images/image_20260429_143400_00001_.png Furrender4. tags: - text-to-image - lora - diffusers - template:diffusion-lora widget: - output: url: images/image 20260429 143400 00001 .png text: '-' - output: url: images/image 20260429 143546 00001 .png text: '-' - output: url: images/image 20260429 124316 00001 .png text: '-' - output: url: images/image 20260429 144246 00001 .png text: '-' base model: Qwen/Qwen-Image-2512 instance prompt: null licens 1
  • Loss: MatryoshkaLoss with these parameters:
    {
        "loss": "CachedMultipleNegativesRankingLoss",
        "matryoshka_dims": [
            768,
            512,
            256,
            128
        ],
        "matryoshka_weights": [
            1,
            1,
            1,
            1
        ],
        "n_dims_per_step": -1
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • warmup_steps: 0.1
  • gradient_accumulation_steps: 4
  • gradient_checkpointing: True
  • gradient_checkpointing_kwargs: {'use_reentrant': False}
  • seed: 0
  • dataloader_num_workers: 2
  • prompts: {'positive': 'title: none | text: '}
  • multi_dataset_batch_sampler: round_robin

All Hyperparameters

Click to expand
  • per_device_train_batch_size: 8
  • num_train_epochs: 3
  • max_steps: -1
  • learning_rate: 5e-05
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: None
  • warmup_steps: 0.1
  • optim: adamw_torch_fused
  • optim_args: None
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • optim_target_modules: None
  • gradient_accumulation_steps: 4
  • average_tokens_across_devices: True
  • max_grad_norm: 1.0
  • label_smoothing_factor: 0.0
  • bf16: False
  • fp16: False
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • gradient_checkpointing: True
  • gradient_checkpointing_kwargs: {'use_reentrant': False}
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • use_liger_kernel: False
  • liger_kernel_config: None
  • use_cache: False
  • neftune_noise_alpha: None
  • torch_empty_cache_steps: None
  • auto_find_batch_size: False
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • include_num_input_tokens_seen: no
  • log_level: passive
  • log_level_replica: warning
  • disable_tqdm: False
  • project: huggingface
  • trackio_space_id: None
  • trackio_bucket_id: None
  • trackio_static_space_id: None
  • per_device_eval_batch_size: 8
  • prediction_loss_only: True
  • eval_on_start: False
  • eval_do_concat_batches: True
  • eval_use_gather_object: False
  • eval_accumulation_steps: None
  • include_for_metrics: []
  • batch_eval_metrics: False
  • save_only_model: False
  • save_on_each_node: False
  • enable_jit_checkpoint: False
  • push_to_hub: False
  • hub_private_repo: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_always_push: False
  • hub_revision: None
  • load_best_model_at_end: False
  • ignore_data_skip: False
  • restore_callback_states_from_checkpoint: False
  • full_determinism: False
  • seed: 0
  • data_seed: None
  • use_cpu: False
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • parallelism_config: None
  • dataloader_drop_last: False
  • dataloader_num_workers: 2
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • dataloader_prefetch_factor: None
  • dataloader_multiprocessing_context: None
  • dataloader_in_order: True
  • remove_unused_columns: True
  • label_names: None
  • train_sampling_strategy: random
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • ddp_static_graph: None
  • ddp_backend: None
  • ddp_timeout: 1800
  • fsdp: None
  • fsdp_config: None
  • deepspeed: None
  • debug: []
  • skip_memory_metrics: True
  • do_predict: False
  • resume_from_checkpoint: None
  • local_rank: -1
  • prompts: {'positive': 'title: none | text: '}
  • multi_dataset_batch_sampler: round_robin
  • router_mapping: {}
  • learning_rate_mapping: {}
  • warmup_ratio: None

Training Logs

Click to expand
Epoch Step Training Loss
0.0270 1 4.9033
0.0541 2 4.8180
0.0811 3 4.5931
0.1081 4 4.9924
0.1351 5 4.7250
0.1622 6 4.4046
0.1892 7 4.1512
0.2162 8 4.9469
0.2432 9 3.9789
0.2703 10 3.4333
0.2973 11 4.5601
0.3243 12 3.5051
0.3514 13 3.8203
0.3784 14 3.2145
0.4054 15 3.1062
0.4324 16 3.4170
0.4595 17 1.7697
0.4865 18 2.3831
0.5135 19 2.9564
0.5405 20 2.9502
0.5676 21 2.0586
0.5946 22 0.9950
0.6216 23 2.1131
0.6486 24 1.4838
0.6757 25 3.4937
0.7027 26 3.6294
0.7297 27 3.0332
0.7568 28 2.4071
0.7838 29 1.1775
0.8108 30 2.8131
0.8378 31 1.5081
0.8649 32 2.3825
0.8919 33 2.8080
0.9189 34 4.0398
0.9459 35 3.8710
0.9730 36 2.6129
1.0 37 2.2913
1.0270 38 1.2656
1.0541 39 1.2016
1.0811 40 1.4087
1.1081 41 1.7025
1.1351 42 0.9100
1.1622 43 0.7910
1.1892 44 0.5866
1.2162 45 0.7964
1.2432 46 0.6482
1.2703 47 0.4225
1.2973 48 0.9907
1.3243 49 1.1700
1.3514 50 1.0258
1.3784 51 0.3217
1.4054 52 0.7180
1.4324 53 0.6770
1.4595 54 0.1851
1.4865 55 0.5854
1.5135 56 0.3662
1.5405 57 0.5529
1.5676 58 0.2490
1.5946 59 0.0477
1.6216 60 0.3383
1.6486 61 0.2384
1.6757 62 0.8208
1.7027 63 0.5681
1.7297 64 1.5960
1.7568 65 0.3041
1.7838 66 0.2878
1.8108 67 0.9916
1.8378 68 0.1962
1.8649 69 0.4185
1.8919 70 0.5600
1.9189 71 1.4224
1.9459 72 1.5598
1.9730 73 0.6204
2.0 74 0.6017
2.0270 75 0.2693
2.0541 76 0.6998
2.0811 77 0.8660
2.1081 78 0.6217
2.1351 79 0.4224
2.1622 80 0.1109
2.1892 81 0.1001
2.2162 82 0.1740
2.2432 83 0.1012
2.2703 84 0.0775
2.2973 85 0.1709
2.3243 86 0.1938
2.3514 87 0.2603
2.3784 88 0.0836
2.4054 89 0.2129
2.4324 90 0.2166
2.4595 91 0.0363
2.4865 92 0.1695
2.5135 93 0.0991
2.5405 94 0.1143
2.5676 95 0.0511
2.5946 96 0.0108
2.6216 97 0.0765
2.6486 98 0.0521
2.6757 99 0.3322
2.7027 100 0.1612
2.7297 101 1.0232
2.7568 102 0.1001
2.7838 103 0.1492
2.8108 104 0.5836
2.8378 105 0.0797
2.8649 106 0.1807
2.8919 107 0.2683
2.9189 108 0.8831
2.9459 109 1.1199
2.9730 110 0.3995
3.0 111 0.3393

Training Time

  • Training: 29.5 minutes

Framework Versions

  • Python: 3.12.12
  • Sentence Transformers: 6.1.0
  • Transformers: 5.19.0
  • PyTorch: 2.14.1+cu130
  • Accelerate: 1.15.0
  • Datasets: 5.1.0
  • Tokenizers: 0.23.2

Additional Resources

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",
}

MatryoshkaLoss

@misc{kusupati2024matryoshka,
    title={Matryoshka Representation Learning},
    author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
    year={2024},
    eprint={2205.13147},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}

CachedMultipleNegativesRankingLoss

@misc{gao2021scaling,
    title={Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
    author={Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
    year={2021},
    eprint={2101.06983},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}

MultipleNegativesRankingLoss

@misc{oord2019representationlearningcontrastivepredictive,
      title={Representation Learning with Contrastive Predictive Coding},
      author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
      year={2019},
      eprint={1807.03748},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/1807.03748},
}
Downloads last month
17
Safetensors
Model size
0.4B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for ysharma/embeddinggemma-2-lora-finder

Finetuned
(47)
this model

Papers for ysharma/embeddinggemma-2-lora-finder