Feature Extraction
Transformers
Safetensors
leaf
food
environment
NLP
Eco-Score
products
multilingual
BERT
classification
Open Food Facts
climate
custom_code
Instructions to use baskra/leaf-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use baskra/leaf-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="baskra/leaf-base", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("baskra/leaf-base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
| library_name: transformers | |
| tags: | |
| - food | |
| - environment | |
| - NLP | |
| - Eco-Score | |
| - products | |
| - multilingual | |
| - BERT | |
| - classification | |
| - Open Food Facts | |
| - climate | |
| license: mit | |
| datasets: | |
| - baskra/LEAF | |
| # LEAF: Predicting the Environmental Impact of Food Products based on their Name | |
| The `leaf-base` model is | |
| a [`distiluse-base-multilingual-cased-v2`](https://huggingface.co/sentence-transformers/distiluse-base-multilingual-cased-v2) | |
| model fine-tuned on the [LEAF dataset](https://huggingface.co/datasets/baskra/LEAF). | |
| To load the model, use the following code: | |
| ```python | |
| from transformers import AutoTokenizer, AutoModel | |
| tokenizer = AutoTokenizer.from_pretrained("baskra/leaf-base") | |
| model = AutoModel.from_pretrained("baskra/leaf-base", trust_remote_code=True) | |
| model(**tokenizer("Nutella", return_tensors="pt")) | |
| # {'logits': tensor([[-11.9081, ...]]), 'class_idx': tensor([1553]), 'ef_score': tensor([0.0129]), 'class': ['Chocolate spread with hazelnuts']} | |
| ``` | |
| ## Citation | |
| When using this model, please consider citing it as follows: | |
| **BibTeX:** | |
| ```bibtex | |
| @inproceedings{krahmer-2024-leaf, | |
| title = "{LEAF}: Predicting the Environmental Impact of Food Products based on their Name", | |
| author = "Krahmer, Bas", | |
| editor = "Stammbach, Dominik and | |
| Ni, Jingwei and | |
| Schimanski, Tobias and | |
| Dutia, Kalyan and | |
| Singh, Alok and | |
| Bingler, Julia and | |
| Christiaen, Christophe and | |
| Kushwaha, Neetu and | |
| Muccione, Veruska and | |
| A. Vaghefi, Saeid and | |
| Leippold, Markus", | |
| booktitle = "Proceedings of the 1st Workshop on Natural Language Processing Meets Climate Change (ClimateNLP 2024)", | |
| month = aug, | |
| year = "2024", | |
| address = "Bangkok, Thailand", | |
| publisher = "Association for Computational Linguistics", | |
| url = "https://aclanthology.org/2024.climatenlp-1.10", | |
| pages = "133--142", | |
| abstract = "Although food consumption represents a sub- stantial global source of greenhouse gas emis- sions, assessing the environmental impact of off-the-shelf products remains challenging. Currently, this information is often unavailable, hindering informed consumer decisions when grocery shopping. The present work introduces a new set of models called LEAF, which stands for Linguistic Environmental Analysis of Food Products. LEAF models predict the life-cycle environmental impact of food products based on their name. It is shown that LEAF models can accurately predict the environmental im- pact based on just the product name in a multi- lingual setting, greatly outperforming zero-shot classification methods. Models of varying sizes and capabilities are released, along with the code and dataset to fully reproduce the study.", | |
| } | |
| ``` | |