CoolFace
Modelpublic

nphach/jp-parallel-gloss

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes109downloads
Model Card

jp-parallel-gloss

jp-parallel-gloss makes predictions on similarity of Japanese-to-English glosses (definitions). This is a sentence-transformers model fine-tuned using a dataset of 4M+ parallel/non-parallel gloss pairs from the JMDict database and antonym/synonym pairs from WordNet. The base model used is cross-encoder/ms-macro-MiniLM-L-6-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. See its application in Kotoba Tag

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: sentence-transformers/all-MiniLM-L6-v2 <!-- at revision fa97f6e7cb1a59073dff9e6b13e2715cf7475ac9 -->
  • Maximum Sequence Length: 256 tokens
  • Output Dimensionality: 384 dimensions
  • Similarity Function: Cosine Similarity
  • Language: English

Model Sources

Full Model Architecture

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()
)

Usage

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("sentence_transformers_model_id")
# Run inference
sentences = [
    'dearest',
    'to become verminous',
    "having an (overly) strong attachment to one's mother",
]
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]

Evaluation

Metrics

Binary Classification
MetricValue
cosine_accuracy0.9897545950802664
cosineaccuracythreshold0.4331962466239929
cosine_f10.9685565783209015
cosinef1threshold0.4324696958065033
cosine_precision0.9696722939424032
cosine_recall0.9674434272579558
cosine_ap0.9934008701351884
cosine_mcc0.9624377824608901

Training Details

  • Size: 4,404,844 training samples
  • Columns: <code>text1</code>, <code>text2</code>, and <code>label</code>
  • Approximate statistics based on the first 1000 samples: | | text1 | text2 | label | |:--------|:---------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:------------------------------------------------------| | type | string | string | int | | details | <ul><li>min: 3 tokens</li><li>mean: 5.65 tokens</li><li>max: 27 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 5.64 tokens</li><li>max: 31 tokens</li></ul> | <ul><li>False: ~91.80%</li><li>True: ~8.20%</li></ul> |
  • Samples: | text1 | text2 | label | |:-------------------------------|:--------------------------------------|:-------------------| | <code>based on</code> | <code>making up (a deficiency)</code> | <code>False</code> | | <code>folk (esp. music)</code> | <code>if possible</code> | <code>False</code> | | <code>to start</code> | <code>to die</code> | <code>False</code> |
  • Loss: <code>CoSENTLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "pairwise_cos_sim"
  }

Evaluation

  • Size: 550,605 evaluation samples
  • Columns: <code>text1</code>, <code>text2</code>, and <code>label</code>
  • Approximate statistics based on the first 1000 samples: | | text1 | text2 | label | |:--------|:---------------------------------------------------------------------------------|:--------------------------------------------------------------------------------|:------------------------------------------------------| | type | string | string | int | | details | <ul><li>min: 3 tokens</li><li>mean: 5.74 tokens</li><li>max: 28 tokens</li></ul> | <ul><li>min: 3 tokens</li><li>mean: 5.7 tokens</li><li>max: 32 tokens</li></ul> | <ul><li>False: ~91.60%</li><li>True: ~8.40%</li></ul> |
  • Samples: | text1 | text2 | label | |:----------------------------------------------------------------------------------|:-------------------------------------|:-------------------| | <code>taking one's children along (to an event, into a new marriage, etc.)</code> | <code>disconnect</code> | <code>False</code> | | <code>to thunder</code> | <code>sheet</code> | <code>False</code> | | <code>throwing event (e.g. javelin, discus, shot put)</code> | <code>extinctive prescription</code> | <code>False</code> |
  • Loss: <code>CoSENTLoss</code> with these parameters:
json
  {
      "scale": 20.0,
      "similarity_fct": "pairwise_cos_sim"
  }

Training Hyperparameters

Non-Default Hyperparameters
  • eval_strategy: steps
  • per_device_train_batch_size: 128
  • per_device_eval_batch_size: 32
  • weight_decay: 0.01
  • num_train_epochs: 8
  • warmup_ratio: 0.1
All Hyperparameters

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

  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 128
  • per_device_eval_batch_size: 32
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 5e-05
  • weight_decay: 0.01
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1.0
  • num_train_epochs: 8
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.1
  • warmup_steps: 0
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • save_safetensors: True
  • save_on_each_node: False
  • save_only_model: False
  • restore_callback_states_from_checkpoint: False
  • no_cuda: False
  • use_cpu: False
  • use_mps_device: False
  • seed: 42
  • data_seed: None
  • jit_mode_eval: False
  • use_ipex: False
  • bf16: False
  • fp16: False
  • fp16_opt_level: O1
  • half_precision_backend: auto
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • local_rank: 0
  • ddp_backend: None
  • tpu_num_cores: None
  • tpu_metrics_debug: False
  • debug: []
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_prefetch_factor: None
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: False
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'minnumparams': 0, 'xla': False, 'xlafsdpv2': False, 'xlafsdpgrad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'splitbatches': False, 'dispatchbatches': None, 'evenbatches': True, 'useseedablesampler': True, 'nonblocking': False, 'gradientaccumulationkwargs': None}
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • 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
  • use_legacy_prediction_loop: False
  • push_to_hub: False
  • resume_from_checkpoint: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_private_repo: None
  • hub_always_push: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • include_for_metrics: []
  • eval_do_concat_batches: True
  • fp16_backend: auto
  • push_to_hub_model_id: None
  • push_to_hub_organization: None
  • mp_parameters:
  • auto_find_batch_size: False
  • full_determinism: False
  • torchdynamo: None
  • ray_scope: last
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • dispatch_batches: None
  • split_batches: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: False
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • eval_on_start: False
  • use_liger_kernel: False
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional

</details>

Training Logs

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

EpochStepTraining LossValidation Lossdev_cosine_ap
-1-1--0.8061
0.01455007.2395--
0.029110007.2421--
0.043615006.5757--
0.058120005.96--
0.072625005.5217--
0.087230005.3224--
0.101735005.2104--
0.116240005.0525--
0.130845005.1228--
0.145350005.03171.57420.8818
0.159855004.9875--
0.174460004.85--
0.188965004.9348--
0.203470004.7928--
0.217975004.8412--
0.232580004.8304--
0.247085004.8031--
0.261590004.7567--
0.276195004.7847--
0.2906100004.77431.32810.9066
0.3051105004.6624--
0.3196110004.6653--
0.3342115004.6047--
0.3487120004.5972--
0.3632125004.6678--
0.3778130004.5873--
0.3923135004.6007--
0.4068140004.526--
0.4214145004.576--
0.4359150004.55871.16740.9213
0.4504155004.4398--
0.4649160004.529--
0.4795165004.4231--
0.4940170004.5204--
0.5085175004.508--
0.5231180004.4563--
0.5376185004.4922--
0.5521190004.3455--
0.5666195004.393--
0.5812200004.37541.13460.9267
0.5957205004.3033--
0.6102210004.4046--
0.6248215004.4623--
0.6393220004.3426--
0.6538225004.3791--
0.6684230004.4055--
0.6829235004.3898--
0.6974240004.3318--
0.7119245004.3469--
0.7265250004.391.10030.9304
0.7410255004.2806--
0.7555260004.3901--
0.7701265004.3526--
0.7846270004.2083--
0.7991275004.4242--
0.8136280004.3139--
0.8282285004.2971--
0.8427290004.2024--
0.8572295004.2684--
0.8718300004.31750.98300.9365
0.8863305004.2168--
0.9008310004.1969--
0.9154315004.248--
0.9299320004.1886--
0.9444325004.269--
0.9589330004.1733--
0.9735335004.1176--
0.9880340004.2357--
1.0025345004.0826--
1.0171350003.69370.92220.9416
1.0316355003.9462--
1.0461360003.8201--
1.0606365003.8564--
1.0752370003.8252--
1.0897375003.8981--
1.1042380003.8162--
1.1188385003.742--
1.1333390003.7388--
1.1478395003.852--
1.1624400003.77870.88730.9440
1.1769405003.6863--
1.1914410003.7342--
1.2059415003.7647--
1.2205420003.7589--
1.2350425003.7183--
1.2495430003.8539--
1.2641435003.7406--
1.2786440003.7291--
1.2931445003.729--
1.3076450003.69440.86960.9457
1.3222455003.8864--
1.3367460003.7167--
1.3512465003.7737--
1.3658470003.7781--
1.3803475003.7873--
1.3948480003.6664--
1.4094485003.8184--
1.4239490003.6521--
1.4384495003.7833--
1.4529500003.72940.80750.9504
1.4675505003.7328--
1.4820510003.7784--
1.4965515003.6691--
1.5111520003.6275--
1.5256525003.7145--
1.5401530003.6423--
1.5546535003.6464--
1.5692540003.6415--
1.5837545003.7093--
1.5982550003.69960.77410.9527
1.6128555003.6644--
1.6273560003.6496--
1.6418565003.6891--
1.6564570003.7227--
1.6709575003.6413--
1.6854580003.6085--
1.6999585003.4957--
1.7145590003.5888--
1.7290595003.6562--
1.7435600003.60910.74410.9549
1.7581605003.4945--
1.7726610003.5744--
1.7871615003.6632--
1.8016620003.5322--
1.8162625003.4866--
1.8307630003.5391--
1.8452635003.4714--
1.8598640003.4245--
1.8743645003.4765--
1.8888650003.44990.72030.9563
1.9034655003.5459--
1.9179660003.6055--
1.9324665003.5734--
1.9469670003.5724--
1.9615675003.5344--
1.9760680003.4783--
1.9905685003.5332--
2.0051690003.1724--
2.0196695002.8641--
2.0341700002.75430.72520.9577
2.0486705002.8778--
2.0632710002.5721--
2.0777715002.7482--
2.0922720002.8025--
2.1068725002.8993--
2.1213730002.9477--
2.1358735002.8873--
2.1504740002.9593--
2.1649745002.8642--
2.1794750002.91130.72520.9582
2.1939755002.8282--
2.2085760002.9086--
2.2230765002.7911--
2.2375770002.9013--
2.2521775002.9883--
2.2666780002.7996--
2.2811785002.9005--
2.2956790002.8725--
2.3102795002.9003--
2.3247800003.00290.67990.9607
2.3392805002.9904--
2.3538810002.9155--
2.3683815002.933--
2.3828820002.8691--
2.3973825003.003--
2.4119830002.9573--
2.4264835002.8678--
2.4409840003.0882--
2.4555845002.8722--
2.4700850002.95270.67600.9610
2.4845855003.1515--
2.4991860002.9227--
2.5136865002.9474--
2.5281870002.9981--
2.5426875002.8989--
2.5572880002.8141--
2.5717885003.0488--
2.5862890002.8426--
2.6008895002.7394--
2.6153900003.03990.64300.9628
2.6298905002.9426--
2.6443910002.7746--
2.6589915002.9781--
2.6734920002.8177--
2.6879925002.6764--
2.7025930002.8852--
2.7170935002.8658--
2.7315940002.9031--
2.7461945002.9051--
2.7606950002.97150.63470.9636
2.7751955002.8294--
2.7896960002.9833--
2.8042965002.8931--
2.8187970002.866--
2.8332975002.7796--
2.8478980002.7783--
2.8623985002.9983--
2.8768990002.965--
2.8913995002.9125--
2.90591000002.83080.61620.9649
2.92041005002.7666--
2.93491010002.8829--
2.94951015002.7808--
2.96401020003.0559--
2.97851025002.8531--
2.99311030002.8534--
3.00761035002.3948--
3.02211040001.9878--
3.03661045002.204--
3.05121050002.09510.63580.9651
3.06571055002.1723--
3.08021060002.096--
3.09481065002.1398--
3.10931070002.1534--
3.12381075002.0605--
3.13831080001.9515--
3.15291085002.1798--
3.16741090002.1395--
3.18191095002.0357--
3.19651100002.05790.62750.9656
3.21101105002.2834--
3.22551110002.1215--
3.24011115002.3135--
3.25461120002.1642--
3.26911125002.1095--
3.28361130002.1022--
3.29821135002.2954--
3.31271140002.2834--
3.32721145002.2489--
3.34181150002.23170.62050.9663
3.35631155002.234--
3.37081160002.1769--
3.38531165002.1369--
3.39991170002.1962--
3.41441175002.1586--
3.42891180002.2802--
3.44351185002.2446--
3.45801190002.3673--
3.47251195002.1549--
3.48711200002.29630.59480.9672
3.50161205002.331--
3.51611210002.2441--
3.53061215002.0613--
3.54521220002.2732--
3.55971225002.1462--
3.57421230002.2862--
3.58881235002.466--
3.60331240002.1136--
3.61781245002.2851--
3.63231250002.28980.58870.9677
3.64691255002.1318--
3.66141260002.2125--
3.67591265002.2985--
3.69051270002.2355--
3.70501275002.1965--
3.71951280002.2711--
3.73411285002.2094--
3.74861290002.1588--
3.76311295002.3413--
3.77761300002.12230.58780.9683
3.79221305002.1582--
3.80671310002.3648--
3.82121315002.2182--
3.83581320002.1239--
3.85031325002.0056--
3.86481330002.1289--
3.87931335002.223--
3.89391340002.3067--
3.90841345002.2172--
3.92291350002.29920.55340.9699
3.93751355002.1945--
3.95201360002.2532--
3.96651365002.3272--
3.98111370002.2678--
3.99561375002.2451--
4.01011380001.506--
4.02461385001.552--
4.03921390001.5056--
4.05371395001.5867--
4.06821400001.49770.56680.9697
4.08281405001.5145--
4.09731410001.571--
4.11181415001.5091--
4.12631420001.5696--
4.14091425001.6053--
4.15541430001.5816--
4.16991435001.6723--
4.18451440001.5638--
4.19901445001.5457--
4.21351450001.54420.56630.9698
4.22811455001.6303--
4.24261460001.4715--
4.25711465001.5385--
4.27161470001.6144--
4.28621475001.4881--
4.30071480001.8148--
4.31521485001.5511--
4.32981490001.6536--
4.34431495001.5755--
4.35881500001.69970.56080.9702
4.37331505001.6931--
4.38791510001.5777--
4.40241515001.7588--
4.41691520001.5043--
4.43151525001.5527--
4.44601530001.5128--
4.46051535001.5893--
4.47511540001.6465--
4.48961545001.6211--
4.50411550001.56750.56230.9704
4.51861555001.752--
4.53321560001.8182--
4.54771565001.5368--
4.56221570001.6635--
4.57681575001.5425--
4.59131580001.5988--
4.60581585001.7011--
4.62031590001.5353--
4.63491595001.625--
4.64941600001.54830.54260.9714
4.66391605001.6127--
4.67851610001.6512--
4.69301615001.7213--
4.70751620001.5976--
4.72211625001.5711--
4.73661630001.5911--
4.75111635001.6364--
4.76561640001.6361--
4.78021645001.7027--
4.79471650001.64620.53880.9717
4.80921655001.7102--
4.82381660001.6149--
4.83831665001.5491--
4.85281670001.6389--
4.86731675001.5092--
4.88191680001.6771--
4.89641685001.6812--
4.91091690001.6414--
4.92551695001.6066--
4.94001700001.47290.52360.9724
4.95451705001.6032--
4.96911710001.6274--
4.98361715001.8478--
4.99811720001.6356--
5.01261725001.1942--
5.02721730001.1838--
5.04171735001.0514--
5.05621740001.0647--
5.07081745001.0718--
5.08531750001.01620.53850.9720
5.09981755001.0253--
5.11431760001.115--
5.12891765001.0504--
5.14341770001.1573--
5.15791775001.0937--
5.17251780001.0939--
5.18701785001.0392--
5.20151790001.0852--
5.21611795001.165--
5.23061800001.10480.52910.9723
5.24511805001.1814--
5.25961810001.2639--
5.27421815001.1395--
5.28871820001.1452--
5.30321825001.2131--
5.31781830001.236--
5.33231835001.1449--
5.34681840001.1425--
5.36131845001.2328--
5.37591850001.11140.52520.9727

</details>

Framework Versions

  • Python: 3.9.21
  • Sentence Transformers: 3.4.0
  • Transformers: 4.48.1
  • PyTorch: 2.5.1
  • Accelerate: 1.3.0
  • Datasets: 3.2.0
  • Tokenizers: 0.21.0