**feat(models): add pre-bundled Universal Sentence Encoder for offline use**
- Introduced `@soulcraft/brainy-models` package with pre-bundled TensorFlow models for enhanced offline reliability. - Added `index.d.ts` and `index.js` allowing offline embedding workflows with the Universal Sentence Encoder model. - Included utility scripts for model compression, size retrieval, and availability checks. - Added `metadata.json` and `model.json` defining the Universal Sentence Encoder configuration with offline bundling. - Ensured comprehensive model documentation, error handling, and robust logging for seamless integration. - Supported optional model quantization placeholders for future TensorFlow.js enhancements. **Purpose**: Enable fully offline-ready embedding workflows via pre-bundled Universal Sentence Encoder models, ensuring maximum reliability and air-gapped environment compatibility.
This commit is contained in:
parent
55862609c3
commit
e9a4492e3b
16 changed files with 7678 additions and 52 deletions
28
brainy-models-package/reproduce-error.js
Normal file
28
brainy-models-package/reproduce-error.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Reproduction script for the TensorFlow.js isNullOrUndefined error
|
||||
*/
|
||||
|
||||
import * as tf from '@tensorflow/tfjs-node'
|
||||
import * as use from '@tensorflow-models/universal-sentence-encoder'
|
||||
|
||||
console.log('🔍 Loading Universal Sentence Encoder model...')
|
||||
|
||||
try {
|
||||
const model = await use.load()
|
||||
console.log('✅ Model loaded successfully')
|
||||
|
||||
console.log('🧪 Testing model functionality...')
|
||||
const testEmbedding = await model.embed(['Hello world'])
|
||||
const testArray = await testEmbedding.array()
|
||||
console.log(
|
||||
`✅ Model test passed - embedding dimensions: ${testArray[0].length}`
|
||||
)
|
||||
testEmbedding.dispose()
|
||||
model.dispose()
|
||||
} catch (error) {
|
||||
console.error('❌ Error:', error)
|
||||
console.error('Stack trace:', error.stack)
|
||||
process.exit(1)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue