@teammates/recall 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/embeddings.js +10 -1
- package/package.json +1 -1
- package/src/embeddings.ts +9 -1
package/dist/embeddings.js
CHANGED
|
@@ -31,7 +31,16 @@ export class LocalEmbeddings {
|
|
|
31
31
|
async _getExtractor() {
|
|
32
32
|
if (!this._extractor) {
|
|
33
33
|
const { pipeline } = await import("@huggingface/transformers");
|
|
34
|
-
|
|
34
|
+
const origWarn = console.warn;
|
|
35
|
+
console.warn = () => { };
|
|
36
|
+
try {
|
|
37
|
+
this._extractor = await pipeline("feature-extraction", this._model, {
|
|
38
|
+
dtype: "fp32",
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
console.warn = origWarn;
|
|
43
|
+
}
|
|
35
44
|
}
|
|
36
45
|
return this._extractor;
|
|
37
46
|
}
|
package/package.json
CHANGED
package/src/embeddings.ts
CHANGED
|
@@ -41,7 +41,15 @@ export class LocalEmbeddings implements EmbeddingsModel {
|
|
|
41
41
|
private async _getExtractor(): Promise<any> {
|
|
42
42
|
if (!this._extractor) {
|
|
43
43
|
const { pipeline } = await import("@huggingface/transformers");
|
|
44
|
-
|
|
44
|
+
const origWarn = console.warn;
|
|
45
|
+
console.warn = () => {};
|
|
46
|
+
try {
|
|
47
|
+
this._extractor = await pipeline("feature-extraction", this._model, {
|
|
48
|
+
dtype: "fp32",
|
|
49
|
+
});
|
|
50
|
+
} finally {
|
|
51
|
+
console.warn = origWarn;
|
|
52
|
+
}
|
|
45
53
|
}
|
|
46
54
|
return this._extractor;
|
|
47
55
|
}
|