SentenceTransformer based on hon9kon9ize/bert-large-cantonese
This is a
sentence-transformers
model finetuned from
hon9kon9ize/bert-large-cantonese
on the
yue-all-nli
dataset. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
Model Details
Model Description
Model Type:
Sentence Transformer
Base model:
hon9kon9ize/bert-large-cantonese
Maximum Sequence Length:
512 tokens
Output Dimensionality:
1024 dimensions
Similarity Function:
Cosine Similarity
Training Dataset:
Model Sources
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel
(1): Pooling({'word_embedding_dimension': 1024, '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})
)
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("hon9kon9ize/bert-large-cantonese-nli" )
# Run inference
sentences = [
'一個印度男人經過廟宇,準備去祈禱。' ,
'一個男人正前往佢嘅宗教場所。' ,
'有個男人跌咗落泳池度。' ,
]
embeddings = model.encode(sentences)
print (embeddings.shape)
# [3, 1024]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print (similarities.shape)
# [3, 3]
Evaluation
Metrics
Semantic Similarity
Metric
sts-dev
sts-test
pearson_cosine
0.7735
0.7308
spearman_cosine
0.7692
0.7166
Training Details
Training Dataset
yue-all-nli
Evaluation Dataset
yue-all-nli
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy
: steps
per_device_train_batch_size
: 200
per_device_eval_batch_size
: 200
num_train_epochs
: 1
warmup_ratio
: 0.1
bf16
: True
batch_sampler
: no_duplicates
All Hyperparameters
Click to expand
overwrite_output_dir
: False
do_predict
: False
eval_strategy
: steps
prediction_loss_only
: True
per_device_train_batch_size
: 200
per_device_eval_batch_size
: 200
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.0
adam_beta1
: 0.9
adam_beta2
: 0.999
adam_epsilon
: 1e-08
max_grad_norm
: 1.0
num_train_epochs
: 1
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
: True
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
: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
fsdp_transformer_layer_cls_to_wrap
: None
accelerator_config
: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': 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
: False
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
prompts
: None
batch_sampler
: no_duplicates
multi_dataset_batch_sampler
: proportional
Training Logs
Click to expand
Epoch
Step
Training Loss
Validation Loss
sts-dev_spearman_cosine
sts-test_spearman_cosine
0
0
-
-
0.6088
-
0.0036
10
5.2979
-
-
-
0.0072
20
4.7327
-
-
-
0.0108
30
3.947
-
-
-
0.0144
40
3.54
-
-
-
0.0179
50
3.2018
-
-
-
0.0215
60
2.9799
-
-
-
0.0251
70
2.675
-
-
-
0.0287
80
2.6905
-
-
-
0.0323
90
2.4294
-
-
-
0.0359
100
2.37
-
-
-
0.0395
110
2.4362
-
-
-
0.0431
120
2.3921
-
-
-
0.0466
130
2.2786
-
-
-
0.0502
140
2.229
-
-
-
0.0538
150
2.1161
-
-
-
0.0574
160
2.3079
-
-
-
0.0610
170
1.987
-
-
-
0.0646
180
2.0639
-
-
-
0.0682
190
2.2198
-
-
-
0.0718
200
2.1834
-
-
-
0.0753
210
1.8895
-
-
-
0.0789
220
2.1098
-
-
-
0.0825
230
2.0285
-
-
-
0.0861
240
2.113
-
-
-
0.0897
250
1.8938
-
-
-
0.0933
260
1.9366
-
-
-
0.0969
270
2.0717
-
-
-
0.1005
280
1.9661
-
-
-
0.1041
290
1.9413
-
-
-
0.1076
300
2.03
-
-
-
0.1112
310
1.846
-
-
-
0.1148
320
1.8981
-
-
-
0.1184
330
1.8459
-
-
-
0.1220
340
1.8878
-
-
-
0.1256
350
1.8206
-
-
-
0.1292
360
1.8579
-
-
-
0.1328
370
2.0124
-
-
-
0.1363
380
2.0894
-
-
-
0.1399
390
1.9983
-
-
-
0.1435
400
1.9324
-
-
-
0.1471
410
1.9137
-
-
-
0.1507
420
1.9957
-
-
-
0.1543
430
1.8286
-
-
-
0.1579
440
1.8095
-
-
-
0.1615
450
1.821
-
-
-
0.1651
460
1.7335
-
-
-
0.1686
470
1.8825
-
-
-
0.1722
480
1.8868
-
-
-
0.1758
490
1.9159
-
-
-
0.1794
500
1.8269
-
-
-
0.1830
510
1.8755
-
-
-
0.1866
520
1.9458
-
-
-
0.1902
530
1.9524
-
-
-
0.1938
540
1.9114
-
-
-
0.1973
550
1.9041
-
-
-
0.2009
560
1.8658
-
-
-
0.2045
570
1.8402
-
-
-
0.2081
580
1.8869
-
-
-
0.2117
590
1.7069
-
-
-
0.2153
600
1.6794
-
-
-
0.2189
610
1.7583
-
-
-
0.2225
620
1.9071
-
-
-
0.2260
630
1.8876
-
-
-
0.2296
640
1.822
-
-
-
0.2332
650
1.8075
-
-
-
0.2368
660
1.7417
-
-
-
0.2404
670
1.7537
-
-
-
0.2440
680
1.7556
-
-
-
0.2476
690
1.7252
-
-
-
0.2512
700
1.9562
-
-
-
0.2548
710
1.7419
-
-
-
0.2583
720
1.7549
-
-
-
0.2619
730
1.7641
-
-
-
0.2655
740
1.784
-
-
-
0.2691
750
1.6317
-
-
-
0.2727
760
1.7435
-
-
-
0.2763
770
1.7969
-
-
-
0.2799
780
1.8979
-
-
-
0.2835
790
1.7954
-
-
-
0.2870
800
1.7096
-
-
-
0.2906
810
1.7253
-
-
-
0.2942
820
1.7181
-
-
-
0.2978
830
1.6548
-
-
-
0.3014
840
1.6261
-
-
-
0.3050
850
1.6046
-
-
-
0.3086
860
1.6426
-
-
-
0.3122
870
1.7313
-
-
-
0.3158
880
1.7176
-
-
-
0.3193
890
1.5755
-
-
-
0.3229
900
1.8435
-
-
-
0.3265
910
1.7116
-
-
-
0.3301
920
1.8091
-
-
-
0.3337
930
1.6186
-
-
-
0.3373
940
1.7061
-
-
-
0.3409
950
1.6116
-
-
-
0.3445
960
1.5633
-
-
-
0.3480
970
1.5761
-
-
-
0.3516
980
1.6554
-
-
-
0.3552
990
1.6426
-
-
-
0.3588
1000
1.5601
-
-
-
0.3624
1010
1.5745
-
-
-
0.3660
1020
1.5069
-
-
-
0.3696
1030
1.6622
-
-
-
0.3732
1040
1.5438
-
-
-
0.3767
1050
1.542
-
-
-
0.3803
1060
1.5206
-
-
-
0.3839
1070
1.6209
-
-
-
0.3875
1080
1.6482
-
-
-
0.3911
1090
1.6196
-
-
-
0.3947
1100
1.6739
-
-
-
0.3983
1110
1.504
-
-
-
0.4019
1120
1.6397
-
-
-
0.4055
1130
1.5129
-
-
-
0.4090
1140
1.5077
-
-
-
0.4126
1150
1.5102
-
-
-
0.4162
1160
1.5231
-
-
-
0.4198
1170
1.3801
-
-
-
0.4234
1180
1.5938
-
-
-
0.4270
1190
1.5751
-
-
-
0.4306
1200
1.5997
-
-
-
0.4342
1210
1.5831
-
-
-
0.4377
1220
1.5389
-
-
-
0.4413
1230
1.469
-
-
-
0.4449
1240
1.5555
-
-
-
0.4485
1250
1.6026
-
-
-
0.4521
1260
1.4617
-
-
-
0.4557
1270
1.5225
-
-
-
0.4593
1280
1.6645
-
-
-
0.4629
1290
1.5347
-
-
-
0.4665
1300
1.6174
-
-
-
0.4700
1310
1.4047
-
-
-
0.4736
1320
1.4833
-
-
-
0.4772
1330
1.5591
-
-
-
0.4808
1340
1.5907
-
-
-
0.4844
1350
1.4204
-
-
-
0.4880
1360
1.5087
-
-
-
0.4916
1370
1.513
-
-
-
0.4952
1380
1.4352
-
-
-
0.4987
1390
1.3911
-
-
-
0.5023
1400
1.5124
-
-
-
0.5059
1410
1.4931
-
-
-
0.5095
1420
1.5362
-
-
-
0.5131
1430
1.5052
-
-
-
0.5167
1440
1.45
-
-
-
0.5203
1450
1.3855
-
-
-
0.5239
1460
1.4439
-
-
-
0.5274
1470
1.5721
-
-
-
0.5310
1480
1.5755
-
-
-
0.5346
1490
1.5294
-
-
-
0.5382
1500
1.48
-
-
-
0.5418
1510
1.575
-
-
-
0.5454
1520
1.4494
-
-
-
0.5490
1530
1.4671
-
-
-
0.5526
1540
1.5071
-
-
-
0.5562
1550
1.3975
-
-
-
0.5597
1560
1.5094
-
-
-
0.5633
1570
1.5995
-
-
-
0.5669
1580
1.475
-
-
-
0.5705
1590
1.4784
-
-
-
0.5741
1600
1.5485
-
-
-
0.5777
1610
1.4771
-
-
-
0.5813
1620
1.401
-
-
-
0.5849
1630
1.3908
-
-
-
0.5884
1640
1.4399
-
-
-
0.5920
1650
1.4473
-
-
-
0.5956
1660
1.497
-
-
-
0.5992
1670
1.5013
-
-
-
0.6028
1680
1.4548
-
-
-
0.6064
1690
1.5194
-
-
-
0.6100
1700
1.4408
-
-
-
0.6136
1710
1.3961
-
-
-
0.6172
1720
1.5083
-
-
-
0.6207
1730
1.4791
-
-
-
0.6243
1740
1.3991
-
-
-
0.6279
1750
1.4779
-
-
-
0.6315
1760
1.4037
-
-
-
0.6351
1770
1.5281
-
-
-
0.6387
1780
1.5073
-
-
-
0.6423
1790
1.5232
-
-
-
0.6459
1800
1.5199
-
-
-
0.6494
1810
1.4202
-
-
-
0.6530
1820
1.4792
-
-
-
0.6566
1830
1.4123
-
-
-
0.6602
1840
1.6649
-
-
-
0.6638
1850
1.4466
-
-
-
0.6674
1860
1.4167
-
-
-
0.6710
1870
1.4389
-
-
-
0.6746
1880
1.3721
-
-
-
0.6781
1890
1.5472
-
-
-
0.6817
1900
1.4983
-
-
-
0.6853
1910
1.5113
-
-
-
0.6889
1920
1.3554
-
-
-
0.6925
1930
1.447
-
-
-
0.6961
1940
1.3987
-
-
-
0.6997
1950
1.4186
-
-
-
0.7033
1960
1.2951
-
-
-
0.7069
1970
1.3454
-
-
-
0.7104
1980
1.3858
-
-
-
0.7140
1990
1.555
-
-
-
0.7176
2000
1.3805
-
-
-
0.7212
2010
1.4568
-
-
-
0.7248
2020
1.4932
-
-
-
0.7284
2030
1.3685
-
-
-
0.7320
2040
1.3725
-
-
-
0.7356
2050
1.3677
-
-
-
0.7391
2060
1.378
-
-
-
0.7427
2070
1.4584
-
-
-
0.7463
2080
1.452
-
-
-
0.7499
2090
1.3644
-
-
-
0.7535
2100
1.3535
-
-
-
0.7571
2110
1.4099
-
-
-
0.7607
2120
1.3514
-
-
-
0.7643
2130
1.4175
-
-
-
0.7679
2140
1.257
-
-
-
0.7714
2150
1.2568
-
-
-
0.7750
2160
1.231
-
-
-
0.7786
2170
1.2755
-
-
-
0.7815
2178
-
1.2715
0.7692
-
0.7822
2180
1.191
-
-
-
0.7858
2190
1.1551
-
-
-
0.7894
2200
1.171
-
-
-
0.7930
2210
1.1812
-
-
-
0.7966
2220
1.1336
-
-
-
0.8001
2230
1.1884
-
-
-
0.8037
2240
1.0855
-
-
-
0.8073
2250
1.1949
-
-
-
0.8109
2260
1.1914
-
-
-
0.8145
2270
1.1098
-
-
-
0.8181
2280
1.126
-
-
-
0.8217
2290
1.0965
-
-
-
0.8253
2300
1.093
-
-
-
0.8288
2310
1.0451
-
-
-
0.8324
2320
1.1839
-
-
-
0.8360
2330
1.0719
-
-
-
0.8396
2340
1.0214
-
-
-
0.8432
2350
1.0696
-
-
-
0.8468
2360
1.03
-
-
-
0.8504
2370
1.1021
-
-
-
0.8540
2380
1.0203
-
-
-
0.8576
2390
1.06
-
-
-
0.8611
2400
1.0749
-
-
-
0.8647
2410
1.0935
-
-
-
0.8683
2420
1.0023
-
-
-
0.8719
2430
1.0706
-
-
-
0.8755
2440
1.0545
-
-
-
0.8791
2450
0.9908
-
-
-
0.8827
2460
0.9819
-
-
-
0.8863
2470
1.0222
-
-
-
0.8898
2480
1.0103
-
-
-
0.8934
2490
1.0299
-
-
-
0.8970
2500
1.0192
-
-
-
0.9006
2510
0.9891
-
-
-
0.9042
2520
1.0164
-
-
-
0.9078
2530
0.9018
-
-
-
0.9114
2540
0.9827
-
-
-
0.9150
2550
0.9711
-
-
-
0.9186
2560
1.0183
-
-
-
0.9221
2570
1.011
-
-
-
0.9257
2580
0.9761
-
-
-
0.9293
2590
1.0216
-
-
-
0.9329
2600
0.9205
-
-
-
0.9365
2610
0.9695
-
-
-
0.9401
2620
0.9812
-
-
-
0.9437
2630
0.9913
-
-
-
0.9473
2640
0.9224
-
-
-
0.9508
2650
0.9556
-
-
-
0.9544
2660
0.9789
-
-
-
0.9580
2670
0.8865
-
-
-
0.9616
2680
1.0455
-
-
-
0.9652
2690
0.9726
-
-
-
0.9688
2700
0.9835
-
-
-
0.9724
2710
0.9541
-
-
-
0.9760
2720
0.9363
-
-
-
0.9795
2730
0.9367
-
-
-
0.9831
2740
0.9659
-
-
-
0.9867
2750
0.9786
-
-
-
0.9903
2760
0.3693
-
-
-
0.9939
2770
0.0197
-
-
-
0.9975
2780
0.0118
-
-
-
1.0
2787
-
-
-
0.7166
Framework Versions
Python: 3.11.2
Sentence Transformers: 3.3.1
Transformers: 4.46.1
PyTorch: 2.4.0+cu121
Accelerate: 1.0.1
Datasets: 3.1.0
Tokenizers: 0.20.3
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",
}
MultipleNegativesRankingLoss
@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}
}