Update README.md
Browse files
README.md
CHANGED
|
@@ -46,9 +46,9 @@ import { VectorSearch } from 'https://cdn.jsdelivr.net/gh/jasonmayes/VectorSearc
|
|
| 46 |
|
| 47 |
// Embedding Model Configuration.
|
| 48 |
const MODEL_RUNTIME = 'litertjs'; // OR 'transformersjs'
|
| 49 |
-
const MODEL_URL = 'model/embeddinggemma-300M_seq1024_mixed-precision.tflite'; // OR '
|
| 50 |
const SEQ_LENGTH = 1024;
|
| 51 |
-
const TOKENIZER = '
|
| 52 |
const EMBEDDING_MODEL_CONFIG = {
|
| 53 |
runtime: MODEL_RUNTIME,
|
| 54 |
url: MODEL_URL,
|
|
@@ -155,7 +155,7 @@ This model is available to download from HuggingFace which you must do yourself
|
|
| 155 |
const MODEL_RUNTIME = 'litertjs';
|
| 156 |
const MODEL_URL = 'model/embeddinggemma-300M_seq1024_mixed-precision.tflite';
|
| 157 |
const SEQ_LENGTH = 1024;
|
| 158 |
-
const TOKENIZER = '
|
| 159 |
const EMBEDDING_MODEL_CONFIG = {
|
| 160 |
runtime: MODEL_RUNTIME,
|
| 161 |
url: MODEL_URL,
|
|
@@ -178,9 +178,9 @@ If you wish to use the all-MiniLM-L6-v2 embedding model instead for speed you ca
|
|
| 178 |
```javascript
|
| 179 |
// Embedding Model Configuration.
|
| 180 |
const MODEL_RUNTIME = 'transformersjs';
|
| 181 |
-
const MODEL_URL = '
|
| 182 |
const SEQ_LENGTH = 128;
|
| 183 |
-
const TOKENIZER = '
|
| 184 |
const EMBEDDING_MODEL_CONFIG = {
|
| 185 |
runtime: MODEL_RUNTIME,
|
| 186 |
url: MODEL_URL,
|
|
@@ -199,29 +199,7 @@ However please note this model is faster for a few reasons:
|
|
| 199 |
|
| 200 |
### LiteRT.js Wasm files (optional self host)
|
| 201 |
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
By default the library pulls in these Wasm files from JSDeliver CDN.
|
| 205 |
-
|
| 206 |
-
If your hosted version is not in the same location update the config object to specify the new Wasm folder location on your webserver as follows:
|
| 207 |
-
|
| 208 |
-
```javascript
|
| 209 |
-
// Embedding Model Configuration.
|
| 210 |
-
const MODEL_RUNTIME = 'litertjs';
|
| 211 |
-
const MODEL_URL = 'model/embeddinggemma-300M_seq1024_mixed-precision.tflite';
|
| 212 |
-
const SEQ_LENGTH = 1024;
|
| 213 |
-
const TOKENIZER = 'onnx-community/embeddinggemma-300m-ONNX';
|
| 214 |
-
const EMBEDDING_MODEL_CONFIG = {
|
| 215 |
-
runtime: MODEL_RUNTIME,
|
| 216 |
-
litertjsWasmUrl: '/wasm', // Specify your path to your custom hosted Wasm files here!
|
| 217 |
-
url: MODEL_URL,
|
| 218 |
-
sequenceLength: SEQ_LENGTH,
|
| 219 |
-
tokenizer: TOKENIZER
|
| 220 |
-
};
|
| 221 |
-
|
| 222 |
-
// Instantiate VectorSearch Master Class.
|
| 223 |
-
const VECTOR_SEARCH = new VectorSearch(EMBEDDING_MODEL_CONFIG);
|
| 224 |
-
```
|
| 225 |
|
| 226 |
Note when you call load you can also optionally specify a HTML element to render loading status updates to like this:
|
| 227 |
|
|
|
|
| 46 |
|
| 47 |
// Embedding Model Configuration.
|
| 48 |
const MODEL_RUNTIME = 'litertjs'; // OR 'transformersjs'
|
| 49 |
+
const MODEL_URL = 'model/embeddinggemma-300M_seq1024_mixed-precision.tflite'; // OR 'huggingworld/all-MiniLM-L6-v2' if transformersjs runtime.
|
| 50 |
const SEQ_LENGTH = 1024;
|
| 51 |
+
const TOKENIZER = 'huggingworld/embeddinggemma-300m-ONNX';
|
| 52 |
const EMBEDDING_MODEL_CONFIG = {
|
| 53 |
runtime: MODEL_RUNTIME,
|
| 54 |
url: MODEL_URL,
|
|
|
|
| 155 |
const MODEL_RUNTIME = 'litertjs';
|
| 156 |
const MODEL_URL = 'model/embeddinggemma-300M_seq1024_mixed-precision.tflite';
|
| 157 |
const SEQ_LENGTH = 1024;
|
| 158 |
+
const TOKENIZER = 'huggingworld/embeddinggemma-300m-ONNX';
|
| 159 |
const EMBEDDING_MODEL_CONFIG = {
|
| 160 |
runtime: MODEL_RUNTIME,
|
| 161 |
url: MODEL_URL,
|
|
|
|
| 178 |
```javascript
|
| 179 |
// Embedding Model Configuration.
|
| 180 |
const MODEL_RUNTIME = 'transformersjs';
|
| 181 |
+
const MODEL_URL = 'huggingworld/all-MiniLM-L6-v2';
|
| 182 |
const SEQ_LENGTH = 128;
|
| 183 |
+
const TOKENIZER = 'huggingworld/embeddinggemma-300m-ONNX';
|
| 184 |
const EMBEDDING_MODEL_CONFIG = {
|
| 185 |
runtime: MODEL_RUNTIME,
|
| 186 |
url: MODEL_URL,
|
|
|
|
| 199 |
|
| 200 |
### LiteRT.js Wasm files (optional self host)
|
| 201 |
|
| 202 |
+
Clone the repo of the space, git clone --depth 1 https://huggingface.co/spaces/huggingworld/vectorsearch-turbo-webgpu, all assets have been included.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
|
| 204 |
Note when you call load you can also optionally specify a HTML element to render loading status updates to like this:
|
| 205 |
|