ChristianAzinn
commited on
Commit
•
d31e0c1
1
Parent(s):
9e7a183
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: Snowflake/snowflake-arctic-embed-m
|
3 |
+
inference: false
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
license: apache-2.0
|
7 |
+
model_creator: Snowflake
|
8 |
+
model_name: snowflake-arctic-embed-m
|
9 |
+
model_type: bert
|
10 |
+
quantized_by: ChristianAzinn
|
11 |
+
library_name: sentence-transformers
|
12 |
+
pipeline_tag: sentence-similarity
|
13 |
+
tags:
|
14 |
+
- sentence-transformers
|
15 |
+
- feature-extraction
|
16 |
+
- sentence-similarity
|
17 |
+
- mteb
|
18 |
+
- arctic
|
19 |
+
- snowflake-arctic-embed
|
20 |
+
- transformers.js
|
21 |
+
- gguf
|
22 |
+
---
|
23 |
+
|
24 |
+
# MODELNAME-gguf
|
25 |
+
|
26 |
+
Model creator: [Snowflake](https://huggingface.co/Snowflake)
|
27 |
+
|
28 |
+
Original model: [snowflake-arctic-embed-m](https://huggingface.co/Snowflake/snowflake-arctic-embed-m)
|
29 |
+
|
30 |
+
## Original Description
|
31 |
+
|
32 |
+
snowflake-arctic-embed is a suite of text embedding models that focuses on creating high-quality retrieval models optimized for performance.
|
33 |
+
|
34 |
+
|
35 |
+
The `snowflake-arctic-embedding` models achieve **state-of-the-art performance on the MTEB/BEIR leaderboard** for each of their size variants. Evaluation is performed using these [scripts](https://github.com/Snowflake-Labs/snowflake-arctic-embed/tree/main/src). As shown below, each class of model size achieves SOTA retrieval accuracy compared to other top models.
|
36 |
+
|
37 |
+
|
38 |
+
The models are trained by leveraging existing open-source text representation models, such as bert-base-uncased, and are trained in a multi-stage pipeline to optimize their retrieval performance. First, the models are trained with large batches of query-document pairs where negatives are derived in-batch—pretraining leverages about 400m samples of a mix of public datasets and proprietary web search data. Following pretraining models are further optimized with long training on a smaller dataset (about 1m samples) of triplets of query, positive document, and negative document derived from hard harmful mining. Mining of the negatives and data curation is crucial to retrieval accuracy. A detailed technical report will be available shortly.
|
39 |
+
|
40 |
+
|
41 |
+
| Name | MTEB Retrieval Score (NDCG @ 10) | Parameters (Millions) | Embedding Dimension |
|
42 |
+
| ----------------------------------------------------------------------- | -------------------------------- | --------------------- | ------------------- |
|
43 |
+
| [snowflake-arctic-embed-xs](https://huggingface.co/Snowflake/snowflake-arctic-embed-xs/) | 50.15 | 22 | 384 |
|
44 |
+
| [snowflake-arctic-embed-s](https://huggingface.co/Snowflake/snowflake-arctic-embed-s/) | 51.98 | 33 | 384 |
|
45 |
+
| [snowflake-arctic-embed-m](https://huggingface.co/Snowflake/snowflake-arctic-embed-m/) | 54.90 | 110 | 768 |
|
46 |
+
| [snowflake-arctic-embed-m-long](https://huggingface.co/Snowflake/snowflake-arctic-embed-m-long/) | 54.83 | 137 | 768 |
|
47 |
+
| [snowflake-arctic-embed-l](https://huggingface.co/Snowflake/snowflake-arctic-embed-l/) | 55.98 | 335 | 1024 |
|
48 |
+
|
49 |
+
|
50 |
+
### [snowflake-arctic-embed-m](https://huggingface.co/Snowflake/snowflake-arctic-embed-m/)
|
51 |
+
|
52 |
+
|
53 |
+
Based on the [intfloat/e5-base-unsupervised](https://huggingface.co/intfloat/e5-base-unsupervised) model, this medium model is the workhorse that provides the best retrieval performance without slowing down inference.
|
54 |
+
|
55 |
+
|
56 |
+
| Model Name | MTEB Retrieval Score (NDCG @ 10) |
|
57 |
+
| ------------------------------------------------------------------ | -------------------------------- |
|
58 |
+
| [snowflake-arctic-embed-m](https://huggingface.co/Snowflake/snowflake-arctic-embed-m/) | 54.90 |
|
59 |
+
| bge-base-en-v1.5 | 53.25 |
|
60 |
+
| nomic-embed-text-v1.5 | 53.25 |
|
61 |
+
| GIST-Embedding-v0 | 52.31 |
|
62 |
+
| gte-base | 52.31 |
|
63 |
+
|
64 |
+
## Description
|
65 |
+
|
66 |
+
This repo contains GGUF format files for the snowflake-arctic-embed-m embedding model.
|
67 |
+
|
68 |
+
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.
|
69 |
+
|
70 |
+
This model supports up to 512 tokens of context.
|
71 |
+
|
72 |
+
## Compatibility
|
73 |
+
|
74 |
+
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.
|
75 |
+
|
76 |
+
# Examples
|
77 |
+
## Example Usage with `llama.cpp`
|
78 |
+
|
79 |
+
To compute a single embedding, build llama.cpp and run:
|
80 |
+
```shell
|
81 |
+
./embedding -ngl 99 -m [filepath-to-gguf].gguf -p 'search_query: What is TSNE?'
|
82 |
+
```
|
83 |
+
|
84 |
+
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.
|
85 |
+
|
86 |
+
`texts.txt`:
|
87 |
+
```
|
88 |
+
search_query: What is TSNE?
|
89 |
+
search_query: Who is Laurens Van der Maaten?
|
90 |
+
```
|
91 |
+
|
92 |
+
Compute multiple embeddings:
|
93 |
+
```shell
|
94 |
+
./embedding -ngl 99 -m [filepath-to-gguf].gguf -f texts.txt
|
95 |
+
```
|
96 |
+
|
97 |
+
## Example Usage with LM Studio
|
98 |
+
|
99 |
+
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)
|
100 |
+
|
101 |
+
Once installed, open the app. The home should look like this:
|
102 |
+
|
103 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6584f042b378d311dccea501/QGkYvH242S0c_clPqX9Ip.png)
|
104 |
+
|
105 |
+
Search for either "ChristianAzinn" in the main search bar or go to the "Search" tab on the left menu and search the name there.
|
106 |
+
|
107 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6584f042b378d311dccea501/11hLos1JNMyZ1q2K9ICss.png)
|
108 |
+
|
109 |
+
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.
|
110 |
+
|
111 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6584f042b378d311dccea501/hu9DuVYahQ-QpII5P8mVD.png)
|
112 |
+
|
113 |
+
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.
|
114 |
+
|
115 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6584f042b378d311dccea501/7fmXkLDmGTNVyG3oqB4--.png)
|
116 |
+
|
117 |
+
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.
|
118 |
+
|
119 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6584f042b378d311dccea501/OrzvqQIhB9p-aMq2G6Lxd.png)
|
120 |
+
|
121 |
+
Select the model you just downloaded from the dropdown that appears to load it. You may need to play with configurations in the right-side menu, such as GPU offload if it doesn't fit entirely into VRAM.
|
122 |
+
|
123 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6584f042b378d311dccea501/TM4dO4DFP1xqZD1GWBqeI.png)
|
124 |
+
|
125 |
+
All that's left to do is to hit the "Start Server" button:
|
126 |
+
|
127 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6584f042b378d311dccea501/6TZvnX84rZKZ0TwVVLFnw.png)
|
128 |
+
|
129 |
+
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.
|
130 |
+
|
131 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6584f042b378d311dccea501/kD47WaH-tzpr4qaAm-pMn.png)
|
132 |
+
|
133 |
+
Example curl request to the API endpoint:
|
134 |
+
```shell
|
135 |
+
curl http://localhost:1234/v1/embeddings \
|
136 |
+
-H "Content-Type: application/json" \
|
137 |
+
-d '{
|
138 |
+
"input": "Your text string goes here",
|
139 |
+
"model": "model-identifier-here"
|
140 |
+
}'
|
141 |
+
```
|
142 |
+
|
143 |
+
For more information, see the LM Studio [text embedding documentation](https://lmstudio.ai/docs/text-embeddings).
|
144 |
+
|
145 |
+
|
146 |
+
## Acknowledgements
|
147 |
+
|
148 |
+
Thanks to the LM Studio team and everyone else working on open-source AI.
|
149 |
+
|
150 |
+
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).
|