Upload folder using huggingface_hub
Browse files- README.md +41 -0
- config.json +27 -0
- onnx/model.onnx +3 -0
- special_tokens_map.json +37 -0
- stopwords.txt +179 -0
- tokenizer.json +0 -0
- tokenizer_config.json +64 -0
- vocab.txt +0 -0
README.md
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
pipeline_tag: sentence-similarity
|
6 |
+
---
|
7 |
+
ONNX port of [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) adjusted to return attention weights.
|
8 |
+
|
9 |
+
This model is intended to be used for [BM42 searches](https://qdrant.tech/articles/bm42/).
|
10 |
+
|
11 |
+
|
12 |
+
### Usage
|
13 |
+
|
14 |
+
Here's an example of performing inference using the model with [FastEmbed](https://github.com/qdrant/fastembed).
|
15 |
+
|
16 |
+
> Note:
|
17 |
+
This model is supposed to be used with Qdrant. Vectors have to be configured with [Modifier.IDF](https://qdrant.tech/documentation/concepts/indexing/?q=modifier#idf-modifier).
|
18 |
+
|
19 |
+
```py
|
20 |
+
from fastembed import SparseTextEmbedding
|
21 |
+
|
22 |
+
documents = [
|
23 |
+
"You should stay, study and sprint.",
|
24 |
+
"History can only prepare us to be surprised yet again.",
|
25 |
+
]
|
26 |
+
|
27 |
+
model = SparseTextEmbedding(model_name="Qdrant/bm42-all-minilm-l6-v2-attentions")
|
28 |
+
embeddings = list(model.embed(documents))
|
29 |
+
|
30 |
+
# [
|
31 |
+
# SparseEmbedding(values=array([0.26399775, 0.24662513, 0.47077307]),
|
32 |
+
# indices=array([1881538586, 150760872, 1932363795])),
|
33 |
+
# SparseEmbedding(values=array(
|
34 |
+
# [0.38320042, 0.25453135, 0.18017513, 0.30432631, 0.1373556]),
|
35 |
+
# indices=array([
|
36 |
+
# 733618285, 1849833631, 1008800696, 2090661150,
|
37 |
+
# 1117393019
|
38 |
+
# ]))
|
39 |
+
# ]
|
40 |
+
|
41 |
+
```
|
config.json
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "sentence-transformers/all-MiniLM-L6-v2",
|
3 |
+
"architectures": [
|
4 |
+
"BertModel"
|
5 |
+
],
|
6 |
+
"attention_probs_dropout_prob": 0.1,
|
7 |
+
"classifier_dropout": null,
|
8 |
+
"gradient_checkpointing": false,
|
9 |
+
"hidden_act": "gelu",
|
10 |
+
"hidden_dropout_prob": 0.1,
|
11 |
+
"hidden_size": 384,
|
12 |
+
"initializer_range": 0.02,
|
13 |
+
"intermediate_size": 1536,
|
14 |
+
"layer_norm_eps": 1e-12,
|
15 |
+
"max_position_embeddings": 512,
|
16 |
+
"model_type": "bert",
|
17 |
+
"num_attention_heads": 12,
|
18 |
+
"num_hidden_layers": 6,
|
19 |
+
"output_attentions": true,
|
20 |
+
"pad_token_id": 0,
|
21 |
+
"position_embedding_type": "absolute",
|
22 |
+
"torch_dtype": "float32",
|
23 |
+
"transformers_version": "4.40.1",
|
24 |
+
"type_vocab_size": 2,
|
25 |
+
"use_cache": true,
|
26 |
+
"vocab_size": 30522
|
27 |
+
}
|
onnx/model.onnx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:368eb595d71c2c5087a200a719955a915ab788c65d487632a14de7a32613ee89
|
3 |
+
size 90985592
|
special_tokens_map.json
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cls_token": {
|
3 |
+
"content": "[CLS]",
|
4 |
+
"lstrip": false,
|
5 |
+
"normalized": false,
|
6 |
+
"rstrip": false,
|
7 |
+
"single_word": false
|
8 |
+
},
|
9 |
+
"mask_token": {
|
10 |
+
"content": "[MASK]",
|
11 |
+
"lstrip": false,
|
12 |
+
"normalized": false,
|
13 |
+
"rstrip": false,
|
14 |
+
"single_word": false
|
15 |
+
},
|
16 |
+
"pad_token": {
|
17 |
+
"content": "[PAD]",
|
18 |
+
"lstrip": false,
|
19 |
+
"normalized": false,
|
20 |
+
"rstrip": false,
|
21 |
+
"single_word": false
|
22 |
+
},
|
23 |
+
"sep_token": {
|
24 |
+
"content": "[SEP]",
|
25 |
+
"lstrip": false,
|
26 |
+
"normalized": false,
|
27 |
+
"rstrip": false,
|
28 |
+
"single_word": false
|
29 |
+
},
|
30 |
+
"unk_token": {
|
31 |
+
"content": "[UNK]",
|
32 |
+
"lstrip": false,
|
33 |
+
"normalized": false,
|
34 |
+
"rstrip": false,
|
35 |
+
"single_word": false
|
36 |
+
}
|
37 |
+
}
|
stopwords.txt
ADDED
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
i
|
2 |
+
me
|
3 |
+
my
|
4 |
+
myself
|
5 |
+
we
|
6 |
+
our
|
7 |
+
ours
|
8 |
+
ourselves
|
9 |
+
you
|
10 |
+
you're
|
11 |
+
you've
|
12 |
+
you'll
|
13 |
+
you'd
|
14 |
+
your
|
15 |
+
yours
|
16 |
+
yourself
|
17 |
+
yourselves
|
18 |
+
he
|
19 |
+
him
|
20 |
+
his
|
21 |
+
himself
|
22 |
+
she
|
23 |
+
she's
|
24 |
+
her
|
25 |
+
hers
|
26 |
+
herself
|
27 |
+
it
|
28 |
+
it's
|
29 |
+
its
|
30 |
+
itself
|
31 |
+
they
|
32 |
+
them
|
33 |
+
their
|
34 |
+
theirs
|
35 |
+
themselves
|
36 |
+
what
|
37 |
+
which
|
38 |
+
who
|
39 |
+
whom
|
40 |
+
this
|
41 |
+
that
|
42 |
+
that'll
|
43 |
+
these
|
44 |
+
those
|
45 |
+
am
|
46 |
+
is
|
47 |
+
are
|
48 |
+
was
|
49 |
+
were
|
50 |
+
be
|
51 |
+
been
|
52 |
+
being
|
53 |
+
have
|
54 |
+
has
|
55 |
+
had
|
56 |
+
having
|
57 |
+
do
|
58 |
+
does
|
59 |
+
did
|
60 |
+
doing
|
61 |
+
a
|
62 |
+
an
|
63 |
+
the
|
64 |
+
and
|
65 |
+
but
|
66 |
+
if
|
67 |
+
or
|
68 |
+
because
|
69 |
+
as
|
70 |
+
until
|
71 |
+
while
|
72 |
+
of
|
73 |
+
at
|
74 |
+
by
|
75 |
+
for
|
76 |
+
with
|
77 |
+
about
|
78 |
+
against
|
79 |
+
between
|
80 |
+
into
|
81 |
+
through
|
82 |
+
during
|
83 |
+
before
|
84 |
+
after
|
85 |
+
above
|
86 |
+
below
|
87 |
+
to
|
88 |
+
from
|
89 |
+
up
|
90 |
+
down
|
91 |
+
in
|
92 |
+
out
|
93 |
+
on
|
94 |
+
off
|
95 |
+
over
|
96 |
+
under
|
97 |
+
again
|
98 |
+
further
|
99 |
+
then
|
100 |
+
once
|
101 |
+
here
|
102 |
+
there
|
103 |
+
when
|
104 |
+
where
|
105 |
+
why
|
106 |
+
how
|
107 |
+
all
|
108 |
+
any
|
109 |
+
both
|
110 |
+
each
|
111 |
+
few
|
112 |
+
more
|
113 |
+
most
|
114 |
+
other
|
115 |
+
some
|
116 |
+
such
|
117 |
+
no
|
118 |
+
nor
|
119 |
+
not
|
120 |
+
only
|
121 |
+
own
|
122 |
+
same
|
123 |
+
so
|
124 |
+
than
|
125 |
+
too
|
126 |
+
very
|
127 |
+
s
|
128 |
+
t
|
129 |
+
can
|
130 |
+
will
|
131 |
+
just
|
132 |
+
don
|
133 |
+
don't
|
134 |
+
should
|
135 |
+
should've
|
136 |
+
now
|
137 |
+
d
|
138 |
+
ll
|
139 |
+
m
|
140 |
+
o
|
141 |
+
re
|
142 |
+
ve
|
143 |
+
y
|
144 |
+
ain
|
145 |
+
aren
|
146 |
+
aren't
|
147 |
+
couldn
|
148 |
+
couldn't
|
149 |
+
didn
|
150 |
+
didn't
|
151 |
+
doesn
|
152 |
+
doesn't
|
153 |
+
hadn
|
154 |
+
hadn't
|
155 |
+
hasn
|
156 |
+
hasn't
|
157 |
+
haven
|
158 |
+
haven't
|
159 |
+
isn
|
160 |
+
isn't
|
161 |
+
ma
|
162 |
+
mightn
|
163 |
+
mightn't
|
164 |
+
mustn
|
165 |
+
mustn't
|
166 |
+
needn
|
167 |
+
needn't
|
168 |
+
shan
|
169 |
+
shan't
|
170 |
+
shouldn
|
171 |
+
shouldn't
|
172 |
+
wasn
|
173 |
+
wasn't
|
174 |
+
weren
|
175 |
+
weren't
|
176 |
+
won
|
177 |
+
won't
|
178 |
+
wouldn
|
179 |
+
wouldn't
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"added_tokens_decoder": {
|
3 |
+
"0": {
|
4 |
+
"content": "[PAD]",
|
5 |
+
"lstrip": false,
|
6 |
+
"normalized": false,
|
7 |
+
"rstrip": false,
|
8 |
+
"single_word": false,
|
9 |
+
"special": true
|
10 |
+
},
|
11 |
+
"100": {
|
12 |
+
"content": "[UNK]",
|
13 |
+
"lstrip": false,
|
14 |
+
"normalized": false,
|
15 |
+
"rstrip": false,
|
16 |
+
"single_word": false,
|
17 |
+
"special": true
|
18 |
+
},
|
19 |
+
"101": {
|
20 |
+
"content": "[CLS]",
|
21 |
+
"lstrip": false,
|
22 |
+
"normalized": false,
|
23 |
+
"rstrip": false,
|
24 |
+
"single_word": false,
|
25 |
+
"special": true
|
26 |
+
},
|
27 |
+
"102": {
|
28 |
+
"content": "[SEP]",
|
29 |
+
"lstrip": false,
|
30 |
+
"normalized": false,
|
31 |
+
"rstrip": false,
|
32 |
+
"single_word": false,
|
33 |
+
"special": true
|
34 |
+
},
|
35 |
+
"103": {
|
36 |
+
"content": "[MASK]",
|
37 |
+
"lstrip": false,
|
38 |
+
"normalized": false,
|
39 |
+
"rstrip": false,
|
40 |
+
"single_word": false,
|
41 |
+
"special": true
|
42 |
+
}
|
43 |
+
},
|
44 |
+
"clean_up_tokenization_spaces": true,
|
45 |
+
"cls_token": "[CLS]",
|
46 |
+
"do_basic_tokenize": true,
|
47 |
+
"do_lower_case": true,
|
48 |
+
"mask_token": "[MASK]",
|
49 |
+
"max_length": 128,
|
50 |
+
"model_max_length": 512,
|
51 |
+
"never_split": null,
|
52 |
+
"pad_to_multiple_of": null,
|
53 |
+
"pad_token": "[PAD]",
|
54 |
+
"pad_token_type_id": 0,
|
55 |
+
"padding_side": "right",
|
56 |
+
"sep_token": "[SEP]",
|
57 |
+
"stride": 0,
|
58 |
+
"strip_accents": null,
|
59 |
+
"tokenize_chinese_chars": true,
|
60 |
+
"tokenizer_class": "BertTokenizer",
|
61 |
+
"truncation_side": "right",
|
62 |
+
"truncation_strategy": "longest_first",
|
63 |
+
"unk_token": "[UNK]"
|
64 |
+
}
|
vocab.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|