Food Re-ranker Model
This is a fine-tuned DistilBERT model trained for binary classification of food description pairs. The model determines whether two food descriptions refer to the same item, enabling accurate re-ranking of search results.
Model Details
Model Description
- Base Model: distilbert-base-uncased
- Model Type: distilbert
- Task: Binary classification (food description matching)
- Output: Binary classification scores (0 = different foods, 1 = same food)
Architecture
- Hidden Dimension: 768
- Number of Layers: 6
- Number of Attention Heads: 12
- Intermediate Size: 3072
- Maximum Position Embeddings: 512
- Vocabulary Size: 30522
Use Case
Designed for improving food search accuracy by re-ranking initial search results, this model:
- Takes pairs of food descriptions as input
- Determines if they refer to the same food item
- Enables more accurate matching of food descriptions
- Helps surface the most relevant matches in search results
Training Configuration
- Batch Size: 32
- Learning Rate: 5e-05
- Number of Epochs: 3
- Warmup Steps: 0
- Weight Decay: 0.0
- Dropout: 0.1
- Attention Dropout: 0.1
- Classification Dropout: 0.2
Example Usage
from transformers import DistilBertTokenizerFast, DistilBertForSequenceClassification
# Load model
tokenizer = DistilBertTokenizerFast.from_pretrained("jonny9f/food_reranker2")
model = DistilBertForSequenceClassification.from_pretrained("jonny9f/food_reranker2")
# Prepare input
query = "chicken breast"
candidate = "grilled chicken breast"
inputs = tokenizer(query, candidate, padding=True, truncation=True, return_tensors="pt")
# Get prediction
outputs = model(**inputs)
score = outputs.logits.softmax(dim=1)[0][1].item() # Score for positive class
- Downloads last month
- 29
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
๐
Ask for provider support