google-research/timesfm · error · ValueError
Continuous quantile head is not supported for horizons > {se
Error message
Continuous quantile head is not supported for horizons > {self.model.os}. What it means
The continuous quantile head (used when `use_continuous_quantile_head=True`) can only emit quantiles up to the model's trained output horizon `self.model.os`. If the compiled `max_horizon` exceeds `os`, quantile outputs beyond that are undefined, so compile() raises ValueError. This is a model-capability boundary, not a generic config error.
Source
Thrown at src/timesfm/timesfm_2p5/timesfm_2p5_flax.py:539
new_context := math.ceil(fc.max_context / self.model.p) * self.model.p,
)
fc = dataclasses.replace(fc, max_context=new_context)
if fc.max_horizon % self.model.o != 0:
logging.info(
"When compiling, max horizon needs to be multiple of the output patch"
" size %d. Using max horizon = %d instead.",
self.model.o,
new_horizon := math.ceil(fc.max_horizon / self.model.o) * self.model.o,
)
fc = dataclasses.replace(fc, max_horizon=new_horizon)
if fc.max_context + fc.max_horizon > self.model.config.context_limit:
raise ValueError(
"Context + horizon must be less than the context limit."
f" {fc.max_context} + {fc.max_horizon} >"
f" {self.model.config.context_limit}."
)
if fc.use_continuous_quantile_head and (fc.max_horizon > self.model.os):
raise ValueError(
f"Continuous quantile head is not supported for horizons > {self.model.os}."
)
self.forecast_config = fc
self.model.compile(
context=self.forecast_config.max_context,
horizon=self.forecast_config.max_horizon,
per_core_batch_size=fc.per_core_batch_size,
)
self.per_core_batch_size = self.forecast_config.per_core_batch_size
self.num_devices = self.model.num_devices
self.global_batch_size = (
self.forecast_config.per_core_batch_size * self.model.num_devices
)
def compiled_decode_kernel(fc, horizon, inputs, masks):
inputs = jnp.array(inputs, dtype=jnp.float32)
masks = jnp.array(masks, dtype=jnp.bool)View on GitHub (pinned to 331c6d33cb)
Solutions
- Reduce `max_horizon` to at most `model.os` when using the continuous quantile head
- Set `use_continuous_quantile_head=False` if you need longer horizons (quantiles come from the standard quantiles output instead)
- Check `model.os` for your checkpoint before configuring
Example fix
// before model.compile(forecast_config=ForecastConfig(max_context=512, max_horizon=256, use_continuous_quantile_head=True)) // after model.compile(forecast_config=ForecastConfig(max_context=512, max_horizon=model.os, use_continuous_quantile_head=True))
Defensive patterns
Strategy: validation
Validate before calling
if fc.use_continuous_quantile_head and fc.max_horizon > model.os:
fc = dataclasses.replace(fc, max_horizon=model.os) # or disable the quantile head
model.compile(forecast_config=fc) Prevention
- Check model.os before enabling use_continuous_quantile_head
- Cap max_horizon at model.os whenever the quantile head is on
- Pin one config builder per model variant so capability limits are encoded once
When it happens
Trigger: Calling `model.compile()` with `ForecastConfig(use_continuous_quantile_head=True, max_horizon=os+1 or larger)`; requesting long-horizon continuous quantiles on a model variant whose quantile head supports only os steps.
Common situations: Enabling the quantile head to get smooth quantile forecasts but also needing a long horizon; copying a config that used a bigger model variant with a larger os; not rounding max_horizon down (note compile rounds max_horizon up to patch multiples before this check).
Related errors
- At least one of dynamic_numerical_covariates, dynamic_catego
- Forecast horizon length inferred from the dynamic covariates
- Context + horizon must be less than the context limit. {fc.m
- Horizon must be less than the max horizon. {horizon} > {fc.m
- train_dynamic_numerical_covariates and test_dynamic_numerica
AI-assisted analysis of google-research/timesfm@331c6d33cb (2026-08-29).
Data as JSON: /api/errors/b33cf73fb194fec5.
Report an issue: GitHub.