canho commited on
Commit
a504518
·
verified ·
1 Parent(s): 1bb9b21

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. bright_work/hf/hub/models--BAAI--bge-m3/refs/main +1 -0
  2. bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/.gitattributes +37 -0
  3. bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/1_Pooling/config.json +7 -0
  4. bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/README.md +300 -0
  5. bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/config.json +28 -0
  6. bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/config_sentence_transformers.json +7 -0
  7. bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/imgs/.DS_Store +0 -0
  8. bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/modules.json +20 -0
  9. bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/onnx/Constant_7_attr__value +0 -0
  10. bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/onnx/config.json +28 -0
  11. bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/onnx/special_tokens_map.json +51 -0
  12. bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/onnx/tokenizer_config.json +55 -0
  13. bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/sentence_bert_config.json +4 -0
  14. bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/special_tokens_map.json +51 -0
  15. bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/tokenizer_config.json +20 -0
  16. bright_work/hf/hub/models--OpenSciLM--OpenScholar_Retriever/refs/main +1 -0
  17. bright_work/hf/hub/models--OpenSciLM--OpenScholar_Retriever/refs/refs/pr/1 +1 -0
  18. bright_work/hf/hub/models--OpenSciLM--OpenScholar_Retriever/snapshots/ef4f3120d33b3ca57e12fce2b369f5982a7bb929/config.json +25 -0
  19. bright_work/hf/hub/models--OpenSciLM--OpenScholar_Retriever/snapshots/ef4f3120d33b3ca57e12fce2b369f5982a7bb929/special_tokens_map.json +1 -0
  20. bright_work/hf/hub/models--OpenSciLM--OpenScholar_Retriever/snapshots/ef4f3120d33b3ca57e12fce2b369f5982a7bb929/tokenizer.json +0 -0
  21. bright_work/hf/hub/models--OpenSciLM--OpenScholar_Retriever/snapshots/ef4f3120d33b3ca57e12fce2b369f5982a7bb929/tokenizer_config.json +1 -0
  22. bright_work/hf/hub/models--OpenSciLM--OpenScholar_Retriever/snapshots/ef4f3120d33b3ca57e12fce2b369f5982a7bb929/vocab.txt +0 -0
  23. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt140/refs/main +1 -0
  24. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt140/snapshots/6c509483aedc7c5e93826c4a8a1184c2ddf21312/1_Pooling/config.json +10 -0
  25. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt140/snapshots/6c509483aedc7c5e93826c4a8a1184c2ddf21312/README.md +20 -0
  26. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt140/snapshots/6c509483aedc7c5e93826c4a8a1184c2ddf21312/chat_template.jinja +85 -0
  27. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt140/snapshots/6c509483aedc7c5e93826c4a8a1184c2ddf21312/config.json +63 -0
  28. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt140/snapshots/6c509483aedc7c5e93826c4a8a1184c2ddf21312/config_sentence_transformers.json +8 -0
  29. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt140/snapshots/6c509483aedc7c5e93826c4a8a1184c2ddf21312/modules.json +20 -0
  30. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt140/snapshots/6c509483aedc7c5e93826c4a8a1184c2ddf21312/tokenizer_config.json +15 -0
  31. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt160/refs/main +1 -0
  32. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt160/snapshots/5ead7f08e8cdca55ea2507b891f9d259a57dd1c7/1_Pooling/config.json +10 -0
  33. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt160/snapshots/5ead7f08e8cdca55ea2507b891f9d259a57dd1c7/README.md +20 -0
  34. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt160/snapshots/5ead7f08e8cdca55ea2507b891f9d259a57dd1c7/chat_template.jinja +85 -0
  35. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt160/snapshots/5ead7f08e8cdca55ea2507b891f9d259a57dd1c7/config.json +63 -0
  36. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt160/snapshots/5ead7f08e8cdca55ea2507b891f9d259a57dd1c7/config_sentence_transformers.json +8 -0
  37. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt160/snapshots/5ead7f08e8cdca55ea2507b891f9d259a57dd1c7/modules.json +20 -0
  38. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt160/snapshots/5ead7f08e8cdca55ea2507b891f9d259a57dd1c7/tokenizer_config.json +15 -0
  39. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt815/refs/main +1 -0
  40. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt815/snapshots/0354597c088496103b416f4bd34aa2e0858b8e4c/1_Pooling/config.json +10 -0
  41. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt815/snapshots/0354597c088496103b416f4bd34aa2e0858b8e4c/README.md +20 -0
  42. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt815/snapshots/0354597c088496103b416f4bd34aa2e0858b8e4c/chat_template.jinja +85 -0
  43. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt815/snapshots/0354597c088496103b416f4bd34aa2e0858b8e4c/config.json +63 -0
  44. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt815/snapshots/0354597c088496103b416f4bd34aa2e0858b8e4c/config_sentence_transformers.json +8 -0
  45. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt815/snapshots/0354597c088496103b416f4bd34aa2e0858b8e4c/modules.json +20 -0
  46. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt815/snapshots/0354597c088496103b416f4bd34aa2e0858b8e4c/tokenizer_config.json +15 -0
  47. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-step2-interim-nohn-ckpt140/refs/main +1 -0
  48. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-step2-interim-nohn-ckpt140/snapshots/d432d68d88ebce93cbc3c8a60661cbe09032c648/1_Pooling/config.json +10 -0
  49. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-step2-interim-nohn-ckpt140/snapshots/d432d68d88ebce93cbc3c8a60661cbe09032c648/README.md +22 -0
  50. bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-step2-interim-nohn-ckpt140/snapshots/d432d68d88ebce93cbc3c8a60661cbe09032c648/chat_template.jinja +85 -0
bright_work/hf/hub/models--BAAI--bge-m3/refs/main ADDED
@@ -0,0 +1 @@
 
 
1
+ 5617a9f61b028005a4858fdac845db406aefb181
bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/.gitattributes ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
37
+ onnx/model.onnx_data filter=lfs diff=lfs merge=lfs -text
bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/1_Pooling/config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 1024,
3
+ "pooling_mode_cls_token": true,
4
+ "pooling_mode_mean_tokens": false,
5
+ "pooling_mode_max_tokens": false,
6
+ "pooling_mode_mean_sqrt_len_tokens": false
7
+ }
bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/README.md ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: sentence-similarity
3
+ tags:
4
+ - sentence-transformers
5
+ - feature-extraction
6
+ - sentence-similarity
7
+ license: mit
8
+ ---
9
+
10
+ For more details please refer to our github repo: https://github.com/FlagOpen/FlagEmbedding
11
+
12
+ # BGE-M3 ([paper](https://arxiv.org/pdf/2402.03216.pdf), [code](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/BGE_M3))
13
+
14
+ In this project, we introduce BGE-M3, which is distinguished for its versatility in Multi-Functionality, Multi-Linguality, and Multi-Granularity.
15
+ - Multi-Functionality: It can simultaneously perform the three common retrieval functionalities of embedding model: dense retrieval, multi-vector retrieval, and sparse retrieval.
16
+ - Multi-Linguality: It can support more than 100 working languages.
17
+ - Multi-Granularity: It is able to process inputs of different granularities, spanning from short sentences to long documents of up to 8192 tokens.
18
+
19
+
20
+
21
+ **Some suggestions for retrieval pipeline in RAG**
22
+
23
+ We recommend to use the following pipeline: hybrid retrieval + re-ranking.
24
+ - Hybrid retrieval leverages the strengths of various methods, offering higher accuracy and stronger generalization capabilities.
25
+ A classic example: using both embedding retrieval and the BM25 algorithm.
26
+ Now, you can try to use BGE-M3, which supports both embedding and sparse retrieval.
27
+ This allows you to obtain token weights (similar to the BM25) without any additional cost when generate dense embeddings.
28
+ To use hybrid retrieval, you can refer to [Vespa](https://github.com/vespa-engine/pyvespa/blob/master/docs/sphinx/source/examples/mother-of-all-embedding-models-cloud.ipynb
29
+ ) and [Milvus](https://github.com/milvus-io/pymilvus/blob/master/examples/hello_hybrid_sparse_dense.py).
30
+
31
+ - As cross-encoder models, re-ranker demonstrates higher accuracy than bi-encoder embedding model.
32
+ Utilizing the re-ranking model (e.g., [bge-reranker](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/reranker), [bge-reranker-v2](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/llm_reranker)) after retrieval can further filter the selected text.
33
+
34
+
35
+ ## News:
36
+ - 2024/7/1: **We update the MIRACL evaluation results of BGE-M3**. To reproduce the new results, you can refer to: [bge-m3_miracl_2cr](https://huggingface.co/datasets/hanhainebula/bge-m3_miracl_2cr). We have also updated our [paper](https://arxiv.org/pdf/2402.03216) on arXiv.
37
+ <details>
38
+ <summary> Details </summary>
39
+
40
+ The previous test results were lower because we mistakenly removed the passages that have the same id as the query from the search results. After correcting this mistake, the overall performance of BGE-M3 on MIRACL is higher than the previous results, but the experimental conclusion remains unchanged. The other results are not affected by this mistake. To reproduce the previous lower results, you need to add the `--remove-query` parameter when using `pyserini.search.faiss` or `pyserini.search.lucene` to search the passages.
41
+
42
+ </details>
43
+ - 2024/3/20: **Thanks Milvus team!** Now you can use hybrid retrieval of bge-m3 in Milvus: [pymilvus/examples
44
+ /hello_hybrid_sparse_dense.py](https://github.com/milvus-io/pymilvus/blob/master/examples/hello_hybrid_sparse_dense.py).
45
+ - 2024/3/8: **Thanks for the [experimental results](https://towardsdatascience.com/openai-vs-open-source-multilingual-embedding-models-e5ccb7c90f05) from @[Yannael](https://huggingface.co/Yannael). In this benchmark, BGE-M3 achieves top performance in both English and other languages, surpassing models such as OpenAI.**
46
+ - 2024/3/2: Release unified fine-tuning [example](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/unified_finetune) and [data](https://huggingface.co/datasets/Shitao/bge-m3-data)
47
+ - 2024/2/6: We release the [MLDR](https://huggingface.co/datasets/Shitao/MLDR) (a long document retrieval dataset covering 13 languages) and [evaluation pipeline](https://github.com/FlagOpen/FlagEmbedding/tree/master/C_MTEB/MLDR).
48
+ - 2024/2/1: **Thanks for the excellent tool from Vespa.** You can easily use multiple modes of BGE-M3 following this [notebook](https://github.com/vespa-engine/pyvespa/blob/master/docs/sphinx/source/examples/mother-of-all-embedding-models-cloud.ipynb)
49
+
50
+
51
+ ## Specs
52
+
53
+ - Model
54
+
55
+ | Model Name | Dimension | Sequence Length | Introduction |
56
+ |:----:|:---:|:---:|:---:|
57
+ | [BAAI/bge-m3](https://huggingface.co/BAAI/bge-m3) | 1024 | 8192 | multilingual; unified fine-tuning (dense, sparse, and colbert) from bge-m3-unsupervised|
58
+ | [BAAI/bge-m3-unsupervised](https://huggingface.co/BAAI/bge-m3-unsupervised) | 1024 | 8192 | multilingual; contrastive learning from bge-m3-retromae |
59
+ | [BAAI/bge-m3-retromae](https://huggingface.co/BAAI/bge-m3-retromae) | -- | 8192 | multilingual; extend the max_length of [xlm-roberta](https://huggingface.co/FacebookAI/xlm-roberta-large) to 8192 and further pretrained via [retromae](https://github.com/staoxiao/RetroMAE)|
60
+ | [BAAI/bge-large-en-v1.5](https://huggingface.co/BAAI/bge-large-en-v1.5) | 1024 | 512 | English model |
61
+ | [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5) | 768 | 512 | English model |
62
+ | [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) | 384 | 512 | English model |
63
+
64
+ - Data
65
+
66
+ | Dataset | Introduction |
67
+ |:----------------------------------------------------------:|:-------------------------------------------------:|
68
+ | [MLDR](https://huggingface.co/datasets/Shitao/MLDR) | Docuemtn Retrieval Dataset, covering 13 languages |
69
+ | [bge-m3-data](https://huggingface.co/datasets/Shitao/bge-m3-data) | Fine-tuning data used by bge-m3 |
70
+
71
+
72
+
73
+ ## FAQ
74
+
75
+ **1. Introduction for different retrieval methods**
76
+
77
+ - Dense retrieval: map the text into a single embedding, e.g., [DPR](https://arxiv.org/abs/2004.04906), [BGE-v1.5](https://github.com/FlagOpen/FlagEmbedding)
78
+ - Sparse retrieval (lexical matching): a vector of size equal to the vocabulary, with the majority of positions set to zero, calculating a weight only for tokens present in the text. e.g., BM25, [unicoil](https://arxiv.org/pdf/2106.14807.pdf), and [splade](https://arxiv.org/abs/2107.05720)
79
+ - Multi-vector retrieval: use multiple vectors to represent a text, e.g., [ColBERT](https://arxiv.org/abs/2004.12832).
80
+
81
+
82
+ **2. How to use BGE-M3 in other projects?**
83
+
84
+ For embedding retrieval, you can employ the BGE-M3 model using the same approach as BGE.
85
+ The only difference is that the BGE-M3 model no longer requires adding instructions to the queries.
86
+
87
+ For hybrid retrieval, you can use [Vespa](https://github.com/vespa-engine/pyvespa/blob/master/docs/sphinx/source/examples/mother-of-all-embedding-models-cloud.ipynb
88
+ ) and [Milvus](https://github.com/milvus-io/pymilvus/blob/master/examples/hello_hybrid_sparse_dense.py).
89
+
90
+
91
+ **3. How to fine-tune bge-M3 model?**
92
+
93
+ You can follow the common in this [example](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune)
94
+ to fine-tune the dense embedding.
95
+
96
+ If you want to fine-tune all embedding function of m3 (dense, sparse and colbert), you can refer to the [unified_fine-tuning example](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/unified_finetune)
97
+
98
+
99
+
100
+
101
+
102
+
103
+ ## Usage
104
+
105
+ Install:
106
+ ```
107
+ git clone https://github.com/FlagOpen/FlagEmbedding.git
108
+ cd FlagEmbedding
109
+ pip install -e .
110
+ ```
111
+ or:
112
+ ```
113
+ pip install -U FlagEmbedding
114
+ ```
115
+
116
+
117
+
118
+ ### Generate Embedding for text
119
+
120
+ - Dense Embedding
121
+ ```python
122
+ from FlagEmbedding import BGEM3FlagModel
123
+
124
+ model = BGEM3FlagModel('BAAI/bge-m3',
125
+ use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation
126
+
127
+ sentences_1 = ["What is BGE M3?", "Defination of BM25"]
128
+ sentences_2 = ["BGE M3 is an embedding model supporting dense retrieval, lexical matching and multi-vector interaction.",
129
+ "BM25 is a bag-of-words retrieval function that ranks a set of documents based on the query terms appearing in each document"]
130
+
131
+ embeddings_1 = model.encode(sentences_1,
132
+ batch_size=12,
133
+ max_length=8192, # If you don't need such a long length, you can set a smaller value to speed up the encoding process.
134
+ )['dense_vecs']
135
+ embeddings_2 = model.encode(sentences_2)['dense_vecs']
136
+ similarity = embeddings_1 @ embeddings_2.T
137
+ print(similarity)
138
+ # [[0.6265, 0.3477], [0.3499, 0.678 ]]
139
+ ```
140
+ You also can use sentence-transformers and huggingface transformers to generate dense embeddings.
141
+ Refer to [baai_general_embedding](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/baai_general_embedding#usage) for details.
142
+
143
+
144
+ - Sparse Embedding (Lexical Weight)
145
+ ```python
146
+ from FlagEmbedding import BGEM3FlagModel
147
+
148
+ model = BGEM3FlagModel('BAAI/bge-m3', use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation
149
+
150
+ sentences_1 = ["What is BGE M3?", "Defination of BM25"]
151
+ sentences_2 = ["BGE M3 is an embedding model supporting dense retrieval, lexical matching and multi-vector interaction.",
152
+ "BM25 is a bag-of-words retrieval function that ranks a set of documents based on the query terms appearing in each document"]
153
+
154
+ output_1 = model.encode(sentences_1, return_dense=True, return_sparse=True, return_colbert_vecs=False)
155
+ output_2 = model.encode(sentences_2, return_dense=True, return_sparse=True, return_colbert_vecs=False)
156
+
157
+ # you can see the weight for each token:
158
+ print(model.convert_id_to_token(output_1['lexical_weights']))
159
+ # [{'What': 0.08356, 'is': 0.0814, 'B': 0.1296, 'GE': 0.252, 'M': 0.1702, '3': 0.2695, '?': 0.04092},
160
+ # {'De': 0.05005, 'fin': 0.1368, 'ation': 0.04498, 'of': 0.0633, 'BM': 0.2515, '25': 0.3335}]
161
+
162
+
163
+ # compute the scores via lexical mathcing
164
+ lexical_scores = model.compute_lexical_matching_score(output_1['lexical_weights'][0], output_2['lexical_weights'][0])
165
+ print(lexical_scores)
166
+ # 0.19554901123046875
167
+
168
+ print(model.compute_lexical_matching_score(output_1['lexical_weights'][0], output_1['lexical_weights'][1]))
169
+ # 0.0
170
+ ```
171
+
172
+ - Multi-Vector (ColBERT)
173
+ ```python
174
+ from FlagEmbedding import BGEM3FlagModel
175
+
176
+ model = BGEM3FlagModel('BAAI/bge-m3', use_fp16=True)
177
+
178
+ sentences_1 = ["What is BGE M3?", "Defination of BM25"]
179
+ sentences_2 = ["BGE M3 is an embedding model supporting dense retrieval, lexical matching and multi-vector interaction.",
180
+ "BM25 is a bag-of-words retrieval function that ranks a set of documents based on the query terms appearing in each document"]
181
+
182
+ output_1 = model.encode(sentences_1, return_dense=True, return_sparse=True, return_colbert_vecs=True)
183
+ output_2 = model.encode(sentences_2, return_dense=True, return_sparse=True, return_colbert_vecs=True)
184
+
185
+ print(model.colbert_score(output_1['colbert_vecs'][0], output_2['colbert_vecs'][0]))
186
+ print(model.colbert_score(output_1['colbert_vecs'][0], output_2['colbert_vecs'][1]))
187
+ # 0.7797
188
+ # 0.4620
189
+ ```
190
+
191
+
192
+ ### Compute score for text pairs
193
+ Input a list of text pairs, you can get the scores computed by different methods.
194
+ ```python
195
+ from FlagEmbedding import BGEM3FlagModel
196
+
197
+ model = BGEM3FlagModel('BAAI/bge-m3', use_fp16=True)
198
+
199
+ sentences_1 = ["What is BGE M3?", "Defination of BM25"]
200
+ sentences_2 = ["BGE M3 is an embedding model supporting dense retrieval, lexical matching and multi-vector interaction.",
201
+ "BM25 is a bag-of-words retrieval function that ranks a set of documents based on the query terms appearing in each document"]
202
+
203
+ sentence_pairs = [[i,j] for i in sentences_1 for j in sentences_2]
204
+
205
+ print(model.compute_score(sentence_pairs,
206
+ max_passage_length=128, # a smaller max length leads to a lower latency
207
+ weights_for_different_modes=[0.4, 0.2, 0.4])) # weights_for_different_modes(w) is used to do weighted sum: w[0]*dense_score + w[1]*sparse_score + w[2]*colbert_score
208
+
209
+ # {
210
+ # 'colbert': [0.7796499729156494, 0.4621465802192688, 0.4523794651031494, 0.7898575067520142],
211
+ # 'sparse': [0.195556640625, 0.00879669189453125, 0.0, 0.1802978515625],
212
+ # 'dense': [0.6259765625, 0.347412109375, 0.349853515625, 0.67822265625],
213
+ # 'sparse+dense': [0.482503205537796, 0.23454029858112335, 0.2332356721162796, 0.5122477412223816],
214
+ # 'colbert+sparse+dense': [0.6013619303703308, 0.3255828022956848, 0.32089319825172424, 0.6232916116714478]
215
+ # }
216
+ ```
217
+
218
+
219
+
220
+
221
+ ## Evaluation
222
+
223
+ We provide the evaluation script for [MKQA](https://github.com/FlagOpen/FlagEmbedding/tree/master/C_MTEB/MKQA) and [MLDR](https://github.com/FlagOpen/FlagEmbedding/tree/master/C_MTEB/MLDR)
224
+
225
+ ### Benchmarks from the open-source community
226
+ ![avatar](./imgs/others.webp)
227
+ The BGE-M3 model emerged as the top performer on this benchmark (OAI is short for OpenAI).
228
+ For more details, please refer to the [article](https://towardsdatascience.com/openai-vs-open-source-multilingual-embedding-models-e5ccb7c90f05) and [Github Repo](https://github.com/Yannael/multilingual-embeddings)
229
+
230
+
231
+ ### Our results
232
+ - Multilingual (Miracl dataset)
233
+
234
+ ![avatar](./imgs/miracl.jpg)
235
+
236
+ - Cross-lingual (MKQA dataset)
237
+
238
+ ![avatar](./imgs/mkqa.jpg)
239
+
240
+ - Long Document Retrieval
241
+ - MLDR:
242
+ ![avatar](./imgs/long.jpg)
243
+ Please note that [MLDR](https://huggingface.co/datasets/Shitao/MLDR) is a document retrieval dataset we constructed via LLM,
244
+ covering 13 languages, including test set, validation set, and training set.
245
+ We utilized the training set from MLDR to enhance the model's long document retrieval capabilities.
246
+ Therefore, comparing baselines with `Dense w.o.long`(fine-tuning without long document dataset) is more equitable.
247
+ Additionally, this long document retrieval dataset will be open-sourced to address the current lack of open-source multilingual long text retrieval datasets.
248
+ We believe that this data will be helpful for the open-source community in training document retrieval models.
249
+
250
+ - NarritiveQA:
251
+ ![avatar](./imgs/nqa.jpg)
252
+
253
+ - Comparison with BM25
254
+
255
+ We utilized Pyserini to implement BM25, and the test results can be reproduced by this [script](https://github.com/FlagOpen/FlagEmbedding/tree/master/C_MTEB/MLDR#bm25-baseline).
256
+ We tested BM25 using two different tokenizers:
257
+ one using Lucene Analyzer and the other using the same tokenizer as M3 (i.e., the tokenizer of xlm-roberta).
258
+ The results indicate that BM25 remains a competitive baseline,
259
+ especially in long document retrieval.
260
+
261
+ ![avatar](./imgs/bm25.jpg)
262
+
263
+
264
+
265
+ ## Training
266
+ - Self-knowledge Distillation: combining multiple outputs from different
267
+ retrieval modes as reward signal to enhance the performance of single mode(especially for sparse retrieval and multi-vec(colbert) retrival)
268
+ - Efficient Batching: Improve the efficiency when fine-tuning on long text.
269
+ The small-batch strategy is simple but effective, which also can used to fine-tune large embedding model.
270
+ - MCLS: A simple method to improve the performance on long text without fine-tuning.
271
+ If you have no enough resource to fine-tuning model with long text, the method is useful.
272
+
273
+ Refer to our [report](https://arxiv.org/pdf/2402.03216.pdf) for more details.
274
+
275
+
276
+
277
+
278
+
279
+
280
+ ## Acknowledgement
281
+
282
+ Thanks to the authors of open-sourced datasets, including Miracl, MKQA, NarritiveQA, etc.
283
+ Thanks to the open-sourced libraries like [Tevatron](https://github.com/texttron/tevatron), [Pyserini](https://github.com/castorini/pyserini).
284
+
285
+
286
+
287
+ ## Citation
288
+
289
+ If you find this repository useful, please consider giving a star :star: and citation
290
+
291
+ ```
292
+ @misc{bge-m3,
293
+ title={BGE M3-Embedding: Multi-Lingual, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillation},
294
+ author={Jianlv Chen and Shitao Xiao and Peitian Zhang and Kun Luo and Defu Lian and Zheng Liu},
295
+ year={2024},
296
+ eprint={2402.03216},
297
+ archivePrefix={arXiv},
298
+ primaryClass={cs.CL}
299
+ }
300
+ ```
bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "",
3
+ "architectures": [
4
+ "XLMRobertaModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "classifier_dropout": null,
9
+ "eos_token_id": 2,
10
+ "hidden_act": "gelu",
11
+ "hidden_dropout_prob": 0.1,
12
+ "hidden_size": 1024,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 4096,
15
+ "layer_norm_eps": 1e-05,
16
+ "max_position_embeddings": 8194,
17
+ "model_type": "xlm-roberta",
18
+ "num_attention_heads": 16,
19
+ "num_hidden_layers": 24,
20
+ "output_past": true,
21
+ "pad_token_id": 1,
22
+ "position_embedding_type": "absolute",
23
+ "torch_dtype": "float32",
24
+ "transformers_version": "4.33.0",
25
+ "type_vocab_size": 1,
26
+ "use_cache": true,
27
+ "vocab_size": 250002
28
+ }
bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/config_sentence_transformers.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "2.2.2",
4
+ "transformers": "4.33.0",
5
+ "pytorch": "2.1.2+cu121"
6
+ }
7
+ }
bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/imgs/.DS_Store ADDED
Binary file (6.15 kB). View file
 
bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/modules.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.models.Transformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.models.Pooling"
13
+ },
14
+ {
15
+ "idx": 2,
16
+ "name": "2",
17
+ "path": "2_Normalize",
18
+ "type": "sentence_transformers.models.Normalize"
19
+ }
20
+ ]
bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/onnx/Constant_7_attr__value ADDED
Binary file (65.6 kB). View file
 
bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/onnx/config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "BAAI/bge-m3",
3
+ "architectures": [
4
+ "XLMRobertaModel"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "classifier_dropout": null,
9
+ "eos_token_id": 2,
10
+ "hidden_act": "gelu",
11
+ "hidden_dropout_prob": 0.1,
12
+ "hidden_size": 1024,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 4096,
15
+ "layer_norm_eps": 1e-05,
16
+ "max_position_embeddings": 8194,
17
+ "model_type": "xlm-roberta",
18
+ "num_attention_heads": 16,
19
+ "num_hidden_layers": 24,
20
+ "output_past": true,
21
+ "pad_token_id": 1,
22
+ "position_embedding_type": "absolute",
23
+ "torch_dtype": "float32",
24
+ "transformers_version": "4.37.2",
25
+ "type_vocab_size": 1,
26
+ "use_cache": true,
27
+ "vocab_size": 250002
28
+ }
bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/onnx/special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": true,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "<pad>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<unk>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/onnx/tokenizer_config.json ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<s>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "250001": {
36
+ "content": "<mask>",
37
+ "lstrip": true,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "bos_token": "<s>",
45
+ "clean_up_tokenization_spaces": true,
46
+ "cls_token": "<s>",
47
+ "eos_token": "</s>",
48
+ "mask_token": "<mask>",
49
+ "model_max_length": 8192,
50
+ "pad_token": "<pad>",
51
+ "sep_token": "</s>",
52
+ "sp_model_kwargs": {},
53
+ "tokenizer_class": "XLMRobertaTokenizer",
54
+ "unk_token": "<unk>"
55
+ }
bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 8192,
3
+ "do_lower_case": false
4
+ }
bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": true,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "<pad>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<unk>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
bright_work/hf/hub/models--BAAI--bge-m3/snapshots/5617a9f61b028005a4858fdac845db406aefb181/tokenizer_config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "clean_up_tokenization_spaces": true,
4
+ "cls_token": "<s>",
5
+ "eos_token": "</s>",
6
+ "mask_token": {
7
+ "__type": "AddedToken",
8
+ "content": "<mask>",
9
+ "lstrip": true,
10
+ "normalized": true,
11
+ "rstrip": false,
12
+ "single_word": false
13
+ },
14
+ "model_max_length": 8192,
15
+ "pad_token": "<pad>",
16
+ "sep_token": "</s>",
17
+ "sp_model_kwargs": {},
18
+ "tokenizer_class": "XLMRobertaTokenizer",
19
+ "unk_token": "<unk>"
20
+ }
bright_work/hf/hub/models--OpenSciLM--OpenScholar_Retriever/refs/main ADDED
@@ -0,0 +1 @@
 
 
1
+ ef4f3120d33b3ca57e12fce2b369f5982a7bb929
bright_work/hf/hub/models--OpenSciLM--OpenScholar_Retriever/refs/refs/pr/1 ADDED
@@ -0,0 +1 @@
 
 
1
+ 8229321e8db13bcd2ffeffdfc4314b08c9fd8f85
bright_work/hf/hub/models--OpenSciLM--OpenScholar_Retriever/snapshots/ef4f3120d33b3ca57e12fce2b369f5982a7bb929/config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Contriever"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "classifier_dropout": null,
7
+ "gradient_checkpointing": false,
8
+ "hidden_act": "gelu",
9
+ "hidden_dropout_prob": 0.1,
10
+ "hidden_size": 768,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 3072,
13
+ "layer_norm_eps": 1e-12,
14
+ "max_position_embeddings": 512,
15
+ "model_type": "bert",
16
+ "num_attention_heads": 12,
17
+ "num_hidden_layers": 12,
18
+ "pad_token_id": 0,
19
+ "position_embedding_type": "absolute",
20
+ "torch_dtype": "float32",
21
+ "transformers_version": "4.15.0",
22
+ "type_vocab_size": 2,
23
+ "use_cache": true,
24
+ "vocab_size": 30522
25
+ }
bright_work/hf/hub/models--OpenSciLM--OpenScholar_Retriever/snapshots/ef4f3120d33b3ca57e12fce2b369f5982a7bb929/special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
bright_work/hf/hub/models--OpenSciLM--OpenScholar_Retriever/snapshots/ef4f3120d33b3ca57e12fce2b369f5982a7bb929/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
bright_work/hf/hub/models--OpenSciLM--OpenScholar_Retriever/snapshots/ef4f3120d33b3ca57e12fce2b369f5982a7bb929/tokenizer_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"do_lower_case": true, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "model_max_length": 512, "special_tokens_map_file": null, "name_or_path": "bert-base-uncased", "tokenizer_class": "BertTokenizer"}
bright_work/hf/hub/models--OpenSciLM--OpenScholar_Retriever/snapshots/ef4f3120d33b3ca57e12fce2b369f5982a7bb929/vocab.txt ADDED
The diff for this file is too large to render. See raw diff
 
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt140/refs/main ADDED
@@ -0,0 +1 @@
 
 
1
+ 6c509483aedc7c5e93826c4a8a1184c2ddf21312
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt140/snapshots/6c509483aedc7c5e93826c4a8a1184c2ddf21312/1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 1024,
3
+ "pooling_mode_cls_token": false,
4
+ "pooling_mode_mean_tokens": false,
5
+ "pooling_mode_max_tokens": false,
6
+ "pooling_mode_mean_sqrt_len_tokens": false,
7
+ "pooling_mode_weightedmean_tokens": false,
8
+ "pooling_mode_lasttoken": true,
9
+ "include_prompt": true
10
+ }
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt140/snapshots/6c509483aedc7c5e93826c4a8a1184c2ddf21312/README.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen3-Embedding-0.6B
3
+ library_name: sentence-transformers
4
+ pipeline_tag: sentence-similarity
5
+ tags: [sentence-transformers, qwen3, embedding, ms-swift, infonce]
6
+ ---
7
+ # canho/qwen3-emb-0.6b-ar-ours6k-ckpt140
8
+
9
+ Qwen/Qwen3-Embedding-0.6B full fine-tuned with ms-swift InfoNCE, checkpoint at step 140 of 815
10
+ (epoch 0.86; best eval-loss checkpoint of the run so far: `checkpoint-140`).
11
+
12
+ - Training data: HF canho/ours-6k train split (5,469 pairs; query + 1 positive + 9 hard negatives)
13
+ - Recipe: Qwen3-Embedding SWIFT.md (`swift sft --task_type embedding --loss_type infonce`), same recipe as the step-1 / ablation runs: lr 6e-6 (cosine), 5 epochs, 32 queries/step (8 GPUs x per-device 1 x grad-acc 4; earlier runs 2 x 4 x 4), in-batch negatives across the 8 queries of a micro-batch (embeddings all-gathered across GPUs), temperature 0.1, DeepSpeed ZeRO-3, bf16, 5% held out for eval, eval + checkpoint every 10 steps, seed 42.
14
+ - Query prompt (set in `config_sentence_transformers.json`, prepended to every query): 'Query:'; documents without a prompt.
15
+
16
+ ```python
17
+ from sentence_transformers import SentenceTransformer
18
+ m = SentenceTransformer("canho/qwen3-emb-0.6b-ar-ours6k-ckpt140", processor_kwargs={"padding_side": "left"})
19
+ q = m.encode(["..."], prompt_name="query"); d = m.encode(["..."])
20
+ ```
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt140/snapshots/6c509483aedc7c5e93826c4a8a1184c2ddf21312/chat_template.jinja ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
27
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
28
+ {%- elif message.role == "assistant" %}
29
+ {%- set content = message.content %}
30
+ {%- set reasoning_content = '' %}
31
+ {%- if message.reasoning_content is defined and message.reasoning_content is not none %}
32
+ {%- set reasoning_content = message.reasoning_content %}
33
+ {%- else %}
34
+ {%- if '</think>' in message.content %}
35
+ {%- set content = message.content.split('</think>')[-1].lstrip('\n') %}
36
+ {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
37
+ {%- endif %}
38
+ {%- endif %}
39
+ {%- if loop.index0 > ns.last_query_index %}
40
+ {%- if loop.last or (not loop.last and reasoning_content) %}
41
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
42
+ {%- else %}
43
+ {{- '<|im_start|>' + message.role + '\n' + content }}
44
+ {%- endif %}
45
+ {%- else %}
46
+ {{- '<|im_start|>' + message.role + '\n' + content }}
47
+ {%- endif %}
48
+ {%- if message.tool_calls %}
49
+ {%- for tool_call in message.tool_calls %}
50
+ {%- if (loop.first and content) or (not loop.first) %}
51
+ {{- '\n' }}
52
+ {%- endif %}
53
+ {%- if tool_call.function %}
54
+ {%- set tool_call = tool_call.function %}
55
+ {%- endif %}
56
+ {{- '<tool_call>\n{"name": "' }}
57
+ {{- tool_call.name }}
58
+ {{- '", "arguments": ' }}
59
+ {%- if tool_call.arguments is string %}
60
+ {{- tool_call.arguments }}
61
+ {%- else %}
62
+ {{- tool_call.arguments | tojson }}
63
+ {%- endif %}
64
+ {{- '}\n</tool_call>' }}
65
+ {%- endfor %}
66
+ {%- endif %}
67
+ {{- '<|im_end|>\n' }}
68
+ {%- elif message.role == "tool" %}
69
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
70
+ {{- '<|im_start|>user' }}
71
+ {%- endif %}
72
+ {{- '\n<tool_response>\n' }}
73
+ {{- message.content }}
74
+ {{- '\n</tool_response>' }}
75
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
76
+ {{- '<|im_end|>\n' }}
77
+ {%- endif %}
78
+ {%- endif %}
79
+ {%- endfor %}
80
+ {%- if add_generation_prompt %}
81
+ {{- '<|im_start|>assistant\n' }}
82
+ {%- if enable_thinking is defined and enable_thinking is false %}
83
+ {{- '<think>\n\n</think>\n\n' }}
84
+ {%- endif %}
85
+ {%- endif %}
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt140/snapshots/6c509483aedc7c5e93826c4a8a1184c2ddf21312/config.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": null,
8
+ "dtype": "bfloat16",
9
+ "eos_token_id": 151645,
10
+ "head_dim": 128,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 1024,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 3072,
15
+ "layer_types": [
16
+ "full_attention",
17
+ "full_attention",
18
+ "full_attention",
19
+ "full_attention",
20
+ "full_attention",
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention"
44
+ ],
45
+ "max_position_embeddings": 32768,
46
+ "max_window_layers": 28,
47
+ "model_type": "qwen3",
48
+ "num_attention_heads": 16,
49
+ "num_hidden_layers": 28,
50
+ "num_key_value_heads": 8,
51
+ "pad_token_id": 151643,
52
+ "rms_norm_eps": 1e-06,
53
+ "rope_parameters": {
54
+ "rope_theta": 1000000,
55
+ "rope_type": "default"
56
+ },
57
+ "sliding_window": null,
58
+ "tie_word_embeddings": true,
59
+ "transformers_version": "5.16.1",
60
+ "use_cache": false,
61
+ "use_sliding_window": false,
62
+ "vocab_size": 151669
63
+ }
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt140/snapshots/6c509483aedc7c5e93826c4a8a1184c2ddf21312/config_sentence_transformers.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "prompts": {
3
+ "query": "Query:",
4
+ "document": ""
5
+ },
6
+ "default_prompt_name": null,
7
+ "similarity_fn_name": "cosine"
8
+ }
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt140/snapshots/6c509483aedc7c5e93826c4a8a1184c2ddf21312/modules.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.models.Transformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.models.Pooling"
13
+ },
14
+ {
15
+ "idx": 2,
16
+ "name": "2",
17
+ "path": "2_Normalize",
18
+ "type": "sentence_transformers.models.Normalize"
19
+ }
20
+ ]
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt140/snapshots/6c509483aedc7c5e93826c4a8a1184c2ddf21312/tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": true,
9
+ "local_files_only": false,
10
+ "model_max_length": 131072,
11
+ "pad_token": "<|endoftext|>",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "Qwen2Tokenizer",
14
+ "unk_token": null
15
+ }
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt160/refs/main ADDED
@@ -0,0 +1 @@
 
 
1
+ 5ead7f08e8cdca55ea2507b891f9d259a57dd1c7
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt160/snapshots/5ead7f08e8cdca55ea2507b891f9d259a57dd1c7/1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 1024,
3
+ "pooling_mode_cls_token": false,
4
+ "pooling_mode_mean_tokens": false,
5
+ "pooling_mode_max_tokens": false,
6
+ "pooling_mode_mean_sqrt_len_tokens": false,
7
+ "pooling_mode_weightedmean_tokens": false,
8
+ "pooling_mode_lasttoken": true,
9
+ "include_prompt": true
10
+ }
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt160/snapshots/5ead7f08e8cdca55ea2507b891f9d259a57dd1c7/README.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen3-Embedding-0.6B
3
+ library_name: sentence-transformers
4
+ pipeline_tag: sentence-similarity
5
+ tags: [sentence-transformers, qwen3, embedding, ms-swift, infonce]
6
+ ---
7
+ # canho/qwen3-emb-0.6b-ar-ours6k-ckpt160
8
+
9
+ Qwen/Qwen3-Embedding-0.6B full fine-tuned with ms-swift InfoNCE, checkpoint at step 160 of 815
10
+ (epoch 0.99; best eval-loss checkpoint of the run so far: `checkpoint-150`).
11
+
12
+ - Training data: HF canho/ours-6k train split (5,469 pairs; query + 1 positive + 9 hard negatives)
13
+ - Recipe: Qwen3-Embedding SWIFT.md (`swift sft --task_type embedding --loss_type infonce`), same recipe as the step-1 / ablation runs: lr 6e-6 (cosine), 5 epochs, 32 queries/step (8 GPUs x per-device 1 x grad-acc 4; earlier runs 2 x 4 x 4), in-batch negatives across the 8 queries of a micro-batch (embeddings all-gathered across GPUs), temperature 0.1, DeepSpeed ZeRO-3, bf16, 5% held out for eval, eval + checkpoint every 10 steps, seed 42.
14
+ - Query prompt (set in `config_sentence_transformers.json`, prepended to every query): 'Query:'; documents without a prompt.
15
+
16
+ ```python
17
+ from sentence_transformers import SentenceTransformer
18
+ m = SentenceTransformer("canho/qwen3-emb-0.6b-ar-ours6k-ckpt160", processor_kwargs={"padding_side": "left"})
19
+ q = m.encode(["..."], prompt_name="query"); d = m.encode(["..."])
20
+ ```
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt160/snapshots/5ead7f08e8cdca55ea2507b891f9d259a57dd1c7/chat_template.jinja ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
27
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
28
+ {%- elif message.role == "assistant" %}
29
+ {%- set content = message.content %}
30
+ {%- set reasoning_content = '' %}
31
+ {%- if message.reasoning_content is defined and message.reasoning_content is not none %}
32
+ {%- set reasoning_content = message.reasoning_content %}
33
+ {%- else %}
34
+ {%- if '</think>' in message.content %}
35
+ {%- set content = message.content.split('</think>')[-1].lstrip('\n') %}
36
+ {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
37
+ {%- endif %}
38
+ {%- endif %}
39
+ {%- if loop.index0 > ns.last_query_index %}
40
+ {%- if loop.last or (not loop.last and reasoning_content) %}
41
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
42
+ {%- else %}
43
+ {{- '<|im_start|>' + message.role + '\n' + content }}
44
+ {%- endif %}
45
+ {%- else %}
46
+ {{- '<|im_start|>' + message.role + '\n' + content }}
47
+ {%- endif %}
48
+ {%- if message.tool_calls %}
49
+ {%- for tool_call in message.tool_calls %}
50
+ {%- if (loop.first and content) or (not loop.first) %}
51
+ {{- '\n' }}
52
+ {%- endif %}
53
+ {%- if tool_call.function %}
54
+ {%- set tool_call = tool_call.function %}
55
+ {%- endif %}
56
+ {{- '<tool_call>\n{"name": "' }}
57
+ {{- tool_call.name }}
58
+ {{- '", "arguments": ' }}
59
+ {%- if tool_call.arguments is string %}
60
+ {{- tool_call.arguments }}
61
+ {%- else %}
62
+ {{- tool_call.arguments | tojson }}
63
+ {%- endif %}
64
+ {{- '}\n</tool_call>' }}
65
+ {%- endfor %}
66
+ {%- endif %}
67
+ {{- '<|im_end|>\n' }}
68
+ {%- elif message.role == "tool" %}
69
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
70
+ {{- '<|im_start|>user' }}
71
+ {%- endif %}
72
+ {{- '\n<tool_response>\n' }}
73
+ {{- message.content }}
74
+ {{- '\n</tool_response>' }}
75
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
76
+ {{- '<|im_end|>\n' }}
77
+ {%- endif %}
78
+ {%- endif %}
79
+ {%- endfor %}
80
+ {%- if add_generation_prompt %}
81
+ {{- '<|im_start|>assistant\n' }}
82
+ {%- if enable_thinking is defined and enable_thinking is false %}
83
+ {{- '<think>\n\n</think>\n\n' }}
84
+ {%- endif %}
85
+ {%- endif %}
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt160/snapshots/5ead7f08e8cdca55ea2507b891f9d259a57dd1c7/config.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": null,
8
+ "dtype": "bfloat16",
9
+ "eos_token_id": 151645,
10
+ "head_dim": 128,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 1024,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 3072,
15
+ "layer_types": [
16
+ "full_attention",
17
+ "full_attention",
18
+ "full_attention",
19
+ "full_attention",
20
+ "full_attention",
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention"
44
+ ],
45
+ "max_position_embeddings": 32768,
46
+ "max_window_layers": 28,
47
+ "model_type": "qwen3",
48
+ "num_attention_heads": 16,
49
+ "num_hidden_layers": 28,
50
+ "num_key_value_heads": 8,
51
+ "pad_token_id": 151643,
52
+ "rms_norm_eps": 1e-06,
53
+ "rope_parameters": {
54
+ "rope_theta": 1000000,
55
+ "rope_type": "default"
56
+ },
57
+ "sliding_window": null,
58
+ "tie_word_embeddings": true,
59
+ "transformers_version": "5.16.1",
60
+ "use_cache": false,
61
+ "use_sliding_window": false,
62
+ "vocab_size": 151669
63
+ }
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt160/snapshots/5ead7f08e8cdca55ea2507b891f9d259a57dd1c7/config_sentence_transformers.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "prompts": {
3
+ "query": "Query:",
4
+ "document": ""
5
+ },
6
+ "default_prompt_name": null,
7
+ "similarity_fn_name": "cosine"
8
+ }
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt160/snapshots/5ead7f08e8cdca55ea2507b891f9d259a57dd1c7/modules.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.models.Transformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.models.Pooling"
13
+ },
14
+ {
15
+ "idx": 2,
16
+ "name": "2",
17
+ "path": "2_Normalize",
18
+ "type": "sentence_transformers.models.Normalize"
19
+ }
20
+ ]
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt160/snapshots/5ead7f08e8cdca55ea2507b891f9d259a57dd1c7/tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": true,
9
+ "local_files_only": false,
10
+ "model_max_length": 131072,
11
+ "pad_token": "<|endoftext|>",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "Qwen2Tokenizer",
14
+ "unk_token": null
15
+ }
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt815/refs/main ADDED
@@ -0,0 +1 @@
 
 
1
+ 0354597c088496103b416f4bd34aa2e0858b8e4c
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt815/snapshots/0354597c088496103b416f4bd34aa2e0858b8e4c/1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 1024,
3
+ "pooling_mode_cls_token": false,
4
+ "pooling_mode_mean_tokens": false,
5
+ "pooling_mode_max_tokens": false,
6
+ "pooling_mode_mean_sqrt_len_tokens": false,
7
+ "pooling_mode_weightedmean_tokens": false,
8
+ "pooling_mode_lasttoken": true,
9
+ "include_prompt": true
10
+ }
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt815/snapshots/0354597c088496103b416f4bd34aa2e0858b8e4c/README.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen3-Embedding-0.6B
3
+ library_name: sentence-transformers
4
+ pipeline_tag: sentence-similarity
5
+ tags: [sentence-transformers, qwen3, embedding, ms-swift, infonce]
6
+ ---
7
+ # canho/qwen3-emb-0.6b-ar-ours6k-ckpt815
8
+
9
+ Qwen/Qwen3-Embedding-0.6B full fine-tuned with ms-swift InfoNCE, checkpoint at step 815 of 815
10
+ (epoch 5.00; best eval-loss checkpoint of the run so far: `checkpoint-310`).
11
+
12
+ - Training data: HF canho/ours-6k train split (5,469 pairs; query + 1 positive + 9 hard negatives)
13
+ - Recipe: Qwen3-Embedding SWIFT.md (`swift sft --task_type embedding --loss_type infonce`), same recipe as the step-1 / ablation runs: lr 6e-6 (cosine), 5 epochs, 32 queries/step (8 GPUs x per-device 1 x grad-acc 4; earlier runs 2 x 4 x 4), in-batch negatives across the 8 queries of a micro-batch (embeddings all-gathered across GPUs), temperature 0.1, DeepSpeed ZeRO-3, bf16, 5% held out for eval, eval + checkpoint every 10 steps, seed 42.
14
+ - Query prompt (set in `config_sentence_transformers.json`, prepended to every query): 'Query:'; documents without a prompt.
15
+
16
+ ```python
17
+ from sentence_transformers import SentenceTransformer
18
+ m = SentenceTransformer("canho/qwen3-emb-0.6b-ar-ours6k-ckpt815", processor_kwargs={"padding_side": "left"})
19
+ q = m.encode(["..."], prompt_name="query"); d = m.encode(["..."])
20
+ ```
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt815/snapshots/0354597c088496103b416f4bd34aa2e0858b8e4c/chat_template.jinja ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
27
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
28
+ {%- elif message.role == "assistant" %}
29
+ {%- set content = message.content %}
30
+ {%- set reasoning_content = '' %}
31
+ {%- if message.reasoning_content is defined and message.reasoning_content is not none %}
32
+ {%- set reasoning_content = message.reasoning_content %}
33
+ {%- else %}
34
+ {%- if '</think>' in message.content %}
35
+ {%- set content = message.content.split('</think>')[-1].lstrip('\n') %}
36
+ {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
37
+ {%- endif %}
38
+ {%- endif %}
39
+ {%- if loop.index0 > ns.last_query_index %}
40
+ {%- if loop.last or (not loop.last and reasoning_content) %}
41
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
42
+ {%- else %}
43
+ {{- '<|im_start|>' + message.role + '\n' + content }}
44
+ {%- endif %}
45
+ {%- else %}
46
+ {{- '<|im_start|>' + message.role + '\n' + content }}
47
+ {%- endif %}
48
+ {%- if message.tool_calls %}
49
+ {%- for tool_call in message.tool_calls %}
50
+ {%- if (loop.first and content) or (not loop.first) %}
51
+ {{- '\n' }}
52
+ {%- endif %}
53
+ {%- if tool_call.function %}
54
+ {%- set tool_call = tool_call.function %}
55
+ {%- endif %}
56
+ {{- '<tool_call>\n{"name": "' }}
57
+ {{- tool_call.name }}
58
+ {{- '", "arguments": ' }}
59
+ {%- if tool_call.arguments is string %}
60
+ {{- tool_call.arguments }}
61
+ {%- else %}
62
+ {{- tool_call.arguments | tojson }}
63
+ {%- endif %}
64
+ {{- '}\n</tool_call>' }}
65
+ {%- endfor %}
66
+ {%- endif %}
67
+ {{- '<|im_end|>\n' }}
68
+ {%- elif message.role == "tool" %}
69
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
70
+ {{- '<|im_start|>user' }}
71
+ {%- endif %}
72
+ {{- '\n<tool_response>\n' }}
73
+ {{- message.content }}
74
+ {{- '\n</tool_response>' }}
75
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
76
+ {{- '<|im_end|>\n' }}
77
+ {%- endif %}
78
+ {%- endif %}
79
+ {%- endfor %}
80
+ {%- if add_generation_prompt %}
81
+ {{- '<|im_start|>assistant\n' }}
82
+ {%- if enable_thinking is defined and enable_thinking is false %}
83
+ {{- '<think>\n\n</think>\n\n' }}
84
+ {%- endif %}
85
+ {%- endif %}
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt815/snapshots/0354597c088496103b416f4bd34aa2e0858b8e4c/config.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": null,
8
+ "dtype": "bfloat16",
9
+ "eos_token_id": 151645,
10
+ "head_dim": 128,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 1024,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 3072,
15
+ "layer_types": [
16
+ "full_attention",
17
+ "full_attention",
18
+ "full_attention",
19
+ "full_attention",
20
+ "full_attention",
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention"
44
+ ],
45
+ "max_position_embeddings": 32768,
46
+ "max_window_layers": 28,
47
+ "model_type": "qwen3",
48
+ "num_attention_heads": 16,
49
+ "num_hidden_layers": 28,
50
+ "num_key_value_heads": 8,
51
+ "pad_token_id": 151643,
52
+ "rms_norm_eps": 1e-06,
53
+ "rope_parameters": {
54
+ "rope_theta": 1000000,
55
+ "rope_type": "default"
56
+ },
57
+ "sliding_window": null,
58
+ "tie_word_embeddings": true,
59
+ "transformers_version": "5.16.1",
60
+ "use_cache": false,
61
+ "use_sliding_window": false,
62
+ "vocab_size": 151669
63
+ }
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt815/snapshots/0354597c088496103b416f4bd34aa2e0858b8e4c/config_sentence_transformers.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "prompts": {
3
+ "query": "Query:",
4
+ "document": ""
5
+ },
6
+ "default_prompt_name": null,
7
+ "similarity_fn_name": "cosine"
8
+ }
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt815/snapshots/0354597c088496103b416f4bd34aa2e0858b8e4c/modules.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "idx": 0,
4
+ "name": "0",
5
+ "path": "",
6
+ "type": "sentence_transformers.models.Transformer"
7
+ },
8
+ {
9
+ "idx": 1,
10
+ "name": "1",
11
+ "path": "1_Pooling",
12
+ "type": "sentence_transformers.models.Pooling"
13
+ },
14
+ {
15
+ "idx": 2,
16
+ "name": "2",
17
+ "path": "2_Normalize",
18
+ "type": "sentence_transformers.models.Normalize"
19
+ }
20
+ ]
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-ours6k-ckpt815/snapshots/0354597c088496103b416f4bd34aa2e0858b8e4c/tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": true,
9
+ "local_files_only": false,
10
+ "model_max_length": 131072,
11
+ "pad_token": "<|endoftext|>",
12
+ "split_special_tokens": false,
13
+ "tokenizer_class": "Qwen2Tokenizer",
14
+ "unk_token": null
15
+ }
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-step2-interim-nohn-ckpt140/refs/main ADDED
@@ -0,0 +1 @@
 
 
1
+ d432d68d88ebce93cbc3c8a60661cbe09032c648
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-step2-interim-nohn-ckpt140/snapshots/d432d68d88ebce93cbc3c8a60661cbe09032c648/1_Pooling/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 1024,
3
+ "pooling_mode_cls_token": false,
4
+ "pooling_mode_mean_tokens": false,
5
+ "pooling_mode_max_tokens": false,
6
+ "pooling_mode_mean_sqrt_len_tokens": false,
7
+ "pooling_mode_weightedmean_tokens": false,
8
+ "pooling_mode_lasttoken": true,
9
+ "include_prompt": true
10
+ }
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-step2-interim-nohn-ckpt140/snapshots/d432d68d88ebce93cbc3c8a60661cbe09032c648/README.md ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen3-Embedding-0.6B
3
+ library_name: sentence-transformers
4
+ pipeline_tag: sentence-similarity
5
+ tags: [sentence-transformers, qwen3, embedding, ms-swift, infonce]
6
+ ---
7
+ # canho/qwen3-emb-0.6b-ar-step2-interim-nohn-ckpt140
8
+
9
+ Qwen/Qwen3-Embedding-0.6B full fine-tuned with ms-swift InfoNCE, checkpoint at step 140 of 375
10
+ (epoch 1.88; best eval-loss checkpoint of the run so far: `checkpoint-140`).
11
+
12
+ - Training data: ours without hard negatives: canho/ar-pairs-train-step2-interim (2,506 pairs), in-batch negatives only
13
+ - Recipe: Qwen3-Embedding SWIFT.md (`swift sft --task_type embedding --loss_type infonce`), lr 6e-6 (cosine), 5 epochs, 2 GPUs x per-device 4
14
+ x grad-acc 4 = 32 queries/step, in-batch negatives across the 8 queries of a micro-batch, temperature 0.1, DeepSpeed ZeRO-3, bf16,
15
+ 5% held out for eval, checkpoint every 20 steps, seed 42.
16
+ - Query prompt (set in `config_sentence_transformers.json`, prepended to every query): 'Query:'; documents without a prompt.
17
+
18
+ ```python
19
+ from sentence_transformers import SentenceTransformer
20
+ m = SentenceTransformer("canho/qwen3-emb-0.6b-ar-step2-interim-nohn-ckpt140", processor_kwargs={"padding_side": "left"})
21
+ q = m.encode(["..."], prompt_name="query"); d = m.encode(["..."])
22
+ ```
bright_work/hf/hub/models--canho--qwen3-emb-0.6b-ar-step2-interim-nohn-ckpt140/snapshots/d432d68d88ebce93cbc3c8a60661cbe09032c648/chat_template.jinja ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
27
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
28
+ {%- elif message.role == "assistant" %}
29
+ {%- set content = message.content %}
30
+ {%- set reasoning_content = '' %}
31
+ {%- if message.reasoning_content is defined and message.reasoning_content is not none %}
32
+ {%- set reasoning_content = message.reasoning_content %}
33
+ {%- else %}
34
+ {%- if '</think>' in message.content %}
35
+ {%- set content = message.content.split('</think>')[-1].lstrip('\n') %}
36
+ {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
37
+ {%- endif %}
38
+ {%- endif %}
39
+ {%- if loop.index0 > ns.last_query_index %}
40
+ {%- if loop.last or (not loop.last and reasoning_content) %}
41
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
42
+ {%- else %}
43
+ {{- '<|im_start|>' + message.role + '\n' + content }}
44
+ {%- endif %}
45
+ {%- else %}
46
+ {{- '<|im_start|>' + message.role + '\n' + content }}
47
+ {%- endif %}
48
+ {%- if message.tool_calls %}
49
+ {%- for tool_call in message.tool_calls %}
50
+ {%- if (loop.first and content) or (not loop.first) %}
51
+ {{- '\n' }}
52
+ {%- endif %}
53
+ {%- if tool_call.function %}
54
+ {%- set tool_call = tool_call.function %}
55
+ {%- endif %}
56
+ {{- '<tool_call>\n{"name": "' }}
57
+ {{- tool_call.name }}
58
+ {{- '", "arguments": ' }}
59
+ {%- if tool_call.arguments is string %}
60
+ {{- tool_call.arguments }}
61
+ {%- else %}
62
+ {{- tool_call.arguments | tojson }}
63
+ {%- endif %}
64
+ {{- '}\n</tool_call>' }}
65
+ {%- endfor %}
66
+ {%- endif %}
67
+ {{- '<|im_end|>\n' }}
68
+ {%- elif message.role == "tool" %}
69
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
70
+ {{- '<|im_start|>user' }}
71
+ {%- endif %}
72
+ {{- '\n<tool_response>\n' }}
73
+ {{- message.content }}
74
+ {{- '\n</tool_response>' }}
75
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
76
+ {{- '<|im_end|>\n' }}
77
+ {%- endif %}
78
+ {%- endif %}
79
+ {%- endfor %}
80
+ {%- if add_generation_prompt %}
81
+ {{- '<|im_start|>assistant\n' }}
82
+ {%- if enable_thinking is defined and enable_thinking is false %}
83
+ {{- '<think>\n\n</think>\n\n' }}
84
+ {%- endif %}
85
+ {%- endif %}