ireneiele/agrimatnet-vegetation-forecasting
18
This model has been pushed to the Hub using the PyTorchModelHubMixin integration:
- Code: https://github.com/arco-group/ndvi-forecasting
- Paper: https://arxiv.org/abs/2602.17683
- Docs: See the usage examples below.
Model configuration
input_dim = 28quantiles = [0.1, 0.5, 0.9]d_model = 128num_layers = 8num_heads = 8dim_feedforward = 512dropout = 0.1
The model outputs a tensor with shape (batch_size, forecast_horizon, 3).
Input Contract
Do not reorder columns manually. The checkpoint was trained with the cache feature order exactly as produced by the repository pipeline.
Quick Start
Load from the Hub
Hugging Face repository id: ireneiele/agrimatnet-vegetation-forecasting
from agrimatnet.model_quantile import AgriMatNetQuantile
model = AgriMatNetQuantile.from_pretrained("ireneiele/agrimatnet-vegetation-forecasting")
model.eval()Load from a local snapshot
from agrimatnet.model_quantile import AgriMatNetQuantile
model = AgriMatNetQuantile.from_pretrained("./agrimatnet-hf")
model.eval()Manual instantiation + .pth checkpoint
Use this path if you are loading a training checkpoint produced by the repository scripts.
import torch
from agrimatnet.model_quantile import AgriMatNetQuantile
model = AgriMatNetQuantile(
input_dim=28,
quantiles=[0.1, 0.5, 0.9],
d_model=128,
num_layers=8,
num_heads=8,
dim_feedforward=512,
dropout=0.1,
)
checkpoint = torch.load("checkpoint_best.pth", map_location="cpu")
state_dict = checkpoint.get("model_state_dict", checkpoint)
model.load_state_dict(state_dict)
model.eval()Inference Contract
The forward pass expects a dictionary with the same structure produced by the dataset pipeline:
historyfuturehistory_maskfuture_maskhistory_pad_maskfuture_pad_maskfuture_target_positions
The feature order must match the training cache exactly. The historical target is kept in the last feature column.
End-to-End Example
import torch
from torch.utils.data import DataLoader
from agrimatnet.model_quantile import AgriMatNetQuantile
from agrimatnet.train_quantile_ablation import collate_variable
from dataset_builder.torch_dataset import CacheTimeSeriesDataset
dataset = CacheTimeSeriesDataset(
cache_dir="timeSeries/cache/<split>",
apply_scaling=True,
feature_engineering=True,
discretize_target=False,
)
loader = DataLoader(
dataset,
batch_size=4,
shuffle=False,
collate_fn=collate_variable,
)
model = AgriMatNetQuantile.from_pretrained("ireneiele/agrimatnet-vegetation-forecasting")
model.eval()
batch = next(iter(loader))
with torch.no_grad():
preds = model(batch)
print(preds.shape) # (B, T, 3)
print(dataset.feature_names)