Views
No views yet
| Item | Detail |
|---|---|
| Base model | BAAI/bge-m3 |
| Method | PEFT LoRA + CachedMultipleNegativesRankingLoss |
| LoRA rank (r) | 32 |
| LoRA alpha | 64 |
| Target modules | query, value |
| Training epochs | 3 |
| Batch size | 8 (gradient accumulation × 4) |
| Learning rate | 3e-5 |
| Warmup ratio | 0.1 |
| Max sequence length | 512 |
| Train queries | 3,116 (85% of golden test set) |
| Eval queries | ~550 (15% of golden test set) |
| Corpus | Full KB: 6,756 documents |
| Train/eval split | 85/15 stratified by difficulty (Easy / Medium / Hard) |

1import os
2from huggingface_hub import snapshot_download
3from langchain_huggingface import HuggingFaceEmbeddings
4
5model_kwargs = {'device': 'cuda' if torch.cuda.is_available() else 'cpu'}
6encode_kwargs = {'normalize_embeddings': True}
7
8print("Downloading merged model files...")
9local_model_dir = snapshot_download(
10 repo_id="CuongCao/oe-bge-m3-LoRA-ft-v2",
11 allow_patterns=["merged/*", "merged/**/*"]
12)
13merged_path = os.path.join(local_model_dir, "merged")
14
15print("Loading model into LangChain wrapper...")
16model = HuggingFaceEmbeddings(
17 model_name=merged_path,
18 model_kwargs=model_kwargs,
19 encode_kwargs=encode_kwargs
20)
21
22query = "How do I reset my password?"
23documents = ["Password reset procedure", "Account settings guide", ...]
24
25query_emb = model.encode(query)
26doc_embs = model.encode(documents)
27
28# Cosine similarity
29scores = query_emb @ doc_embs.TCuongCao/oe-bge-m3-LoRA-ft-v2/
├── lora-adapters/ # LoRA adapter weights only (~12 MB)
│ ├── adapter_config.json
│ └── adapter_model.safetensors
└── merged/ # Full merged model (~2.2 GB, ready for inference)
├── config.json
├── model.safetensors
└── ...1@article{bge-m3,
2 title={BGE M3-Embedding: Multi-Lingual, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillation},
3 author={Jianlv Chen and Shitao Xiao and Peitian Zhang and Kun Luo and Defu Lian and Zheng Liu},
4 journal={arXiv preprint arXiv:2402.03216},
5 year={2024}
6}