Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Paper • 1908.10084 • Published • 19
How to use eftpmc/tipofmyjoystick-identification with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("eftpmc/tipofmyjoystick-identification")
sentences = [
"[Ps1-ps2][2000+]blonde guy with sword\n\nI remember the intro was a dragon flying over a yellow city, sandy roads.\n\nThe first guy we play as i assume is the mc, not sure if he was an elf or not, he reminds alot of cloud from FF but im not sure if thats what im looking for.\n\nSecond guy we are able to play was a dark skinned dude with guns.\n\nThen i remember the third one was a girl who had pointy shoes and her attacks are kicks, we got to play her first on a ship.\n\nThe blonde dude with sword i think had a tattoo on one of his eyes? He was also able to electrify his sword.\n\nWe used to fight the dragon in in the city snd hit its ankles.\n\nYou got access to these characters as you progressed through the story.\n\nThats all i remember for now.",
"rogue galaxy",
"[Playstation2] [2012-2013] Been looking for this game for a while\n\nOkay so there’s this game from my childhood that I’ve been trying to find. I played it in like early 2013 or 2012 can’t remember exactly but \n\nIt’s a playstation 2 game \n\nThe main character was a guy who had a tattoo on his arm ( deltoid area). He has brown hair and like two strands that come over his face rest of his hair was tied back in a pony tail. His outfit had blue and his bottoms were knee length. He carried a sword . The game he goes on quest and fights these like monsters looking kangaroo things. In his village there was this girl she has red hair and is braided to the side . She was one of the main characters",
"[PS2][2012-2014] Racing game similar to Forza or whatever.\n\nWhen I was around 5 or 6 years old, I had won my first video game, a PS2, that was in 2012, I don't know if it was the same year but I know it was close, I played an amazing racing game, it had some maps very cool, one that looked like a professional car track or whatever, and there was one that looked like a boreal forest in autumn (the leaves turn yellow and orange), I'm from Brazil and piracy here is very big , so I can't say if I bought the game at some fair or if it came with the PS2, as I remember playing this game very close to when they bought my PS2, the last details I remember are that the menu apparently had a design with white letters on blocks with transparent background, and, that the starting car of the game was some blue car with white stripes, I had 2 controllers and I don't remember playing against my sister, so maybe it doesn't have Multiplayer, hope you help me to find this game."
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [4, 4]This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L6-v2. It maps sentences & paragraphs to a 384-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
SentenceTransformer(
(0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: BertModel
(1): Pooling({'word_embedding_dimension': 384, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
(2): Normalize()
)
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
sentences = [
"[PC] [2000s] Western themed kids game with blue main character?\n\nI'm re-visiting a bunch of games from my childhood, and I cannot for the life of me remember what this game is called. It was a western themed game in a cartoony style, and I'm pretty sure that the main character was a little blue monster, possibly with a bandana? \n\n\nI'm pretty sure it was an educational game, since my parents didn't really buy me non-educational CD-ROMs as a kid. If I remember correctly, you were in a town, and could go to various other places around the town with other characters. I know there's a Fisher Price game that's western themed with a town, but it wasn't that one.",
'kid phonics 2',
'the scruffs',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
sentence_0 and sentence_1| sentence_0 | sentence_1 | |
|---|---|---|
| type | string | string |
| details |
|
|
| sentence_0 | sentence_1 |
|---|---|
[PC BROWSER] [LATE 2000] Old flash, creepy, mystery, puzzle game |
[PC] [Unknown] Game about a child on the moon |
[PC][early 2000s] Kid’s game with pirate mice |
[PC] [late 1990s-early 2000s] educational children's game with female mouse who sails on a ship |
All I know is there was a shark scene |
universal studios theme park adventure for gamecube |
MultipleNegativesRankingLoss with these parameters:{
"scale": 20.0,
"similarity_fct": "cos_sim"
}
per_device_train_batch_size: 128per_device_eval_batch_size: 128multi_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 128per_device_eval_batch_size: 128per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1num_train_epochs: 3max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_ratio: 0.0warmup_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: 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}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torchoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthproject: huggingfacetrackio_space_id: trackioddp_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: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_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: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: noneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Trueprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robin| Epoch | Step | Training Loss |
|---|---|---|
| 0.2308 | 500 | 3.4998 |
| 0.4617 | 1000 | 2.8783 |
| 0.6925 | 1500 | 2.6795 |
| 0.9234 | 2000 | 2.5377 |
| 1.1542 | 2500 | 2.3956 |
| 1.3850 | 3000 | 2.3053 |
| 1.6159 | 3500 | 2.2521 |
| 1.8467 | 4000 | 2.2323 |
| 2.0776 | 4500 | 2.163 |
| 2.3084 | 5000 | 2.1002 |
| 2.5392 | 5500 | 2.0794 |
| 2.7701 | 6000 | 2.0712 |
@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",
}
@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}
}
Base model
nreimers/MiniLM-L6-H384-uncased