File size: 2,168 Bytes
5597a3d
 
 
 
 
 
 
f2ef4b6
5597a3d
 
 
 
 
 
 
aa50b8c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7287de0
 
aa50b8c
 
 
7287de0
aa50b8c
f08caea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
aa50b8c
 
 
 
7287de0
aa50b8c
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
license: apache-2.0
datasets:
  - empathyai/grocery-ner-dataset
language:
  - en
base_model:
  - gliner-community/gliner_large-v2.5
pipeline_tag: token-classification
library_name: gliner
tags:
  - ner
  - gliner
  - groceries
---

# Grocery Named Entity Recognition Model

A fine-tuned GLiNER model for identifying grocery items and food categories in text.

## Model Description

This model is fine-tuned on the grocery-ner-dataset to identify 14 different categories of grocery items including fruits, vegetables, dairy products, and more.

### Supported Entity Types

- Fruits Vegetables
- Lactose, Diary, Eggs, Cheese, Yoghurt
- Meat, Fish, Seafood
- Frozen, Prepared Meals
- Baking, Cooking
- Cereals, Grains, Canned, Seeds
- Breads
- Snacks, Pastries, Treats
- Frozen Desserts
- Hot Drinks, Chilled Drinks
- Alcoholic Drinks
- Spices, Sauces
- World Foods
- Dietary Restrictions, Health, Allergens, Lifestyle

## Training Details

- Base Model: gliner-community/gliner_medium-v2.5
- Training Data: empathyai/grocery-ner-dataset
- Batch Size: 8
- Learning Rate: 5e-6
- Weight Decay: 0.01
- Focal Loss Parameters: alpha=0.75, gamma=2
- Training Strategy: Linear learning rate with 10% warmup

## Usage Example

```python
!pip install gliner

from gliner import GLiNER

# Load model
model = GLiNER.from_pretrained("empathyai/gliner_large-v2.5-groceries")

labels = [
    "Fruits Vegetables",
    "Lactose, Diary, Eggs, Cheese, Yoghurt",
    "Meat, Fish, Seafood",
    "Frozen, Prepared Meals",
    "Baking, Cooking",
    "Cereals, Grains, Canned, Seeds",
    "Breads",
    "Snacks, Pastries, Treats",
    "Frozen Desserts",
    "Hot Drinks, Chilled Drinks",
    "Alcoholic Drinks",
    "Spices, Sauces",
    "World Foods",
    "Dietary Restrictions, Health, Allergens, Lifestyle"
  ]

# Example text
text = "I need to buy milk, bread, and fresh apples"

# Get predictions
predictions = model.predict_entities(text, labels=labels)
print(predictions)
```

## Limitations
- Optimized for English language text only
- Best performance on grocery shopping and food-related contexts
- May not recognize brand names or regional food items not present in training data