Dizex/FoodBase
Viewer • Updated • 800 • 170 • 2
How to use Dizex/FoodBaseBERT-NER with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("token-classification", model="Dizex/FoodBaseBERT-NER") # Load model directly
from transformers import AutoTokenizer, AutoModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("Dizex/FoodBaseBERT-NER")
model = AutoModelForTokenClassification.from_pretrained("Dizex/FoodBaseBERT-NER")FoodBaseBERT is a fine-tuned BERT model that is ready to use for Named Entity Recognition of Food entities. It has been trained to recognize one entity: food (FOOD).
Specifically, this model is a bert-base-cased model that was fine-tuned on the FoodBase NER dataset.
You can use this model with Transformers pipeline for NER.
from transformers import AutoTokenizer, AutoModelForTokenClassification
from transformers import pipeline
tokenizer = AutoTokenizer.from_pretrained("Dizex/FoodBaseBERT")
model = AutoModelForTokenClassification.from_pretrained("Dizex/FoodBaseBERT")
pipe = pipeline("ner", model=model, tokenizer=tokenizer)
example = "Today's meal: Fresh olive poké bowl topped with chia seeds. Very delicious!"
ner_entity_results = pipe(example)
print(ner_entity_results)