@cccarv82/freya 2.5.6 → 2.5.8
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/package.json
CHANGED
package/scripts/lib/DataLayer.js
CHANGED
package/scripts/lib/Embedder.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const { pipeline } = require('@xenova/transformers');
|
|
2
|
-
|
|
3
1
|
class Embedder {
|
|
4
2
|
constructor() {
|
|
5
3
|
this.modelName = 'Xenova/all-MiniLM-L6-v2';
|
|
@@ -10,14 +8,13 @@ class Embedder {
|
|
|
10
8
|
async init() {
|
|
11
9
|
if (this.extractorInfo) return;
|
|
12
10
|
if (!this.initPromise) {
|
|
13
|
-
this.initPromise =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
11
|
+
this.initPromise = (async () => {
|
|
12
|
+
const { pipeline } = await import('@xenova/transformers');
|
|
13
|
+
this.extractorInfo = await pipeline('feature-extraction', this.modelName, { quantized: true });
|
|
14
|
+
})().catch((err) => {
|
|
15
|
+
this.initPromise = null;
|
|
16
|
+
throw err;
|
|
17
|
+
});
|
|
21
18
|
}
|
|
22
19
|
await this.initPromise;
|
|
23
20
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const { pipeline } = require('@xenova/transformers');
|
|
2
|
-
|
|
3
1
|
class Embedder {
|
|
4
2
|
constructor() {
|
|
5
3
|
this.modelName = 'Xenova/all-MiniLM-L6-v2';
|
|
@@ -10,14 +8,13 @@ class Embedder {
|
|
|
10
8
|
async init() {
|
|
11
9
|
if (this.extractorInfo) return;
|
|
12
10
|
if (!this.initPromise) {
|
|
13
|
-
this.initPromise =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
11
|
+
this.initPromise = (async () => {
|
|
12
|
+
const { pipeline } = await import('@xenova/transformers');
|
|
13
|
+
this.extractorInfo = await pipeline('feature-extraction', this.modelName, { quantized: true });
|
|
14
|
+
})().catch((err) => {
|
|
15
|
+
this.initPromise = null;
|
|
16
|
+
throw err;
|
|
17
|
+
});
|
|
21
18
|
}
|
|
22
19
|
await this.initPromise;
|
|
23
20
|
}
|