fix: use fp32 models consistently everywhere to ensure compatibility

Changed default dtype from q8 to fp32 across all embedding implementations:
- embedding.ts: Default dtype changed to fp32
- worker-embedding.ts: Use fp32 for consistency
- universal-memory-manager.ts: Use fp32 for consistency
- lightweight-embedder.ts: Use fp32 for consistency
- hybridModelManager.ts: Use fp32 for all configurations

This ensures we use the exact same model (model.onnx) everywhere,
maintaining data compatibility and avoiding 404 errors for quantized models.
This commit is contained in:
David Snelling 2025-08-29 10:23:23 -07:00
parent d0f2e3e939
commit 32e39ded53
11 changed files with 11 additions and 30742 deletions

View file

@ -128,7 +128,7 @@ export class TransformerEmbedding implements EmbeddingModel {
verbose: this.verbose,
cacheDir: options.cacheDir || './models',
localFilesOnly: localFilesOnly,
dtype: options.dtype || 'q8', // Changed from fp32 to q8 for 75% memory reduction
dtype: options.dtype || 'fp32', // Use fp32 by default as quantized models aren't available on CDN
device: options.device || 'auto'
}
@ -262,7 +262,7 @@ export class TransformerEmbedding implements EmbeddingModel {
const pipelineOptions: any = {
cache_dir: cacheDir,
local_files_only: isBrowser() ? false : this.options.localFilesOnly,
dtype: this.options.dtype || 'q8', // Use quantized model for lower memory
dtype: this.options.dtype || 'fp32', // Use fp32 model as quantized models aren't available on CDN
// CRITICAL: ONNX memory optimizations
session_options: {
enableCpuMemArena: false, // Disable pre-allocated memory arena