fonnx library
FONNX model APIs.
Native inference is implemented once in Dart FFI and backed by native code assets. Web model implementations remain selected by each model library's conditional import. On the web, each model loads its runtime files from FonnxWeb.runtimeUri at first use.
Classes
- FonnxWeb
- Browser-only configuration of the FONNX web runtime.
- FutoContextEmbeddings
-
ContextLM output tables, copied once from
get_embeddings.onnx. - FutoEncoderOutput
- Raw encoder outputs for one swipe.
- FutoSwipe
- English QWERTY swipe typing and word context from FUTO Swipe models.
- FutoSwipeBundle
- File locations of the converted FUTO Swipe compatibility unit.
- FutoSwipeCandidate
- A ranked swipe result.
- FutoSwipeEmissions
- Refined per-step log scores from the English decoder.
- FutoSwipeLayout
- Centers of the 26 English letter keys in letter-panel coordinates.
- FutoSwipeOnnxBackend
- Platform inference boundary. Implementations own their sessions.
- FutoSwipePoint
- One touch sample in letter-panel coordinates.
- FutoSwipeWord
- A word that swipe decoding may return.
- FutoWordScore
- A ContextLM word score.
- KeywordDetection
- KeywordPhrase
- KeywordSpotter
- KeywordSpotterBundle
- KeywordTokenSequence
- An exact decoder token sequence and the vocabulary that gives it meaning.
- KeywordTranscription
- Text and exact decoder output from pronunciation discovery.
- Kokoro
- English-only Kokoro. Phonemes, chunking and both model stages run on one long-lived worker: an isolate on native, a Web Worker on web.
- KokoroBundle
- Locations of verified artifacts: local paths on native, URLs on web. No model is downloaded by the engine.
- KokoroChunk
- KokoroChunkPolicy
- KokoroSentenceSplit
- KokoroTextInput
- Single-subscription streaming text input. Fragments concatenate verbatim.
- KokoroVoice
- KwsEncoderOutput
- KwsOnnxBackend
- Magika
- ModelFeatures
- NemoAsr
- Speech-to-text with a NeMo FastConformer or Parakeet model. The models detect the language; there is no language setting.
- NemoAsrBundle
- The ONNX files of a NemoAsrModel.
- Pyannote
- SenseVoice
- Speech-to-text with Alibaba's SenseVoice Small: Mandarin, Cantonese, English, Japanese and Korean. One model run and greedy CTC.
- SenseVoiceBundle
- The files of SenseVoice Small: the int8 sherpa-onnx export of FunAudioLLM/SenseVoiceSmall, and its tokens.
- Whisper
- English speech-to-text with Whisper.
- WhisperBundle
-
The two ONNX files of a Whisper model, in the layout of the
onnx-community/whisper-*exports: an encoder, and a merged decoder with a key/value cache.
Enums
- KokoroLanguage
- MagikaGroup
- MagikaTag
- MagikaType
- NemoAsrModel
-
The NeMo speech-to-text models that fonnx runs. Both are the int8 exports
of sherpa-onnx; see
example/assets/models/nemoAsr/README.md. - SenseVoiceLanguage
- The languages of SenseVoice Small, with their model IDs.
Extensions
-
Average
on Iterable<
Vector> - Similarity on Vector
Constants
- futoContextDimension → const int
- ContextLM state and embedding width.
- futoContextHashedTokenId → const int
- Token ID that selects the hashed-word path in ContextLM.
- futoContextLength → const int
- Words of preceding context consumed by ContextLM.
- futoContextVocabularySize → const int
- Rows in each ContextLM embedding table. Token ID 0 is padding.
- futoSwipeBlankIndex → const int
- Index of the CTC blank class in FutoSwipeEmissions.
- futoSwipeClassCount → const int
-
Refined decoder classes:
athroughz, then blank. - futoSwipeMaxKeys → const int
- Key slots reserved by the encoder. English QWERTY uses the first 26.
- futoSwipeTimeSteps → const int
- Encoder/decoder time steps per swipe.
- futoSwipeTraceSamples → const int
- Samples per coordinate after trace resampling.
- keywordSpotterTokenizerId → const String
- Identity of the exact token-ID-to-piece mapping used by the English model.
- keywordSpotterVocabularySize → const int
- nemoAsrMaxSamples → const int
- The longest audio that NemoAsr transcribes: 60 seconds.
- senseVoiceMaxSamples → const int
- The longest audio that SenseVoice transcribes: 60 seconds.
Functions
-
extractFeaturesFromBytes(
Uint8List content, {int paddingToken = 256, int begSize = 512, int midSize = 512, int endSize = 512}) → ModelFeatures -
getTypeFromResultVector(
Float32List resultVector) → Future< MagikaType> -
kokoroSplitMayChange(
String remainder, String added) → bool -
Whether
kokoroSplitSentences(remainder + added)can give a unit, whenremainderis the remainder of an earlier split withfinalInput: false. If false, the split gives no units, so a streaming caller can skip it. True can be a false alarm. -
kokoroSplitSentences(
String text, {bool finalInput = false, bool splitOnColon = true, int minCodepoints = 0, int openLimit = 500}) → KokoroSentenceSplit -
Splits
textinto units that end at sentence marks. -
validatedFutoCount(
int value, String name) → int - Shared argument checks for platform implementations.
-
validatedFutoLexicon(
Iterable< FutoSwipeWord> lexicon) → List<FutoSwipeWord> - Validates and snapshots a caller-owned lexicon at API entry.
-
validatedFutoTrace(
Iterable< FutoSwipePoint> trace) → List<FutoSwipePoint> - Validates and snapshots caller-owned trace data at API entry.
-
validatedFutoWords(
Iterable< String> words, String name) → List<String> - Snapshots caller-owned context words.
-
validatedKeywordPhraseSnapshot(
Iterable< KeywordPhrase> keywords) → List<KeywordPhrase> - Validates and snapshots caller-owned phrase configuration at API entry.