@soulcraft/brainy 2.7.3 → 2.7.4
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/CHANGELOG.md +9 -0
- package/dist/embeddings/lightweight-embedder.js +1 -1
- package/dist/embeddings/universal-memory-manager.js +1 -1
- package/dist/embeddings/worker-embedding.js +1 -1
- package/dist/utils/embedding.js +2 -2
- package/dist/utils/hybridModelManager.js +6 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,15 @@ All notable changes to Brainy will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.7.4] - 2025-08-29
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Use fp32 models consistently everywhere to ensure compatibility
|
|
12
|
+
- Changed default dtype from q8 to fp32 across all embedding implementations
|
|
13
|
+
- Ensures the exact same model (model.onnx) is used everywhere
|
|
14
|
+
- Prevents 404 errors when looking for quantized models that don't exist on CDN
|
|
15
|
+
- Maintains data compatibility across all Brainy instances
|
|
16
|
+
|
|
8
17
|
## [2.7.3] - 2025-08-29
|
|
9
18
|
|
|
10
19
|
### Fixed
|
|
@@ -97,7 +97,7 @@ export class LightweightEmbedder {
|
|
|
97
97
|
console.log('⚠️ Loading ONNX model for complex text...');
|
|
98
98
|
const { TransformerEmbedding } = await import('../utils/embedding.js');
|
|
99
99
|
this.onnxEmbedder = new TransformerEmbedding({
|
|
100
|
-
dtype: '
|
|
100
|
+
dtype: 'fp32',
|
|
101
101
|
verbose: false
|
|
102
102
|
});
|
|
103
103
|
await this.onnxEmbedder.init();
|
|
@@ -107,7 +107,7 @@ export class UniversalMemoryManager {
|
|
|
107
107
|
const { TransformerEmbedding } = await import('../utils/embedding.js');
|
|
108
108
|
this.embeddingFunction = new TransformerEmbedding({
|
|
109
109
|
verbose: false,
|
|
110
|
-
dtype: '
|
|
110
|
+
dtype: 'fp32',
|
|
111
111
|
localFilesOnly: process.env.BRAINY_ALLOW_REMOTE_MODELS !== 'true'
|
|
112
112
|
});
|
|
113
113
|
await this.embeddingFunction.init();
|
package/dist/utils/embedding.js
CHANGED
|
@@ -98,7 +98,7 @@ export class TransformerEmbedding {
|
|
|
98
98
|
verbose: this.verbose,
|
|
99
99
|
cacheDir: options.cacheDir || './models',
|
|
100
100
|
localFilesOnly: localFilesOnly,
|
|
101
|
-
dtype: options.dtype || '
|
|
101
|
+
dtype: options.dtype || 'fp32', // Use fp32 by default as quantized models aren't available on CDN
|
|
102
102
|
device: options.device || 'auto'
|
|
103
103
|
};
|
|
104
104
|
if (this.verbose) {
|
|
@@ -216,7 +216,7 @@ export class TransformerEmbedding {
|
|
|
216
216
|
const pipelineOptions = {
|
|
217
217
|
cache_dir: cacheDir,
|
|
218
218
|
local_files_only: isBrowser() ? false : this.options.localFilesOnly,
|
|
219
|
-
dtype: this.options.dtype || '
|
|
219
|
+
dtype: this.options.dtype || 'fp32', // Use fp32 model as quantized models aren't available on CDN
|
|
220
220
|
// CRITICAL: ONNX memory optimizations
|
|
221
221
|
session_options: {
|
|
222
222
|
enableCpuMemArena: false, // Disable pre-allocated memory arena
|
|
@@ -83,7 +83,7 @@ class HybridModelManager {
|
|
|
83
83
|
// Smart configuration based on environment
|
|
84
84
|
let options = {
|
|
85
85
|
verbose: !isTest && !isServerless,
|
|
86
|
-
dtype: '
|
|
86
|
+
dtype: 'fp32',
|
|
87
87
|
device: 'cpu'
|
|
88
88
|
};
|
|
89
89
|
// Environment-specific optimizations
|
|
@@ -91,7 +91,7 @@ class HybridModelManager {
|
|
|
91
91
|
options = {
|
|
92
92
|
...options,
|
|
93
93
|
localFilesOnly: forceLocalOnly || false, // Respect environment variable
|
|
94
|
-
dtype: '
|
|
94
|
+
dtype: 'fp32',
|
|
95
95
|
device: 'cpu',
|
|
96
96
|
verbose: false
|
|
97
97
|
};
|
|
@@ -100,7 +100,7 @@ class HybridModelManager {
|
|
|
100
100
|
options = {
|
|
101
101
|
...options,
|
|
102
102
|
localFilesOnly: forceLocalOnly || true, // Default true for serverless, but respect env
|
|
103
|
-
dtype: '
|
|
103
|
+
dtype: 'fp32',
|
|
104
104
|
device: 'cpu',
|
|
105
105
|
verbose: false
|
|
106
106
|
};
|
|
@@ -119,7 +119,7 @@ class HybridModelManager {
|
|
|
119
119
|
options = {
|
|
120
120
|
...options,
|
|
121
121
|
localFilesOnly: forceLocalOnly || false, // Respect environment variable for tests
|
|
122
|
-
dtype: '
|
|
122
|
+
dtype: 'fp32',
|
|
123
123
|
device: 'cpu',
|
|
124
124
|
verbose: false
|
|
125
125
|
};
|
|
@@ -128,7 +128,7 @@ class HybridModelManager {
|
|
|
128
128
|
options = {
|
|
129
129
|
...options,
|
|
130
130
|
localFilesOnly: forceLocalOnly || false, // Respect environment variable for default node
|
|
131
|
-
dtype: '
|
|
131
|
+
dtype: 'fp32',
|
|
132
132
|
device: 'auto',
|
|
133
133
|
verbose: true
|
|
134
134
|
};
|
|
@@ -168,7 +168,7 @@ class HybridModelManager {
|
|
|
168
168
|
// 2. If that fails, explicitly allow remote with verbose logging
|
|
169
169
|
{ ...options, localFilesOnly: false, verbose: true, source: 'fallback-verbose' },
|
|
170
170
|
// 3. Last resort: basic configuration
|
|
171
|
-
{ verbose: false, dtype: '
|
|
171
|
+
{ verbose: false, dtype: 'fp32', device: 'cpu', localFilesOnly: false, source: 'last-resort' }
|
|
172
172
|
];
|
|
173
173
|
let lastError = null;
|
|
174
174
|
for (const attemptOptions of attempts) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soulcraft/brainy",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.4",
|
|
4
4
|
"description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. 31 nouns × 40 verbs for infinite expressiveness.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|