ONNX version of NbAiLab/nb-sbert-base
This repository contains ONNX-converted weights for NbAiLab/nb-sbert-base, compatible with Transformers.js.
It includes both:
- Quantized (int8): Faster, smaller (default).
- Full Precision (float32): Higher theoretical accuracy, larger file size.
Usage (Node.js)
First, install the library:
npm install @huggingface/transformers
Option 1: Use Quantized Model (Recommended)
This is the default behavior. It loads model_quantized.onnx (approx. 4x smaller).
import { pipeline } from '@huggingface/transformers';
const embedder = await pipeline(
'feature-extraction',
'lebchen/nb-sbert-base-onnx',
{ device: 'auto' } // Defaults to { quantized: true }
);
const output = await embedder("Dette er en test.", { pooling: 'mean', normalize: true });
Option 2: Use Full Precision Model
import { pipeline } from '@huggingface/transformers';
const embedder = await pipeline(
'feature-extraction',
'lebchen/nb-sbert-base-onnx',
{
device: 'auto',
quantized: false // Forces loading of model.onnx
}
);
Credits & License
The original model was developed by the National Library of Norway (AI Lab). Original repository: https://huggingface.co/NbAiLab/nb-sbert-base
This distribution is licensed under Apache 2.0.
- Downloads last month
- 26
Model tree for lebchen/nb-sbert-base-onnx
Base model
NbAiLab/nb-sbert-base