Model reference · open weights
bert-large-cantonese-sts is an open-weight embedding model from hon9kon9ize. AxForge deploys and operates it for you on dedicated EU-owned hardware — with the licence handled where one is required.
Available as managed deployment — configured and operated for you on dedicated EU hardware, quoted per deployment.
What it is
| Released by | hon9kon9ize |
|---|---|
| Type | Embedding models |
| Task | Embeddings |
| Parameters (lead) | 326M |
| Context | 512 tokens |
| Runs with | sentence-transformers |
| Based on | hon9kon9ize/bert-large-cantonese-nli |
| Released | 2024-08-20 |
| Popularity | 13k downloads / month |
| Licence | Unknown |
About
This is a sentence-transformers model finetuned from hon9kon9ize/bert-large-cantonese-nli on the yue-stsb, stsb and C-MTEB/STSB 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.
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})
)
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 = [
'一個細路女同一個細路仔喺度睇書。',
'一個大啲嘅小朋友玩緊公仔,望住窗外。',
'有個男人彈緊結他。',
]
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]
sts-dev and sts-test| Metric | sts-dev | sts-test |
|---|---|---|
| pearson_cosine | 0.7983 | 0.7638 |
| spearman_cosine | 0.7996 | 0.7605 |
Size: 5,749 training samples
Columns: sentence1, sentence2, and score
Approximate statistics based on the first 1000 samples:
| sentence1 | sentence2 | score | |
|---|---|---|---|
| type | string | string | float |
| details | min: 7 tokensmean: 12.24 tokensmax: 40 tokens | min: 7 tokensmean: 12.21 tokensmax: 30 tokens | min: 0.0mean: 0.45max: 1.0 |
Samples:
| sentence1 | sentence2 | score |
|---|---|---|
| 架飛機正準備起飛。 | 一架飛機正準備起飛。 | 1.0 |
| 有個男人吹緊一支好大嘅笛。 | 有個男人吹緊笛。 | 0.76 |
| 有個男人喺批薩上面灑碎芝士。 | 有個男人將磨碎嘅芝士灑落一塊未焗嘅批薩上面。 | 0.76 |
Loss: CosineSimilarityLoss with these parameters:
{
"loss_fct": "torch.nn.modules.loss.MSELoss"
}
Size: 16,729 training samples
Columns: sentence1, sentence2, and score
Approximate statistics based on the first 1000 samples:
| sentence1 | sentence2 | score | |
|---|---|---|---|
| type | string | string | float |
| details | min: 5 tokensmean: 20.29 tokensmax: 74 tokens | min: 6 tokensmean: 20.36 tokensmax: 76 tokens | min: 0.0mean: 0.52max: 1.0 |
Samples:
| sentence1 | sentence2 | score |
|---|
From the published model card. Full card on the HuggingFace links in the sidebar.
Benchmarks
As published on the model card — the maker's own numbers, not measured by AxForge.
| Task | Dataset | Metric | Score |
|---|---|---|---|
| Semantic Similarity | sts dev | Pearson Cosine | 0.798 |
| Semantic Similarity | sts dev | Spearman Cosine | 0.800 |
| Semantic Similarity | sts test | Pearson Cosine | 0.764 |
| Semantic Similarity | sts test | Spearman Cosine | 0.760 |
Using it via the API
Once AxForge deploys bert-large-cantonese-sts for you, it answers on the OpenAI-compatible API — the same base URL and keys as every other model. (bert-large-cantonese-sts below is illustrative; you get the exact model name on deployment.)
$ curl -sS https://api.axforge.ai/v1/embeddings \
-H "Authorization: Bearer $AXFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"bert-large-cantonese-sts","input":"text to embed"}'
Create an account — your API key is available in the console. 3M free tokens every 30 days with every new account.