spacemanidol Xenova HF staff commited on
Commit
f0ff6dc
1 Parent(s): 450627b

Upload ONNX weights + Transformers.js sample code (#2)

Browse files

- Upload ONNX weights (9e516c87c3f3ffcc035f58104788261cb7e01979)
- Update README.md (a26bf084e094b8e24fa09ea031416eebee559673)


Co-authored-by: Joshua <[email protected]>

.gitattributes CHANGED
@@ -34,3 +34,4 @@ saved_model/**/* 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
 
 
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
README.md CHANGED
@@ -9187,6 +9187,39 @@ Query: Where can I get the best tacos?
9187
  tensor(0.2797) Mexico City of Course!
9188
  tensor(0.1250) The Data Cloud!
9189
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9190
  ## Contact
9191
 
9192
 
 
9187
  tensor(0.2797) Mexico City of Course!
9188
  tensor(0.1250) The Data Cloud!
9189
  ```
9190
+
9191
+ ### Using Huggingface Transformers.js
9192
+
9193
+ If you haven't already, you can install the [Transformers.js](https://huggingface.co/docs/transformers.js) JavaScript library from [NPM](https://www.npmjs.com/package/@huggingface/transformers) using:
9194
+ ```bash
9195
+ npm i @huggingface/transformers
9196
+ ```
9197
+
9198
+ You can then use the model for retrieval, as follows:
9199
+
9200
+ ```js
9201
+ import { pipeline, dot } from '@huggingface/transformers';
9202
+
9203
+ // Create feature extraction pipeline
9204
+ const extractor = await pipeline('feature-extraction', 'Snowflake/snowflake-arctic-embed-m-v2.0', {
9205
+ dtype: 'q8',
9206
+ });
9207
+
9208
+ // Generate sentence embeddings
9209
+ const sentences = [
9210
+ 'query: what is snowflake?',
9211
+ 'The Data Cloud!',
9212
+ 'Mexico City of Course!',
9213
+ ]
9214
+ const output = await extractor(sentences, { normalize: true, pooling: 'cls' });
9215
+
9216
+ // Compute similarity scores
9217
+ const [source_embeddings, ...document_embeddings ] = output.tolist();
9218
+ const similarities = document_embeddings.map(x => dot(source_embeddings, x));
9219
+ console.log(similarities); // [0.24783534471401417, 0.05313122704326892]
9220
+ ```
9221
+
9222
+
9223
  ## Contact
9224
 
9225
 
onnx/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f74aa79745ccfb1e75daa7e8e6552a78402d4de193eb8ca67a931358d3e0a25e
3
+ size 702280
onnx/model.onnx_data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe7d75ff258fbda10a6bea63c5422df5579d625355b1aca69ba6923c0ba604a9
3
+ size 2266886160
onnx/model_bnb4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:50d4fae23d8d1d6876f28097110cab03a606662b0ea076d4904be8c2544c476a
3
+ size 1229495907
onnx/model_fp16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b6846bcf4c0d9e53fdfc70d6dc1bbe3bb40fd205ebb7f0365da5b07064ddccc
3
+ size 1134153607
onnx/model_int8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4b164a8bd09dd9806e035bdf3c34a2d81848b3db9642ba2e342b8367c00872d8
3
+ size 569721975
onnx/model_q4.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ec3ba7101ef4313f75d08608671e4428fa9383415ae13423b328059b20abb05b
3
+ size 1248369099
onnx/model_q4f16.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6a449f29654af60c7190c8681bb5f6fa426f191b61c28dd57e3aa289617e0e0c
3
+ size 700064306
onnx/model_quantized.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4b164a8bd09dd9806e035bdf3c34a2d81848b3db9642ba2e342b8367c00872d8
3
+ size 569721975
onnx/model_uint8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8712ea862fbbf1ba08fecfcfef4f9d01929e7326567672fb033b6c3755751e1a
3
+ size 569721975