lang_id_io library
Loading a model from disk. Kept in its own library so that
package:lang_id/lang_id.dart stays usable on the web, where there is
no dart:io.
Classes
- DownloadProgress
- How far a download has got.
- FastTextClassifier
- A supervised fastText model: text in, one of its labels out.
- ModelArgs
- The hyper-parameters stored in the model header.
- ModelDownloader
- Fetches pretrained models and puts them in a directory of your choosing.
- ModelInfo
- Facts about a loaded model.
- Prediction
- A label and its probability.
Enums
- FastTextArchitecture
- The model architecture.
- FastTextLoss
- The loss function the model was trained with.
- PretrainedModel
- A pretrained language identification model published by Facebook.
Functions
-
loadModel(
String path) → Future< FastTextClassifier> -
Reads a model from a
.binor.ftzfile. -
loadModelSync(
String path) → FastTextClassifier - Synchronous variant of loadModel, for CLIs and tests.
-
loadOrDownloadModel(
PretrainedModel model, {required String directory, bool force = false, void onProgress(DownloadProgress progress)?, ModelDownloader? downloader}) → Future< FastTextClassifier> -
Loads
modelfromdirectory, downloading it first if it is not there.
Exceptions / Errors
- ModelDownloadException
- Thrown when a model cannot be fetched or what arrived is not a model.