A fine-tuned version of
BAAI/bge-m3
optimized for semantic similarity and retrieval over Uzbek (Cyrillic) text,
with a focus on legal and formal domains. The model produces dense embeddings
suitable for search, clustering, and retrieval-augmented generation while
retaining the multilingual coverage of the base model.
1from sentence_transformers import SentenceTransformer
2
3model = SentenceTransformer("Just-Bax/bge-m3-uzbek-cyrillic")
4
5sentences = [
6 "Ўзбекистон Республикаси Конституцияси олий юридик кучга эга.",
7 "Конституция давлатнинг асосий қонуни ҳисобланади.",
8 "Бугун ҳаво очиқ ва қуёшли.",
9]
10
11embeddings = model.encode(sentences)
12similarities = model.similarity(embeddings, embeddings)
13print(similarities)
1from transformers import AutoTokenizer, AutoModel
2import torch
3import torch.nn.functional as F
4
5model_id = "Just-Bax/bge-m3-uzbek-cyrillic"
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7model = AutoModel.from_pretrained(model_id)
8
9text = "Ўзбекистон Республикаси қонунларига мувофиқ ..."
10inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
11
12with torch.no_grad():
13 outputs = model(**inputs)
14
15# CLS pooling followed by L2 normalization
16embedding = outputs.last_hidden_state[:, 0]
17embedding = F.normalize(embedding, p=2, dim=1)
18print(embedding.shape)
The model was fine-tuned from BAAI/bge-m3 with a contrastive learning objective
on Uzbek (Cyrillic) text drawn from legal and formal sources. CLS pooling and
L2 normalization are used to produce the final sentence embeddings.
Released under the Apache 2.0 license, consistent with the base model
BAAI/bge-m3.
1@misc{bge-m3,
2 title = {BGE M3-Embedding: Multi-Lingual, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillation},
3 author = {Chen, Jianlv and Xiao, Shitao and Zhang, Peitian and Luo, Kun and Lian, Defu and Liu, Zheng},
4 year = {2024},
5 url = {https://huggingface.co/BAAI/bge-m3}
6}