Text Classification
Transformers
Safetensors
yield-weather-soil
crop-yield
multi-temporal
regression
yield-estimation
custom_code
Instructions to use ICICLE-AI/yield-estimation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ICICLE-AI/yield-estimation with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="ICICLE-AI/yield-estimation", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForSequenceClassification model = AutoModelForSequenceClassification.from_pretrained("ICICLE-AI/yield-estimation", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 978 Bytes
a8a9d46 | 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 | # processing_yield.py
import json
from transformers.processing_utils import ProcessorMixin
class YieldProcessor(ProcessorMixin):
attributes = []
valid_kwargs = []
def __init__(self, **kwargs):
super().__init__()
def __call__(self, inputs=None, **kwargs):
"""
Accept either:
1. the existing dictionary input, or
2. a JSON string containing that dictionary.
"""
if inputs is None:
inputs = kwargs
if isinstance(inputs, str):
try:
inputs = json.loads(inputs)
except json.JSONDecodeError as e:
raise ValueError(
"YieldProcessor expected a JSON string "
"representing the model input."
) from e
if not isinstance(inputs, dict):
raise ValueError(
"YieldProcessor expects a dictionary or JSON string."
)
return inputs |