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)# pip install -U transformers accelerate # 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
Download configuration_leaf.py from baskra/leaf-base: direct link, hf CLI and curl.
- Browser
- Download file 462 Bytes
-
https://huggingface.co/baskra/leaf-base/resolve/main/configuration_leaf.py
- Command line
-
hf download hf://baskra/leaf-base/configuration_leaf.py
-
curl -L -o configuration_leaf.py https://huggingface.co/baskra/leaf-base/resolve/main/configuration_leaf.py
462 Bytes
| from typing import Literal | |
| from transformers import PretrainedConfig | |
| class LeafConfig(PretrainedConfig): | |
| model_type = "leaf" | |
| def __init__( | |
| self, | |
| num_classes: int = 2097, | |
| model_name: str = Literal["BAAI/bge-m3", "sentence-transformers/distiluse-base-multilingual-cased-v2"], | |
| **kwargs, | |
| ): | |
| self.num_classes = num_classes | |
| self.model_name = model_name | |
| super().__init__(**kwargs) | |