Instructions to use Phazel/fa_floret_400k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- spaCy
How to use Phazel/fa_floret_400k with spaCy:
!pip install https://huggingface.co/Phazel/fa_floret_400k/resolve/main/fa_floret_400k-any-py3-none-any.whl # Using spacy.load(). import spacy nlp = spacy.load("fa_floret_400k") # Importing as module. import fa_floret_400k nlp = fa_floret_400k.load() - Notebooks
- Google Colab
- Kaggle
Add/refresh README.md
Browse files
README.md
CHANGED
|
@@ -1,19 +1,79 @@
|
|
| 1 |
---
|
| 2 |
-
tags:
|
| 3 |
-
- spacy
|
| 4 |
language:
|
| 5 |
- fa
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
---
|
| 7 |
-
Floret vectors for Persian: fastText-style subwords hashed into a fixed 50,000-row Bloom table (300 dimensions, `minn=maxn=5`, `hash_count=2`), trained on 400,000 Persian documents. Vectors-only package, no pipeline components — load with `spacy.load` or unpack and point `--paths.vectors` at it to train against.
|
| 8 |
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
| --- | --- |
|
| 11 |
-
|
|
| 12 |
-
|
|
| 13 |
-
|
|
| 14 |
-
|
|
| 15 |
-
|
|
| 16 |
-
|
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
| 2 |
language:
|
| 3 |
- fa
|
| 4 |
+
license: cc-by-sa-4.0
|
| 5 |
+
library_name: spacy
|
| 6 |
+
pipeline_tag: feature-extraction
|
| 7 |
+
tags:
|
| 8 |
+
- spacy
|
| 9 |
+
- feature-extraction
|
| 10 |
+
- floret
|
| 11 |
+
- word-embeddings
|
| 12 |
+
- persian
|
| 13 |
+
- farsi
|
| 14 |
---
|
|
|
|
| 15 |
|
| 16 |
+
# fa_floret_400k
|
| 17 |
+
|
| 18 |
+
Persian floret static vector table: 50,000 rows x 300 dimensions, `minn=maxn=5`,
|
| 19 |
+
`hash_count=2`, trained on 400,000 Persian documents. Vectors only, no pipeline components.
|
| 20 |
+
|
| 21 |
+
This is the table used by the `fa_dep_news_md` / `fa_core_news_md` / `fa_ent_news_md` tier.
|
| 22 |
+
Because floret hashes subwords rather than storing whole-word keys, there are no OOV tokens:
|
| 23 |
+
every string gets a vector, which is what makes it usable on Persian text where inconsistent
|
| 24 |
+
ZWNJ placement otherwise explodes the vocabulary.
|
| 25 |
+
|
| 26 |
+
## Install
|
| 27 |
+
|
| 28 |
+
```bash
|
| 29 |
+
pip install https://huggingface.co/Phazel/fa_floret_400k/resolve/main/fa_floret_400k-0.1.0-py3-none-any.whl
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
## Use
|
| 33 |
+
|
| 34 |
+
```python
|
| 35 |
+
import spacy
|
| 36 |
+
|
| 37 |
+
nlp = spacy.load("fa_floret_400k") # vectors only: nlp.pipe_names == []
|
| 38 |
+
print(nlp.vocab.vectors.shape) # (50000, 300)
|
| 39 |
+
print(nlp("کتابهای").vector.shape) # (300,)
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
To train a pipeline against this table, pass it to spaCy's `--paths.vectors` and set
|
| 43 |
+
`components.tok2vec.model.embed.include_static_vectors = true`:
|
| 44 |
+
|
| 45 |
+
```bash
|
| 46 |
+
python -m spacy train config.cfg --paths.vectors fa_floret_400k
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
## Vector table
|
| 50 |
+
|
| 51 |
+
| Property | Value |
|
| 52 |
| --- | --- |
|
| 53 |
+
| Rows | 50,000 |
|
| 54 |
+
| Dimensions | 300 |
|
| 55 |
+
| Mode | floret (subword, Bloom-hashed) |
|
| 56 |
+
| `minn` / `maxn` | 5 / 5 |
|
| 57 |
+
| `hash_count` | 2 |
|
| 58 |
+
| Training corpus | 400,000 Persian documents |
|
| 59 |
+
|
| 60 |
+
## Related
|
| 61 |
+
|
| 62 |
+
| Package | Rows | Corpus | Used by |
|
| 63 |
+
| --- | ---: | --- | --- |
|
| 64 |
+
| [`fa_floret_400k`](https://huggingface.co/Phazel/fa_floret_400k) | 50k | 400k Persian documents | `md` tier |
|
| 65 |
+
| [`fa_floret_full_wiki`](https://huggingface.co/Phazel/fa_floret_full_wiki) | 50k | full Persian Wikipedia dump | — |
|
| 66 |
+
| [`fa_floret_wiki_200k`](https://huggingface.co/Phazel/fa-floret-wiki-vectors) | 200k | full Persian Wikipedia dump, 5 epochs | `lg` tier |
|
| 67 |
+
|
| 68 |
+
Trained pipelines that consume these tables, plus the measured accuracy deltas each table
|
| 69 |
+
buys, are in [`spacy-persian`](https://github.com/Fazel94/spacy-persian) (`docs/MODELS.md`
|
| 70 |
+
§6-7).
|
| 71 |
+
|
| 72 |
+
## Sources and licence
|
| 73 |
+
|
| 74 |
+
| Source | Author | Licence |
|
| 75 |
+
| --- | --- | --- |
|
| 76 |
+
| [`fa_floret` static vectors, 50k rows x 300d, 400k Persian documents](https://github.com/Fazel94/spacy-persian) | Kiyarash Fazeli | CC BY-SA 4.0 |
|
| 77 |
+
|
| 78 |
+
Released under **CC BY-SA 4.0**, the same licence the `md` pipelines that embed this table
|
| 79 |
+
carry.
|