ChristianAzinn commited on
Commit
ddeff29
1 Parent(s): 844ad2f

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +171 -0
README.md ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: avsolatorio/gist-large-embedding-v0
3
+ inference: false
4
+ language:
5
+ - en
6
+ license: mit
7
+ model_creator: avsolatorio
8
+ model_name: gist-large-embedding-v0
9
+ model_type: bert
10
+ quantized_by: ChristianAzinn
11
+ library_name: sentence-transformers
12
+ pipeline_tag: feature-extraction
13
+ tags:
14
+ - feature-extraction
15
+ - mteb
16
+ - sentence-similarity
17
+ - sentence-transformers
18
+ - bert
19
+ - gguf
20
+ ---
21
+
22
+ # gist-large-embedding-v0-gguf
23
+
24
+ Model creator: [avsolatorio](https://huggingface.co/avsolatorio)
25
+
26
+ Original model: [gist-large-embedding-v0](https://huggingface.co/avsolatorio/gist-large-embedding-v0)
27
+
28
+ ## Original Description
29
+
30
+ The model is fine-tuned on top of the [BAAI/bge-large-en-v1.5](https://huggingface.co/BAAI/bge-large-en-v1.5) using the [MEDI dataset](https://github.com/xlang-ai/instructor-embedding.git) augmented with mined triplets from the [MTEB Classification](https://huggingface.co/mteb) training dataset (excluding data from the Amazon Polarity Classification task).
31
+
32
+ The model does not require any instruction for generating embeddings. This means that queries for retrieval tasks can be directly encoded without crafting instructions.
33
+
34
+ Technical paper: [GISTEmbed: Guided In-sample Selection of Training Negatives for Text Embedding Fine-tuning](https://arxiv.org/abs/2402.16829)
35
+
36
+
37
+ # Data
38
+
39
+ The dataset used is a compilation of the MEDI and MTEB Classification training datasets. Third-party datasets may be subject to additional terms and conditions under their associated licenses. A HuggingFace Dataset version of the compiled dataset, and the specific revision used to train the model, is available:
40
+
41
+ - Dataset: [avsolatorio/medi-data-mteb_avs_triplets](https://huggingface.co/datasets/avsolatorio/medi-data-mteb_avs_triplets)
42
+ - Revision: 238a0499b6e6b690cc64ea56fde8461daa8341bb
43
+
44
+ The dataset contains a `task_type` key, which can be used to select only the mteb classification tasks (prefixed with `mteb_`).
45
+
46
+ The **MEDI Dataset** is published in the following paper: [One Embedder, Any Task: Instruction-Finetuned Text Embeddings](https://arxiv.org/abs/2212.09741).
47
+
48
+ The MTEB Benchmark results of the GIST embedding model, compared with the base model, suggest that the fine-tuning dataset has perturbed the model considerably, which resulted in significant improvements in certain tasks while adversely degrading performance in some.
49
+
50
+ The retrieval performance for the TRECCOVID task is of note. The fine-tuning dataset does not contain significant knowledge about COVID-19, which could have caused the observed performance degradation. We found some evidence, detailed in the paper, that thematic coverage of the fine-tuning data can affect downstream performance.
51
+
52
+
53
+ ## Description
54
+
55
+ This repo contains GGUF format files for the gist-large-embedding-v0 embedding model.
56
+
57
+ These files were converted and quantized with llama.cpp [PR 5500](https://github.com/ggerganov/llama.cpp/pull/5500), commit [34aa045de](https://github.com/ggerganov/llama.cpp/pull/5500/commits/34aa045de44271ff7ad42858c75739303b8dc6eb), on a consumer RTX 4090.
58
+
59
+ This model supports up to 512 tokens of context.
60
+
61
+ ## Compatibility
62
+
63
+ These files are compatible with [llama.cpp](https://github.com/ggerganov/llama.cpp) as of commit [4524290e8](https://github.com/ggerganov/llama.cpp/commit/4524290e87b8e107cc2b56e1251751546f4b9051), as well as [LM Studio](https://lmstudio.ai/) as of version 0.2.19.
64
+
65
+ # Meta-information
66
+ ## Explanation of quantisation methods
67
+ <details>
68
+ <summary>Click to see details</summary>
69
+ The methods available are:
70
+ * GGML_TYPE_Q2_K - "type-1" 2-bit quantization in super-blocks containing 16 blocks, each block having 16 weight. Block scales and mins are quantized with 4 bits. This ends up effectively using 2.5625 bits per weight (bpw)
71
+ * GGML_TYPE_Q3_K - "type-0" 3-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. Scales are quantized with 6 bits. This end up using 3.4375 bpw.
72
+ * GGML_TYPE_Q4_K - "type-1" 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.
73
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
74
+ * GGML_TYPE_Q6_K - "type-0" 6-bit quantization. Super-blocks with 16 blocks, each block having 16 weights. Scales are quantized with 8 bits. This ends up using 6.5625 bpw
75
+ Refer to the Provided Files table below to see what files use which methods, and how.
76
+ </details>
77
+
78
+ ## Provided Files
79
+ | Name | Quant method | Bits | Size | Max RAM required | Use case |
80
+ | ---- | ---- | ---- | ---- | ---- | ----- |
81
+ | Name | Quant method | Bits | Size | Use case |
82
+ | [gist-large-embedding-v0.Q2_K.gguf](https://huggingface.co/ChristianAzinn/gist-large-embedding-v0-gguf/blob/main/gist-large-embedding-v0.Q2_K.gguf) | Q2_K | 2 | 144 MB | smallest, significant quality loss - not recommended for most purposes |
83
+ | [gist-large-embedding-v0.Q3_K_S.gguf](https://huggingface.co/ChristianAzinn/gist-large-embedding-v0-gguf/blob/main/gist-large-embedding-v0.Q3_K_S.gguf) | Q3_K_S | 3 | 160 MB | very small, high quality loss |
84
+ | [gist-large-embedding-v0.Q3_K_M.gguf](https://huggingface.co/ChristianAzinn/gist-large-embedding-v0-gguf/blob/main/gist-large-embedding-v0.Q3_K_M.gguf) | Q3_K_M | 3 | 181 MB | very small, high quality loss |
85
+ | [gist-large-embedding-v0.Q3_K_L.gguf](https://huggingface.co/ChristianAzinn/gist-large-embedding-v0-gguf/blob/main/gist-large-embedding-v0.Q3_K_L.gguf) | Q3_K_L | 3 | 198 MB | small, substantial quality loss |
86
+ | [gist-large-embedding-v0.Q4_0.gguf](https://huggingface.co/ChristianAzinn/gist-large-embedding-v0-gguf/blob/main/gist-large-embedding-v0.Q4_0.gguf) | Q4_0 | 4 | 200 MB | legacy; small, very high quality loss - prefer using Q3_K_M |
87
+ | [gist-large-embedding-v0.Q4_K_S.gguf](https://huggingface.co/ChristianAzinn/gist-large-embedding-v0-gguf/blob/main/gist-large-embedding-v0.Q4_K_S.gguf) | Q4_K_S | 4 | 203 MB | small, greater quality loss |
88
+ | [gist-large-embedding-v0.Q4_K_M.gguf](https://huggingface.co/ChristianAzinn/gist-large-embedding-v0-gguf/blob/main/gist-large-embedding-v0.Q4_K_M.gguf) | Q4_K_M | 4 | 216 MB | medium, balanced quality - recommended |
89
+ | [gist-large-embedding-v0.Q5_0.gguf](https://huggingface.co/ChristianAzinn/gist-large-embedding-v0-gguf/blob/main/gist-large-embedding-v0.Q5_0.gguf) | Q5_0 | 5 | 237 MB | legacy; medium, balanced quality - prefer using Q4_K_M |
90
+ | [gist-large-embedding-v0.Q5_K_S.gguf](https://huggingface.co/ChristianAzinn/gist-large-embedding-v0-gguf/blob/main/gist-large-embedding-v0.Q5_K_S.gguf) | Q5_K_S | 5 | 237 MB | large, low quality loss - recommended |
91
+ | [gist-large-embedding-v0.Q5_K_M.gguf](https://huggingface.co/ChristianAzinn/gist-large-embedding-v0-gguf/blob/main/gist-large-embedding-v0.Q5_K_M.gguf) | Q5_K_M | 5 | 246 MB | large, very low quality loss - recommended |
92
+ | [gist-large-embedding-v0.Q6_K.gguf](https://huggingface.co/ChristianAzinn/gist-large-embedding-v0-gguf/blob/main/gist-large-embedding-v0.Q6_K.gguf) | Q6_K | 6 | 278 MB | very large, extremely low quality loss |
93
+ | [gist-large-embedding-v0.Q8_0.gguf](https://huggingface.co/ChristianAzinn/gist-large-embedding-v0-gguf/blob/main/gist-large-embedding-v0.Q8_0.gguf) | Q8_0 | 8 | 358 MB | very large, extremely low quality loss - recommended |
94
+ | [gist-large-embedding-v0.Q8_0.gguf](https://huggingface.co/ChristianAzinn/gist-large-embedding-v0-gguf/blob/main/gist-large-embedding-v0_fp16.gguf) | FP16 | 16 | 670 MB | enormous, pretty much the original model - not recommended |
95
+ | [gist-large-embedding-v0.Q8_0.gguf](https://huggingface.co/ChristianAzinn/gist-large-embedding-v0-gguf/blob/main/gist-large-embedding-v0_fp32.gguf) | FP32 | 32 | 1.34 GB | enormous, pretty much the original model - not recommended |
96
+
97
+ # Examples
98
+ ## Example Usage with `llama.cpp`
99
+
100
+ To compute a single embedding, build llama.cpp and run:
101
+ ```shell
102
+ ./embedding -ngl 99 -m [filepath-to-gguf].gguf -p 'search_query: What is TSNE?'
103
+ ```
104
+
105
+ You can also submit a batch of texts to embed, as long as the total number of tokens does not exceed the context length. Only the first three embeddings are shown by the `embedding` example.
106
+
107
+ `texts.txt`:
108
+ ```
109
+ search_query: What is TSNE?
110
+ search_query: Who is Laurens Van der Maaten?
111
+ ```
112
+
113
+ Compute multiple embeddings:
114
+ ```shell
115
+ ./embedding -ngl 99 -m [filepath-to-gguf].gguf -f texts.txt
116
+ ```
117
+
118
+ ## Example Usage with LM Studio
119
+
120
+ Download the 0.2.19 beta build from here: [Windows](https://releases.lmstudio.ai/windows/0.2.19/beta/LM-Studio-0.2.19-Setup-Preview-1.exe) [MacOS](https://releases.lmstudio.ai/mac/arm64/0.2.19/beta/LM-Studio-darwin-arm64-0.2.19-Preview-1.zip) [Linux](https://releases.lmstudio.ai/linux/0.2.19/beta/LM_Studio-0.2.19-Preview-1.AppImage)
121
+
122
+ Once installed, open the app. The home should look like this:
123
+
124
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6584f042b378d311dccea501/QGkYvH242S0c_clPqX9Ip.png)
125
+
126
+ Search for either "ChristianAzinn" in the main search bar or go to the "Search" tab on the left menu and search the name there.
127
+
128
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6584f042b378d311dccea501/11hLos1JNMyZ1q2K9ICss.png)
129
+
130
+ Select your model from those that appear (this example uses `bge-small-en-v1.5-gguf`) and select which quantization you want to download. Since this model is pretty small, I recommend Q8_0, if not f16/32. Generally, the lower you go in the list (or the bigger the number gets), the larger the file and the better the performance.
131
+
132
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6584f042b378d311dccea501/hu9DuVYahQ-QpII5P8mVD.png)
133
+
134
+ You will see a green checkmark and the word "Downloaded" once the model has successfully downloaded, which can take some time depending on your network speeds.
135
+
136
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6584f042b378d311dccea501/7fmXkLDmGTNVyG3oqB4--.png)
137
+
138
+ Once this model is finished downloading, navigate to the "Local Server" tab on the left menu and open the loader for text embedding models. This loader does not appear before version 0.2.19, so ensure you downloaded the correct version.
139
+
140
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6584f042b378d311dccea501/OrzvqQIhB9p-aMq2G6Lxd.png)
141
+
142
+ Select the model you just downloaded from the dropdown that appears to load it. You may need to play with configuratios in the right-side menu, such as GPU offload if it doesn't fit entirely into VRAM.
143
+
144
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6584f042b378d311dccea501/TM4dO4DFP1xqZD1GWBqeI.png)
145
+
146
+ All that's left to do is to hit the "Start Server" button:
147
+
148
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6584f042b378d311dccea501/6TZvnX84rZKZ0TwVVLFnw.png)
149
+
150
+ And if you see text like that shown below in the console, you're good to go! You can use this as a drop-in replacement for the OpenAI embeddings API in any application that requires it, or you can query the endpoint directly to test it out.
151
+
152
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6584f042b378d311dccea501/kD47WaH-tzpr4qaAm-pMn.png)
153
+
154
+ Example curl request to the API endpoint:
155
+ ```shell
156
+ curl http://localhost:1234/v1/embeddings \
157
+ -H "Content-Type: application/json" \
158
+ -d '{
159
+ "input": "Your text string goes here",
160
+ "model": "model-identifier-here"
161
+ }'
162
+ ```
163
+
164
+ For more information, see the LM Studio [text embedding documentation](https://lmstudio.ai/docs/text-embeddings).
165
+
166
+
167
+ ## Acknowledgements
168
+
169
+ Thanks to the LM Studio team and everyone else working on open-source AI.
170
+
171
+ This README is inspired by that of [nomic-ai-embed-text-v1.5-gguf](https://huggingface.co/nomic-ai/nomic-embed-text-v1.5-gguf), another excellent embedding model, and those of the legendary [TheBloke](https://huggingface.co/TheBloke).