Instructions to use fastyBOOM/recipe-ner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fastyBOOM/recipe-ner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="fastyBOOM/recipe-ner")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("fastyBOOM/recipe-ner") model = AutoModelForTokenClassification.from_pretrained("fastyBOOM/recipe-ner", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Recipe NER
A compact BERT token-classification model trained from scratch on BIO-tagged English recipe ingredient lines. Its WordPiece tokenizer is trained on the same training split, so the repository is self-contained.
Entity labels
NAME: ingredient nameQTY: quantityUNIT: unit of measureCOMMENT: preparation/state commentRANGE_END: upper end of a rangeINDEX: rare source-dataset label
The source label OTHER is normalized to the standard outside label O.
Test metrics
The split is deterministic: 39,878 train / 4,985 validation / 4,985 test examples (seed 42).
| Metric | Value |
|---|---|
| Entity precision | 0.8715 |
| Entity recall | 0.8820 |
| Entity F1 | 0.8767 |
| Token accuracy | 0.8923 |
Usage
from transformers import pipeline
ner = pipeline(
"token-classification",
model="fastyBOOM/recipe-ner",
aggregation_strategy="simple",
)
recipe = '3 large eggs, lightly beaten'
entities = ner(recipe)
for entity in entities:
print(entity["entity_group"], entity["word"], entity["start"], entity["end"], entity["score"])
Example produced during the final smoke test:
[
{
"entity_group": "QTY",
"score": 0.997479,
"word": "3",
"start": 0,
"end": 1
},
{
"entity_group": "COMMENT",
"score": 0.949855,
"word": "large",
"start": 2,
"end": 7
},
{
"entity_group": "NAME",
"score": 0.937473,
"word": "eggs",
"start": 8,
"end": 12
},
{
"entity_group": "COMMENT",
"score": 0.945924,
"word": ", lightly beaten",
"start": 12,
"end": 28
}
]
The model accepts raw recipe text. start and end offsets can be used to
highlight each detected entity in the original input.
Reproducibility
recipe_ner_training.ipynb contains the commented workflow. The standalone
train_recipe_ner.py script exposes the same parameters for command-line runs.
The exact training settings and label mapping are stored in
training_config.json and label_schema.json.
Limitations
The training corpus is English and mostly contains short ingredient lines.
Results on Russian text, long cooking instructions, or unrelated domains are not
validated. The very rare INDEX and RANGE_END classes have limited support.
- Downloads last month
- -