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
When forecast_config.use_continuous_quantile_head is enabled, quantiles can only be produced for horizons up to self.model.os (derived from output_quantile_len=1024 / output_patch_len=128, i.e. 8 output patches). A larger max_horizon with the continuous quantile head raises ValueError during compile().
Source
Thrown at src/timesfm/timesfm_2p5/timesfm_2p5_torch.py:416
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
def _compiled_decode(horizon, inputs, masks):
if horizon > fc.max_horizon:
raise ValueError(
f"Horizon must be less than the max horizon. {horizon} > {fc.max_horizon}."
)
inputs = (
torch.from_numpy(np.array(inputs)).to(self.model.device).to(torch.float32)
)
masks = torch.from_numpy(np.array(masks)).to(self.model.device).to(torch.bool)
batch_size = inputs.shape[0]
if fc.infer_is_positive:
is_positive = torch.all(inputs >= 0, dim=-1, keepdim=True)View on GitHub (pinned to 331c6d33cb)
Solutions
- Lower max_horizon to <= self.model.os (e.g. 1024) when use_continuous_quantile_head=True.
- Set use_continuous_quantile_head=False if horizons beyond os are required.
- Forecast iteratively: compile within the supported range and roll predictions forward.
- Check TimesFM_2p5_200M_Definition.output_quantile_len and output_patch_len to compute the valid horizon cap.
Example fix
// before fc = ForecastConfig(max_horizon=2048, use_continuous_quantile_head=True) # ValueError // after fc = ForecastConfig(max_horizon=1024, use_continuous_quantile_head=True) model.compile(fc)
Defensive patterns
Strategy: validation
Validate before calling
os_cap = 1024 // 128 # output_quantile_len / output_patch_len = 8
if fc.use_continuous_quantile_head and fc.max_horizon > os_cap * 128:
fc = dataclasses.replace(fc, max_horizon=os_cap * 128, use_continuous_quantile_head=False) Try / catch
try:
model.compile(fc)
except ValueError as e:
if "Continuous quantile head" in str(e):
fc = dataclasses.replace(fc, use_continuous_quantile_head=False)
model.compile(fc)
else:
raise Prevention
- Only enable use_continuous_quantile_head with max_horizon <= 1024 for the 2.5 200M model.
- Check the definition's output_quantile_len/output_patch_len to derive the cap.
- Iterate forecasts for longer horizons instead of raising max_horizon.
- Centralize ForecastConfig creation in one validated factory function.
When it happens
Trigger: model.compile(ForecastConfig(use_continuous_quantile_head=True, max_horizon=N)) where N exceeds self.model.os — beyond roughly 1024 forecast steps for the 2.5 200M model.
Common situations: Enabling continuous quantiles with a very long horizon (e.g. 2048) for long-range forecasting; mixing the quantile-head flag with a horizon tuned for the default quantile path.
Related errors
- Context + horizon must be less than the context limit. {fc.m
- Horizon must be less than the max horizon. {horizon} > {fc.m
- Activation: {config.activation} not supported.
- Output dims must be a multiple of 4: {config.output_dims} %
- Memory dimension ({self.in_features}) must be divisible by '
AI-assisted analysis of google-research/timesfm@331c6d33cb (2026-08-29).
Data as JSON: /api/errors/d052208b79f48181.
Report an issue: GitHub.