Views
No views yet
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': 384, 'pooling_mode': 'mean', 'include_prompt': True})
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("philipp-zettl/MiniLM-L3-H384-uncased-mtg-v2")
5# Run inference
6sentences = [
7 'vigilance\nwhenever this creature enters or attacks, you may return target permanent card with mana value 3 or less from your graveyard to the battlefield',
8 'Title: Sun Titan\nCost: {4}{W}{W}\nColors: W\nType: Creature — Giant\nDesc: Vigilance\nWhenever this creature enters or attacks, you may return target permanent card with mana value 3 or less from your graveyard to the battlefield.',
9 'Title: Baloth Pup\nCost: {1}{G}\nColors: G\nType: Creature — Beast\nDesc: This creature has trample as long as it has a +1/+1 counter on it.',
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 384]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities)
18# tensor([[1.0000, 0.6280, 0.0774],
19# [0.6280, 1.0000, 0.2148],
20# [0.0774, 0.2148, 1.0000]])sentence_0 and sentence_1| sentence_0 | sentence_1 | |
|---|---|---|
| type | string | string |
| modality | text | text |
| details |
|
|
| sentence_0 | sentence_1 |
|---|---|
mind rot | Title: Mind Rot[object Object]Cost: {2}{B}[object Object]Colors: B[object Object]Type: Sorcery[object Object]Desc: Target player discards two cards. |
that creature doesn't untap during its controller's next untap step | Title: Watertrap Weaver[object Object]Cost: {2}{U}[object Object]Colors: U[object Object]Type: Creature — Merfolk Wizard[object Object]Desc: When this creature enters, tap target creature an opponent controls. That creature doesn't untap during its controller's next untap step. |
kardur, doomscourge | Title: Kardur, Doomscourge[object Object]Cost: {2}{B}{R}[object Object]Colors: B, R[object Object]Type: Legendary Creature — Demon Berserker[object Object]Desc: When Kardur enters, until your next turn, creatures your opponents control attack each combat if able and attack a player other than you if able.[object Object]Whenever an attacking creature dies, each opponent loses 1 life and you gain 1 life. |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim",
4 "gather_across_devices": false,
5 "directions": [
6 "query_to_doc"
7 ],
8 "partition_mode": "joint",
9 "hardness_mode": null,
10 "hardness_strength": 0.0
11}per_device_train_batch_size: 96fp16: Trueper_device_eval_batch_size: 96multi_dataset_batch_sampler: round_robinper_device_train_batch_size: 96num_train_epochs: 3max_steps: -1learning_rate: 5e-05lr_scheduler_type: linearlr_scheduler_kwargs: Nonewarmup_steps: 0optim: adamw_torch_fusedoptim_args: Noneweight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 1average_tokens_across_devices: Truemax_grad_norm: 1label_smoothing_factor: 0.0bf16: Falsefp16: Truebf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Nonetorch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneuse_liger_kernel: Falseliger_kernel_config: Noneuse_cache: Falseneftune_noise_alpha: Nonetorch_empty_cache_steps: Noneauto_find_batch_size: Falselog_on_each_node: Truelogging_nan_inf_filter: Trueinclude_num_input_tokens_seen: nolog_level: passivelog_level_replica: warningdisable_tqdm: Falseproject: huggingfacetrackio_space_id: Nonetrackio_bucket_id: Nonetrackio_static_space_id: Noneper_device_eval_batch_size: 96prediction_loss_only: Trueeval_on_start: Falseeval_do_concat_batches: Trueeval_use_gather_object: Falseeval_accumulation_steps: Noneinclude_for_metrics: []batch_eval_metrics: Falsesave_only_model: Falsesave_on_each_node: Falseenable_jit_checkpoint: Falsepush_to_hub: Falsehub_private_repo: Nonehub_model_id: Nonehub_strategy: every_savehub_always_push: Falsehub_revision: Noneload_best_model_at_end: Falseignore_data_skip: Falserestore_callback_states_from_checkpoint: Falsefull_determinism: Falseseed: 42data_seed: Noneuse_cpu: Falseaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedataloader_drop_last: Falsedataloader_num_workers: 0dataloader_pin_memory: Truedataloader_persistent_workers: Falsedataloader_prefetch_factor: Noneremove_unused_columns: Truelabel_names: Nonetrain_sampling_strategy: randomlength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falseddp_static_graph: Noneddp_backend: Noneddp_timeout: 1800fsdp: Nonefsdp_config: Nonedeepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonewarmup_ratio: Nonelocal_rank: -1prompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robinrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss |
|---|---|---|
| 0.0225 | 500 | 3.3970 |
| 0.0450 | 1000 | 1.2978 |
| 0.0675 | 1500 | 0.9287 |
| 0.0900 | 2000 | 0.7950 |
| 0.1125 | 2500 | 0.7100 |
| 0.1350 | 3000 | 0.6584 |
| 0.1575 | 3500 | 0.6290 |
| 0.1800 | 4000 | 0.5884 |
| 0.2025 | 4500 | 0.5633 |
| 0.2250 | 5000 | 0.5537 |
| 0.2475 | 5500 | 0.5350 |
| 0.2701 | 6000 | 0.5262 |
| 0.2926 | 6500 | 0.5068 |
| 0.3151 | 7000 | 0.4917 |
| 0.3376 | 7500 | 0.4840 |
| 0.3601 | 8000 | 0.4758 |
| 0.3826 | 8500 | 0.4650 |
| 0.4051 | 9000 | 0.4604 |
| 0.4276 | 9500 | 0.4589 |
| 0.4501 | 10000 | 0.4412 |
| 0.4726 | 10500 | 0.4391 |
| 0.4951 | 11000 | 0.4352 |
| 0.5176 | 11500 | 0.4323 |
| 0.5401 | 12000 | 0.4235 |
| 0.5626 | 12500 | 0.4158 |
| 0.5851 | 13000 | 0.4161 |
| 0.6076 | 13500 | 0.4205 |
| 0.6301 | 14000 | 0.4180 |
| 0.6526 | 14500 | 0.4073 |
| 0.6751 | 15000 | 0.4053 |
| 0.6976 | 15500 | 0.4019 |
| 0.7201 | 16000 | 0.4002 |
| 0.7426 | 16500 | 0.3985 |
| 0.7651 | 17000 | 0.3952 |
| 0.7876 | 17500 | 0.3942 |
| 0.8102 | 18000 | 0.3847 |
| 0.8327 | 18500 | 0.3846 |
| 0.8552 | 19000 | 0.3853 |
| 0.8777 | 19500 | 0.3868 |
| 0.9002 | 20000 | 0.3852 |
| 0.9227 | 20500 | 0.3781 |
| 0.9452 | 21000 | 0.3725 |
| 0.9677 | 21500 | 0.3784 |
| 0.9902 | 22000 | 0.3751 |
| 1.0127 | 22500 | 0.3685 |
| 1.0352 | 23000 | 0.3663 |
| 1.0577 | 23500 | 0.3722 |
| 1.0802 | 24000 | 0.3667 |
| 1.1027 | 24500 | 0.3656 |
| 1.1252 | 25000 | 0.3646 |
| 1.1477 | 25500 | 0.3600 |
| 1.1702 | 26000 | 0.3618 |
| 1.1927 | 26500 | 0.3625 |
| 1.2152 | 27000 | 0.3540 |
| 1.2377 | 27500 | 0.3662 |
| 1.2602 | 28000 | 0.3581 |
| 1.2827 | 28500 | 0.3521 |
| 1.3052 | 29000 | 0.3541 |
| 1.3278 | 29500 | 0.3506 |
| 1.3503 | 30000 | 0.3574 |
| 1.3728 | 30500 | 0.3530 |
| 1.3953 | 31000 | 0.3551 |
| 1.4178 | 31500 | 0.3579 |
| 1.4403 | 32000 | 0.3555 |
| 1.4628 | 32500 | 0.3572 |
| 1.4853 | 33000 | 0.3545 |
| 1.5078 | 33500 | 0.3433 |
| 1.5303 | 34000 | 0.3497 |
| 1.5528 | 34500 | 0.3511 |
| 1.5753 | 35000 | 0.3515 |
| 1.5978 | 35500 | 0.3454 |
| 1.6203 | 36000 | 0.3507 |
| 1.6428 | 36500 | 0.3486 |
| 1.6653 | 37000 | 0.3493 |
| 1.6878 | 37500 | 0.3487 |
| 1.7103 | 38000 | 0.3430 |
| 1.7328 | 38500 | 0.3447 |
| 1.7553 | 39000 | 0.3483 |
| 1.7778 | 39500 | 0.3385 |
| 1.8003 | 40000 | 0.3443 |
| 1.8228 | 40500 | 0.3424 |
| 1.8454 | 41000 | 0.3448 |
| 1.8679 | 41500 | 0.3402 |
| 1.8904 | 42000 | 0.3425 |
| 1.9129 | 42500 | 0.3452 |
| 1.9354 | 43000 | 0.3397 |
| 1.9579 | 43500 | 0.3353 |
| 1.9804 | 44000 | 0.3393 |
| 2.0029 | 44500 | 0.3441 |
| 2.0254 | 45000 | 0.3375 |
| 2.0479 | 45500 | 0.3378 |
| 2.0704 | 46000 | 0.3339 |
| 2.0929 | 46500 | 0.3408 |
| 2.1154 | 47000 | 0.3330 |
| 2.1379 | 47500 | 0.3343 |
| 2.1604 | 48000 | 0.3365 |
| 2.1829 | 48500 | 0.3363 |
| 2.2054 | 49000 | 0.3311 |
| 2.2279 | 49500 | 0.3377 |
| 2.2504 | 50000 | 0.3314 |
| 2.2729 | 50500 | 0.3399 |
| 2.2954 | 51000 | 0.3336 |
| 2.3179 | 51500 | 0.3333 |
| 2.3404 | 52000 | 0.3322 |
| 2.3629 | 52500 | 0.3322 |
| 2.3855 | 53000 | 0.3282 |
| 2.4080 | 53500 | 0.3364 |
| 2.4305 | 54000 | 0.3303 |
| 2.4530 | 54500 | 0.3323 |
| 2.4755 | 55000 | 0.3294 |
| 2.4980 | 55500 | 0.3315 |
| 2.5205 | 56000 | 0.3315 |
| 2.5430 | 56500 | 0.3346 |
| 2.5655 | 57000 | 0.3374 |
| 2.5880 | 57500 | 0.3290 |
| 2.6105 | 58000 | 0.3338 |
| 2.6330 | 58500 | 0.3316 |
| 2.6555 | 59000 | 0.3314 |
| 2.6780 | 59500 | 0.3334 |
| 2.7005 | 60000 | 0.3305 |
| 2.7230 | 60500 | 0.3311 |
| 2.7455 | 61000 | 0.3313 |
| 2.7680 | 61500 | 0.3303 |
| 2.7905 | 62000 | 0.3280 |
| 2.8130 | 62500 | 0.3303 |
| 2.8355 | 63000 | 0.3282 |
| 2.8580 | 63500 | 0.3374 |
| 2.8805 | 64000 | 0.3313 |
| 2.9031 | 64500 | 0.3330 |
| 2.9256 | 65000 | 0.3331 |
| 2.9481 | 65500 | 0.3240 |
| 2.9706 | 66000 | 0.3260 |
| 2.9931 | 66500 | 0.3298 |
1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}1@misc{oord2019representationlearningcontrastivepredictive,
2 title={Representation Learning with Contrastive Predictive Coding},
3 author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
4 year={2019},
5 eprint={1807.03748},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG},
8 url={https://arxiv.org/abs/1807.03748},
9}