This model has been pushed to the Hub using the PyTorchModelHubMixin integration:

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

Item Meaning How to get it
input_dim Number of feature columns expected by the model len(dataset.feature_names)
feature_names Exact feature order used by the cache dataset.feature_names
Historical target Stored in the last feature column Enforced by the cache pipeline
batch Dictionary 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

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:

  • 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

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)
Downloads last month
11
Safetensors
Model size
4.49M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for ireneiele/agrimatnet-vegetation-forecasting