CoolFace
Modelpublic

johnyy212/moe-girl-v2

sourceHugging Faceupdated 5mo agoView on Hugging Face
0likes81downloads
Model Card

SentenceTransformer based on BAAI/bge-small-zh-v1.5

This is a sentence-transformers model finetuned from BAAI/bge-small-zh-v1.5 on the json dataset. It maps sentences & paragraphs to a 512-dimensional dense vector space and can be used for retrieval.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: BAAI/bge-small-zh-v1.5 <!-- at revision 7999e1d3359715c523056ef9478215996d62a620 -->
  • Maximum Sequence Length: 512 tokens
  • Output Dimensionality: 512 dimensions
  • Similarity Function: Cosine Similarity
  • Supported Modality: Text
  • Training Dataset:
  • json <!-- - Language: Unknown --> <!-- - License: Unknown -->

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'BertModel'})
  (1): Pooling({'embedding_dimension': 512, 'pooling_mode': 'cls', 'include_prompt': True})
  (2): Normalize({})
)

Usage

Direct Usage (Sentence Transformers)

First install the Sentence Transformers library:

bash
pip install -U sentence-transformers

Then you can load this model and run inference.

python
from sentence_transformers import SentenceTransformer

# Download from the 🤗 Hub
model = SentenceTransformer("johnyy212/moe-girl-v2")
# Run inference
sentences = [
    '熟女、A型、召唤能力者',
    '角色:文豪野犬:尾崎红叶\n本名:尾崎、红叶、Ozaki Kouyou\n别名:红叶大姐、红叶君\n声优:小清水亚美\n发色:红\n瞳色:红\n生日:1月10日\n星座:摩羯\n血型:A\n萌点:和服、遮眼发、超能力者、熟女',
    '文豪野犬:尾崎红叶',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 512]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[ 1.0000,  0.3878, -0.0819],
#         [ 0.3878,  1.0000,  0.0236],
#         [-0.0819,  0.0236,  1.0000]])

<!--

Direct Usage (Transformers)

<details><summary>Click to see the direct usage in Transformers</summary>

</details> -->

<!--

Downstream Usage (Sentence Transformers)

You can finetune this model on your own dataset.

<details><summary>Click to expand</summary>

</details> -->

<!--

Out-of-Scope Use

List how the model may foreseeably be misused and address what users ought not to do with the model. -->

<!--

Bias, Risks and Limitations

What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model. -->

<!--

Recommendations

What are recommendations with respect to the foreseeable issues? For example, filtering explicit content. -->

Training Details

Training Dataset

json
  • Dataset: json
  • Size: 56,574 training samples
  • Columns: <code>anchor</code>, <code>positive</code>, and <code>char_name</code>
  • Approximate statistics based on the first 1000 samples: | | anchor | positive | char_name | |:--------|:----------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 4 tokens</li><li>mean: 11.84 tokens</li><li>max: 34 tokens</li></ul> | <ul><li>min: 12 tokens</li><li>mean: 80.61 tokens</li><li>max: 295 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 7.38 tokens</li><li>max: 48 tokens</li></ul> |
  • Samples: | anchor | positive | char_name | |:---------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------------| | <code>井上和彦、早水理沙</code> | <code>角色:黑田<br>本名:黒田<br>别名:小黑、幼年时<br>声优:小野友树、小野友树配音角色、井上和彦、井上和彦配音角色、早水理沙、早水理沙配音角色<br>发色:黑<br>瞳色:灰蓝<br>萌点:现在、工程师、浴衣、绷带、遮眼发、烟斗、人偶师、大叔、毒舌、反差萌、贪财、心理创伤、青年时、幼驯染、搞事、天才、傲娇、腹黑、强气、双向暗恋、单马尾、天然疯、武士、蔷薇</code> | <code>黑田</code> | | <code>平田裕香</code> | <code>角色:寺门卷子<br>本名:寺门 巻子<br>声优:平田裕香<br>萌点:同级生</code> | <code>寺门卷子</code> | | <code>蝴蝶结、高跟鞋、麦克风、制服、伞、乙女</code> | <code>角色:瞳(LIVE A HERO)<br>本名:绫歌瞳<br>别名:仁美、爱抖露<br>声优:夏怜<br>发色:黑<br>瞳色:渐变<br>萌点:麦克风、乙女、歌手、偶像、暴力女、短发、丸子头、耳环、制服、伞、比基尼、外套半脱、手套、蝴蝶结、百褶裙、长筒袜、四分之三袜、高跟鞋、元气、光</code> | <code>瞳(LIVE A HERO)</code> |
  • Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim",
      "gather_across_devices": false,
      "directions": [
          "query_to_doc"
      ],
      "partition_mode": "joint",
      "hardness_mode": null,
      "hardness_strength": 0.0
  }

Evaluation Dataset

json
  • Dataset: json
  • Size: 3,403 evaluation samples
  • Columns: <code>anchor</code>, <code>positive</code>, and <code>char_name</code>
  • Approximate statistics based on the first 1000 samples: | | anchor | positive | char_name | |:--------|:----------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------| | type | string | string | string | | details | <ul><li>min: 9 tokens</li><li>mean: 15.96 tokens</li><li>max: 30 tokens</li></ul> | <ul><li>min: 30 tokens</li><li>mean: 80.32 tokens</li><li>max: 512 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 7.28 tokens</li><li>max: 26 tokens</li></ul> |
  • Samples: | anchor | positive | char_name | |:-------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------| | <code>小天使、发珠、料理达人、傲娇、长直</code> | <code>角色:云雀丘琉璃<br>本名:云雀丘瑠璃<br>别名:云雀、ヒバリ、本场琉璃<br>声优:白石晴香<br>发色:琉璃色黑<br>瞳色:绿<br>生日:7月9日<br>星座:巨蟹<br>血型:B<br>萌点:不幸、单恋、微傲娇、小天使、美少女、认真、人妻、料理达人、长直、吊眼、发珠、高跟鞋、绝对领域</code> | <code>云雀丘琉璃</code> | | <code>黑瞳、银发、特工、B型</code> | <code>角色:风间让二<br>本名:风间、譲二<br>别名:二叔<br>声优:渡哲也配音角色<br>发色:灰<br>瞳色:黑<br>年龄:64<br>血型:B<br>萌点:特工、弟弟、长者、双胞胎</code> | <code>风间让二</code> | | <code>红发、机郎、傲娇、蓝瞳</code> | <code>角色:爱因兹希<br>本名:爱因兹希<br>别名:全连结指挥体<br>声优:诹访部顺一<br>发色:红<br>瞳色:蓝<br>萌点:机郎、傲娇、基佬</code> | <code>爱因兹希</code> |
  • Loss: <code>MultipleNegativesRankingLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "cos_sim",
      "gather_across_devices": false,
      "directions": [
          "query_to_doc"
      ],
      "partition_mode": "joint",
      "hardness_mode": null,
      "hardness_strength": 0.0
  }

Training Hyperparameters

Non-Default Hyperparameters
  • per_device_train_batch_size: 64
  • learning_rate: 2e-05
  • num_train_epochs: 5
  • warmup_steps: 0.1
  • fp16: True
  • load_best_model_at_end: True
  • batch_sampler: no_duplicates
All Hyperparameters

<details><summary>Click to expand</summary>

  • do_predict: False
  • prediction_loss_only: True
  • per_device_train_batch_size: 64
  • per_device_eval_batch_size: 8
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 2e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1.0
  • num_train_epochs: 5
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: None
  • warmup_ratio: None
  • warmup_steps: 0.1
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • enable_jit_checkpoint: False
  • save_on_each_node: False
  • save_only_model: False
  • restore_callback_states_from_checkpoint: False
  • use_cpu: False
  • seed: 42
  • data_seed: None
  • bf16: False
  • fp16: True
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • local_rank: -1
  • ddp_backend: None
  • debug: []
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_prefetch_factor: None
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: True
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}
  • parallelism_config: None
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamwtorchfused
  • optim_args: None
  • group_by_length: False
  • length_column_name: length
  • project: huggingface
  • trackio_space_id: trackio
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • skip_memory_metrics: True
  • push_to_hub: False
  • resume_from_checkpoint: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_private_repo: None
  • hub_always_push: False
  • hub_revision: None
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_for_metrics: []
  • eval_do_concat_batches: True
  • auto_find_batch_size: False
  • full_determinism: False
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • include_num_input_tokens_seen: no
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • eval_on_start: False
  • use_liger_kernel: False
  • liger_kernel_config: None
  • eval_use_gather_object: False
  • average_tokens_across_devices: True
  • use_cache: False
  • prompts: None
  • batch_sampler: no_duplicates
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

</details>

Training Logs

EpochStepTraining LossValidation Loss
0.11311002.4777-
0.22622001.2126-
0.33943000.9734-
0.45254000.8498-
0.56565000.8329-
0.67876000.7920-
0.79197000.7039-
0.90508000.7013-
1.0884-0.1582
1.01819000.6741-
1.131210000.6307-
1.244311000.6224-
1.357512000.6090-
1.470613000.5913-
1.583714000.5812-
1.696815000.5711-
1.810016000.5614-
1.923117000.5973-
2.01768-0.1351
2.036218000.5275-
2.149319000.5139-
2.262420000.4939-
2.375621000.5008-
2.488722000.5044-
2.601823000.4932-
2.714924000.5083-
2.828125000.5151-
2.941226000.4993-
3.02652-0.1247
3.054327000.4770-
3.167428000.4751-
3.280529000.4676-
3.393730000.4480-
3.506831000.4579-
3.619932000.4581-
3.733033000.4524-
3.846234000.4532-
3.959335000.4493-
4.03536-0.1188
4.072436000.4443-
4.185537000.4296-
4.298638000.4117-
4.411839000.4397-
4.524940000.4223-
4.638041000.4448-
4.751142000.4304-
4.864343000.4494-
4.977444000.4271-
5.04420-0.1192
  • The bold row denotes the saved checkpoint.

Training Time

  • Training: 14.9 minutes

Framework Versions

  • Python: 3.12.13
  • Sentence Transformers: 5.4.1
  • Transformers: 5.0.0
  • PyTorch: 2.10.0+cu128
  • Accelerate: 1.13.0
  • Datasets: 4.8.5
  • Tokenizers: 0.22.2

Citation

BibTeX

Sentence Transformers
bibtex
@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
bibtex
@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},
}

<!--

Glossary

Clearly define terms in order to be accessible across audiences. -->

<!--

Model Card Authors

Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction. -->

<!--

Model Card Contact

Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors. -->