Floret is an actively maintained Python library by Explosion (makers of spaCy) that provides compact, full-coverage word vectors using Bloom embeddings, extending the functionalities of fastText. It aims to reduce the size of vector tables significantly while maintaining performance, especially for morphologically rich languages and handling out-of-vocabulary words. The current version is 0.10.5, with a release cadence driven by Python version support and new features for its training functionalities.
pip install floretVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to train an unsupervised floret model, retrieve word vectors, and save the trained model. It highlights the importance of setting `mode="floret"` to leverage floret's unique Bloom embeddings and shows how to save both the full model and the compact floret vector table.
Always load `.bin` files with the same program (floret or fastText) that was used to train and save them. For floret-specific compact vectors, use `model.save_floret_vectors()` and load these with spaCy's `spacy init vectors` command.
When calling `floret.train_unsupervised()` or `floret.train_supervised()`, include the argument `mode='floret'`.
Ensure all training data is available for a single training run. There is no documented API for incremental training or loading existing embeddings as a starting point.
Be aware of these behavioral changes. For similarity, consider custom implementations or direct `floret` model queries if not using spaCy's built-in similarity (which usually relies on `Token.vector`).
If your goal is to obtain the compact Bloom-embedding vectors, use `model.save_floret_vectors("your_vectors.floret")`. This generates a `.floret` file that is significantly smaller than the `.bin` model file.Ensure you have activated the correct virtual environment if using one, then run `pip install floret`.
Consult the `floret` documentation or its GitHub repository for the correct API. Common methods include `get_word_vector`, `get_word_id`, `save_model`, `save_vectors`, and `save_floret_vectors`.
Upgrade your `floret` installation to the latest version: `pip install --upgrade floret`.
Write your training data to a text file (e.g., `data.txt`) and pass the path to this file to the training function, for example: `floret.train_unsupervised("data.txt", ...)`.