run_chronos2_benchmark.py fails on macOS with default settings (STATIC checkpoint + BATCH_SIZE=16)

Open
#1,181 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start with examples/benchmarks/liander2024/run_chronos2_benchmark.py and trace how its BATCH_SIZE reaches FoundationModelBacktestForecaster.from_workflow and Chronos2Forecaster.predict_batch. Check how the selected checkpoint variant and its static_shapes metadata affect the batch passed to ONNX Runtime. Done means the unchanged macOS benchmark runs with the default static checkpoint, or fails early with a clear explanation and compatible setting.

Written by the indexing model from the issue text.

Description

Describe the bug and its impact

On macOS, CheckpointVariant.recommended() returns STATIC. The static Chronos-2 checkpoint (chronos-2_static.onnx, metadata static_shapes: true, max_covariates: 3) has a frozen batch axis: one forecast window = 1 target row + 3 covariate rows = 4 rows. The Liander 2024 Chronos-2 benchmark example sets BATCH_SIZE = 16, so the first batched backend call sends 64 rows and ONNX Runtime rejects it. The example therefore fails out of the box on macOS.

Affected package(s)

  • openstef-core
  • openstef-models
  • openstef-beam
  • openstef-foundation-models
  • openstef-meta
  • examples / deployment
  • docs
  • not sure

Steps / code to reproduce

Run examples/benchmarks/liander2024/run_chronos2_benchmark.py unchanged on macOS (Apple silicon), with openstef-foundation-models[cpu]==4.7.0.

Expected behavior

The benchmark runs: either the batch size is compatible with the selected checkpoint variant, or batching is disabled/adapted for static-shape checkpoints.

Actual behavior

  File ".../openstef_foundation_models/models/forecasting/chronos2_forecaster.py", line 120, in predict_batch
    results.extend(self._forecast(data))
  File ".../openstef_foundation_models/models/forecasting/chronos2_forecaster.py", line 137, in _forecast
    outputs = self.backend.run(inputs)
  File ".../openstef_foundation_models/inference/onnx_backend.py", line 163, in run
    results = self._session.run(output_names, dict(inputs))
  File ".../onnxruntime/capi/onnxruntime_inference_collection.py", line 395, in run
    return self._sess.run(output_names, input_feed, run_options)
onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Got invalid dimensions for input: group_ids for the following indices
 index: 0 Got: 64 Expected: 4
 Please fix either the inputs/outputs or the model.

Environment

openstef-foundation-models: 4.7.0
openstef-beam: 4.7.0
openstef-models: 4.7.0
onnxruntime: 1.31.1
Python: 3.12
OS: macOS 26.5.1 (Apple M5)

Additional context

Possible fixes:

  • in FoundationModelBacktestForecaster.from_workflow (or the backtest adapter), cap batch_size to 1 when the backend metadata reports static_shapes=True;
  • or raise a clear error early, similar to the existing max_covariates check in Chronos2Forecaster._build_group_matrix;
  • or, in the example, choose BATCH_SIZE = 1 when the selected variant is STATIC.

Workaround: Chronos2.BASE.checkpoint(CheckpointVariant.DYNAMIC); with it the example runs, and results are identical for BATCH_SIZE = 1 and 16.

Would you be interested in submitting a fix?

  • I'd be interested in opening a PR for this once triaged
Dominant language
Python
Stars
169
Forks
59
Avg merge
4d 15h
Merged PRs (30d)
8

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenSTEF/openstef

All issues in OpenSTEF/openstef

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.