Instructions to use FlowRank/mailSort with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FlowRank/mailSort with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="FlowRank/mailSort")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("FlowRank/mailSort", device_map="auto") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from FlowRank/mailSort: direct link, hf CLI and curl.
- Browser
- Download file 2.93 kB
-
https://huggingface.co/FlowRank/mailSort/resolve/main/README.md
- Command line
-
hf download hf://FlowRank/mailSort/README.md
-
curl -L -o README.md https://huggingface.co/FlowRank/mailSort/resolve/main/README.md
2.93 kB
| library_name: transformers | |
| pipeline_tag: text-classification | |
| tags: | |
| - text-classification | |
| language: | |
| - en | |
| datasets: | |
| - FlowRank/labeled_emails | |
| base_model: distilbert-base-uncased | |
| license: mit | |
| metrics: | |
| - accuracy | |
| model-index: | |
| - name: mailSort | |
| results: | |
| - task: | |
| type: text-classification | |
| dataset: | |
| name: FlowRank/labeled_emails | |
| type: FlowRank/labeled_emails | |
| metrics: | |
| - type: accuracy | |
| value: 0.9601 | |
| widget: | |
| - text: "Subject: Insurance claim\n\nBody: Hello, I need to update my policy urgently before the deadline." | |
| ## mailSort | |
| Classifieur d’e-mails **20 classes** (catégorie + urgence), basé sur DistilBERT. | |
| Entraîné sur [`FlowRank/labeled_emails`](https://huggingface.co/datasets/FlowRank/labeled_emails) (révision `main`, ~19,8k exemples). | |
| **Accuracy test : 96,01 %** (1 900 / 1 979). | |
| | Version | Labels | Révision dataset | Révision modèle | | |
| |---------|--------|------------------|-----------------| | |
| | **v2** (courante) | 20 | `main` ou `v2.0` | `main` ou `v2.0` | | |
| | v1 | 10 | `v1.0` | `v1.0` | | |
| ### Labels (v2) | |
| Chaque catégorie est déclinée en `_urgent` / `_not_urgent` : `family`, `finance`, `games`, `human resources`, `medical`, `pets`, `school`, `software engineering`, `sport`, `work/airbus`. | |
| ## Inférence | |
| ```python | |
| from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline | |
| tok = AutoTokenizer.from_pretrained("FlowRank/mailSort", subfolder="model") | |
| model = AutoModelForSequenceClassification.from_pretrained("FlowRank/mailSort", subfolder="model") | |
| clf = pipeline("text-classification", model=model, tokenizer=tok, truncation=True) | |
| text = "Subject: Insurance claim\n\nBody: I need to update my policy urgently." | |
| print(clf(text)) | |
| ``` | |
| ## Développement local | |
| Repo Python minimal pour entraîner, évaluer et publier. Le script principal est `mailsort.train`. | |
| Par défaut, le code charge la **dernière version du dataset** (`FlowRank/labeled_emails@main`). | |
| ### Installation | |
| ```bash | |
| uv sync | |
| ``` | |
| ### Entraîner + évaluer | |
| ```bash | |
| uv run python -m mailsort.train \ | |
| --model-name distilbert-base-uncased \ | |
| --hub-model-id FlowRank/mailSort \ | |
| --num-train-epochs 2 | |
| ``` | |
| Pour épingler une version précise du dataset : | |
| ```bash | |
| uv run python -m mailsort.train --dataset-revision v1.0 | |
| ``` | |
| ### Évaluer le modèle publié | |
| ```bash | |
| uv run python -m mailsort.eval --split test | |
| ``` | |
| Évalue par défaut `FlowRank/mailSort` (sous-dossier `model/`) sur `FlowRank/labeled_emails@main`. | |
| ### Publier via Git (README + `model/`) | |
| ```bash | |
| uv run python -m mailsort.prepare_model --outputs-dir outputs --model-dir model | |
| git add README.md model | |
| git commit -m "chore(model): update published artifacts" | |
| git push | |
| ``` | |
| Le push Hub automatique via `Trainer` nécessite `HF_TOKEN` : | |
| ```bash | |
| export HF_TOKEN="..." | |
| uv run python -m mailsort.train --hub-model-id FlowRank/mailSort | |
| ``` | |