whitphx HF Staff commited on
Commit
9561d1d
·
verified ·
1 Parent(s): 186760f

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: jinaai/jina-embeddings-v2-small-en
3
+ library_name: transformers.js
4
+ pipeline_tag: feature-extraction
5
+ ---
6
+
7
+ https://huggingface.co/jinaai/jina-embeddings-v2-small-en with ONNX weights to be compatible with Transformers.js.
8
+
9
+ ## Usage with 🤗 Transformers.js
10
+
11
+ ```js
12
+ // npm i @xenova/transformers
13
+ import { pipeline, cos_sim } from '@xenova/transformers';
14
+
15
+ // Create feature extraction pipeline
16
+ const extractor = await pipeline('feature-extraction', 'Xenova/jina-embeddings-v2-small-en',
17
+ { quantized: false } // Comment out this line to use the quantized version
18
+ );
19
+
20
+ // Generate embeddings
21
+ const output = await extractor(
22
+ ['How is the weather today?', 'What is the current weather like today?'],
23
+ { pooling: 'mean' }
24
+ );
25
+
26
+ // Compute cosine similarity
27
+ console.log(cos_sim(output[0].data, output[1].data)); // 0.9399812684139274 (unquantized) vs. 0.9341121503699659 (quantized)
28
+ ```
29
+
30
+ Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using [🤗 Optimum](https://huggingface.co/docs/optimum/index) and structuring your repo like this one (with ONNX weights located in a subfolder named `onnx`).
config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "jinaai/jina-embeddings-v2-small-en",
3
+ "architectures": [
4
+ "JinaBertForMaskedLM"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.0,
7
+ "auto_map": {
8
+ "AutoConfig": "jinaai/jina-bert-implementation--configuration_bert.JinaBertConfig",
9
+ "AutoModel": "jinaai/jina-bert-implementation--modeling_bert.JinaBertModel",
10
+ "AutoModelForMaskedLM": "jinaai/jina-bert-implementation--modeling_bert.JinaBertForMaskedLM",
11
+ "AutoModelForSequenceClassification": "jinaai/jina-bert-implementation--modeling_bert.JinaBertForSequenceClassification"
12
+ },
13
+ "classifier_dropout": null,
14
+ "emb_pooler": "mean",
15
+ "feed_forward_type": "geglu",
16
+ "gradient_checkpointing": false,
17
+ "hidden_act": "gelu",
18
+ "hidden_dropout_prob": 0.1,
19
+ "hidden_size": 512,
20
+ "initializer_range": 0.02,
21
+ "intermediate_size": 2048,
22
+ "layer_norm_eps": 1e-12,
23
+ "max_position_embeddings": 8192,
24
+ "model_max_length": 8192,
25
+ "model_type": "bert",
26
+ "num_attention_heads": 8,
27
+ "num_hidden_layers": 4,
28
+ "pad_token_id": 0,
29
+ "position_embedding_type": "alibi",
30
+ "transformers_version": "4.33.2",
31
+ "type_vocab_size": 2,
32
+ "use_cache": true,
33
+ "vocab_size": 30528
34
+ }
onnx/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8daf59cab0f24c7e0231a1e3ff9c348a97f6662e9a763dd4f15d2ca2f1614e05
3
+ size 129799236
onnx/model_fp16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a90449a40a0713a76bc4cbd05742dcf8381e45e781494f133fd79f328dad1d8
3
+ size 64973466
onnx/model_quantized.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:70eff78f8bf60e10edfeab16a87eaf63a7e4f658aea21b456097224427c0caef
3
+ size 32765276
quantize_config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "per_channel": true,
3
+ "reduce_range": true,
4
+ "per_model_config": {
5
+ "model": {
6
+ "op_types": [
7
+ "Mul",
8
+ "ReduceMean",
9
+ "Unsqueeze",
10
+ "MatMul",
11
+ "Gather",
12
+ "Concat",
13
+ "Add",
14
+ "Transpose",
15
+ "Softmax",
16
+ "Sqrt",
17
+ "Pow",
18
+ "Constant",
19
+ "Sub",
20
+ "Div",
21
+ "Cast",
22
+ "Reshape",
23
+ "Erf",
24
+ "Identity",
25
+ "Shape"
26
+ ],
27
+ "weight_type": "QInt8"
28
+ }
29
+ }
30
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "clean_up_tokenization_spaces": true,
3
+ "cls_token": "[CLS]",
4
+ "do_basic_tokenize": true,
5
+ "do_lower_case": true,
6
+ "mask_token": "[MASK]",
7
+ "model_max_length": 8192,
8
+ "never_split": null,
9
+ "pad_token": "[PAD]",
10
+ "sep_token": "[SEP]",
11
+ "strip_accents": null,
12
+ "tokenize_chinese_chars": true,
13
+ "tokenizer_class": "BertTokenizer",
14
+ "unk_token": "[UNK]"
15
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff