Skip to content

Commit 1b211f8

Browse files
authored
v1.1.1 updates
1 parent 78470aa commit 1b211f8

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,20 @@ This model is available to download from HuggingFace which you must do yourself
127127
[Download it yourself from HuggingFace](https://huggingface.co/litert-community/embeddinggemma-300m/resolve/main/embeddinggemma-300M_seq1024_mixed-precision.tflite?download=true) so any applicable T&C accepted. You can then place this downloaded model into the demo/model folder. If you place it somewhere else update the code in script.js accordingly:
128128

129129
```javascript
130+
// Embedding Model Configuration.
131+
const MODEL_RUNTIME = 'litertjs';
130132
const MODEL_URL = 'model/embeddinggemma-300M_seq1024_mixed-precision.tflite';
133+
const SEQ_LENGTH = 1024;
134+
const TOKENIZER = 'onnx-community/embeddinggemma-300m-ONNX';
135+
const EMBEDDING_MODEL_CONFIG = {
136+
runtime: MODEL_RUNTIME,
137+
url: MODEL_URL,
138+
sequenceLength: SEQ_LENGTH,
139+
tokenizer: TOKENIZER
140+
};
141+
142+
// Instantiate VectorSearch Master Class.
143+
const VECTOR_SEARCH = new VectorSearch(EMBEDDING_MODEL_CONFIG);
131144
```
132145

133146
For more details [see the model card page on HuggingFace](https://huggingface.co/litert-community/embeddinggemma-300m).
@@ -142,15 +155,17 @@ If you wish to use the all-MiniLM-L6-v2 embedding model instead for speed you ca
142155
// Embedding Model Configuration.
143156
const MODEL_RUNTIME = 'transformersjs';
144157
const MODEL_URL = 'Xenova/all-MiniLM-L6-v2';
145-
const SEQ_LENGTH = 1024;
158+
const SEQ_LENGTH = 128;
146159
const TOKENIZER = 'onnx-community/embeddinggemma-300m-ONNX';
147160
const EMBEDDING_MODEL_CONFIG = {
148161
runtime: MODEL_RUNTIME,
149-
litertjsWasmUrl: 'https://assets.codepen.io/48236/',
150162
url: MODEL_URL,
151163
sequenceLength: SEQ_LENGTH,
152164
tokenizer: TOKENIZER
153165
};
166+
167+
// Instantiate VectorSearch Master Class.
168+
const VECTOR_SEARCH = new VectorSearch(EMBEDDING_MODEL_CONFIG);
154169
```
155170

156171
However please note this model is faster for a few reasons:
@@ -167,9 +182,14 @@ By default the library pulls in these Wasm files from JSDeliver CDN.
167182
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:
168183

169184
```javascript
185+
// Embedding Model Configuration.
186+
const MODEL_RUNTIME = 'litertjs';
187+
const MODEL_URL = 'model/embeddinggemma-300M_seq1024_mixed-precision.tflite';
188+
const SEQ_LENGTH = 1024;
189+
const TOKENIZER = 'onnx-community/embeddinggemma-300m-ONNX';
170190
const EMBEDDING_MODEL_CONFIG = {
171191
runtime: MODEL_RUNTIME,
172-
litertjsWasmUrl: 'YOUR Wasm Files location here!',
192+
litertjsWasmUrl: '/wasm', // Specify your path to your custom hosted Wasm files here!
173193
url: MODEL_URL,
174194
sequenceLength: SEQ_LENGTH,
175195
tokenizer: TOKENIZER

0 commit comments

Comments
 (0)