CoolFace
Modelpublic

ireneiele/agrimatnet-vegetation-forecasting

sourceHugging Facemitupdated 2mo agoView on Hugging Face
1likes8downloads
Model Card

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 = 28
  • —quantiles = [0.1, 0.5, 0.9]
  • —d_model = 128
  • —num_layers = 8
  • —num_heads = 8
  • —dim_feedforward = 512
  • —dropout = 0.1

The model outputs a tensor with shape (batch_size, forecast_horizon, 3).

Input Contract

ItemMeaningHow to get it
input_dimNumber of feature columns expected by the modellen(dataset.feature_names)
feature_namesExact feature order used by the cachedataset.feature_names
Historical targetStored in the last feature columnEnforced by the cache pipeline
batchDictionary passed to forward()collate_variable(...) from the training script

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

python
from agrimatnet.model_quantile import AgriMatNetQuantile

model = AgriMatNetQuantile.from_pretrained("ireneiele/agrimatnet-vegetation-forecasting")
model.eval()

Load from a local snapshot

python
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.

python
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:

  • —history
  • —future
  • —history_mask
  • —future_mask
  • —history_pad_mask
  • —future_pad_mask
  • —future_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

python
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)