autogluon.timeseries 1.3.2b20250629__tar.gz → 1.3.2b20250630__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/PKG-INFO +1 -1
  2. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/chronos/model.py +35 -10
  3. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/chronos/pipeline/chronos_bolt.py +37 -22
  4. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/version.py +1 -1
  5. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon.timeseries.egg-info/PKG-INFO +1 -1
  6. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon.timeseries.egg-info/requires.txt +4 -4
  7. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/setup.cfg +0 -0
  8. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/setup.py +0 -0
  9. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/__init__.py +0 -0
  10. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/configs/__init__.py +0 -0
  11. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/configs/presets_configs.py +0 -0
  12. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/dataset/__init__.py +0 -0
  13. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/dataset/ts_dataframe.py +0 -0
  14. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/evaluator.py +0 -0
  15. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/learner.py +0 -0
  16. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/metrics/__init__.py +0 -0
  17. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/metrics/abstract.py +0 -0
  18. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/metrics/point.py +0 -0
  19. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/metrics/quantile.py +0 -0
  20. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/metrics/utils.py +0 -0
  21. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/__init__.py +0 -0
  22. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/abstract/__init__.py +0 -0
  23. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/abstract/abstract_timeseries_model.py +0 -0
  24. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/abstract/model_trial.py +0 -0
  25. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/abstract/tunable.py +0 -0
  26. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/autogluon_tabular/__init__.py +0 -0
  27. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/autogluon_tabular/mlforecast.py +0 -0
  28. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/autogluon_tabular/transforms.py +0 -0
  29. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/autogluon_tabular/utils.py +0 -0
  30. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/chronos/__init__.py +0 -0
  31. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/chronos/pipeline/__init__.py +0 -0
  32. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/chronos/pipeline/base.py +0 -0
  33. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/chronos/pipeline/chronos.py +0 -0
  34. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/chronos/pipeline/utils.py +0 -0
  35. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/ensemble/__init__.py +0 -0
  36. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/ensemble/abstract.py +0 -0
  37. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/ensemble/basic.py +0 -0
  38. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/ensemble/greedy.py +0 -0
  39. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/gluonts/__init__.py +0 -0
  40. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/gluonts/abstract.py +0 -0
  41. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/gluonts/dataset.py +0 -0
  42. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/gluonts/models.py +0 -0
  43. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/local/__init__.py +0 -0
  44. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/local/abstract_local_model.py +0 -0
  45. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/local/naive.py +0 -0
  46. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/local/npts.py +0 -0
  47. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/local/statsforecast.py +0 -0
  48. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/multi_window/__init__.py +0 -0
  49. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/multi_window/multi_window_model.py +0 -0
  50. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/models/presets.py +0 -0
  51. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/predictor.py +0 -0
  52. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/regressor.py +0 -0
  53. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/splitter.py +0 -0
  54. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/trainer.py +0 -0
  55. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/transforms/__init__.py +0 -0
  56. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/transforms/covariate_scaler.py +0 -0
  57. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/transforms/target_scaler.py +0 -0
  58. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/utils/__init__.py +0 -0
  59. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/utils/datetime/__init__.py +0 -0
  60. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/utils/datetime/base.py +0 -0
  61. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/utils/datetime/lags.py +0 -0
  62. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/utils/datetime/seasonality.py +0 -0
  63. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/utils/datetime/time_features.py +0 -0
  64. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/utils/features.py +0 -0
  65. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/utils/forecast.py +0 -0
  66. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon/timeseries/utils/warning_filters.py +0 -0
  67. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon.timeseries.egg-info/SOURCES.txt +0 -0
  68. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon.timeseries.egg-info/dependency_links.txt +0 -0
  69. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon.timeseries.egg-info/namespace_packages.txt +0 -0
  70. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon.timeseries.egg-info/top_level.txt +0 -0
  71. {autogluon.timeseries-1.3.2b20250629 → autogluon.timeseries-1.3.2b20250630}/src/autogluon.timeseries.egg-info/zip-safe +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autogluon.timeseries
3
- Version: 1.3.2b20250629
3
+ Version: 1.3.2b20250630
4
4
  Summary: Fast and Accurate ML in 3 Lines of Code
5
5
  Home-page: https://github.com/autogluon/autogluon
6
6
  Author: AutoGluon Community
@@ -116,8 +116,11 @@ class ChronosModel(AbstractTimeSeriesModel):
116
116
  Chronos models (i.e., ``autogluon/chronos-t5-{model_size}``) can be specified with aliases
117
117
  ``tiny``, ``mini`` , ``small``, ``base``, and ``large``. Chronos-Bolt models can be specified
118
118
  with ``bolt_tiny``, ``bolt_mini``, ``bolt_small``, and ``bolt_base``.
119
- batch_size : int, default = 16
120
- Size of batches used during inference
119
+ batch_size : int, default = 256
120
+ Size of batches used during inference. The default ``batch_size`` is selected based on the model type. For Chronos-Bolt
121
+ models the ``batch_size`` is set to 256 whereas Chronos models used a ``batch_size`` of 16, except Chronos (Large) which
122
+ uses 8. For the Chronos-Bolt models, the ``batch_size`` is reduced by a factor of 4 when the prediction horizon is greater
123
+ than the model's default prediction length.
121
124
  num_samples : int, default = 20
122
125
  Number of samples used during inference, only used for the original Chronos models
123
126
  device : str, default = None
@@ -583,6 +586,7 @@ class ChronosModel(AbstractTimeSeriesModel):
583
586
  self,
584
587
  data: TimeSeriesDataFrame,
585
588
  context_length: int,
589
+ batch_size: int,
586
590
  num_workers: int = 0,
587
591
  time_limit: Optional[float] = None,
588
592
  ):
@@ -596,7 +600,7 @@ class ChronosModel(AbstractTimeSeriesModel):
596
600
 
597
601
  return ChronosInferenceDataLoader(
598
602
  chronos_dataset,
599
- batch_size=self.batch_size,
603
+ batch_size=batch_size,
600
604
  shuffle=False,
601
605
  num_workers=num_workers,
602
606
  on_batch=timeout_callback(seconds=time_limit),
@@ -615,6 +619,8 @@ class ChronosModel(AbstractTimeSeriesModel):
615
619
  known_covariates: Optional[TimeSeriesDataFrame] = None,
616
620
  **kwargs,
617
621
  ) -> TimeSeriesDataFrame:
622
+ from .pipeline import ChronosBoltPipeline
623
+
618
624
  # We defer initialization of the model pipeline. i.e., the model is only loaded to device memory
619
625
  # during inference. We also infer the maximum length of the time series in the inference data set
620
626
  # and use that to determine the context length of the model. If the context length is specified
@@ -628,23 +634,42 @@ class ChronosModel(AbstractTimeSeriesModel):
628
634
  with warning_filter(all_warnings=True):
629
635
  import torch
630
636
 
637
+ self.model_pipeline.model.eval()
638
+ batch_size = self.batch_size
639
+ if (
640
+ isinstance(self.model_pipeline, ChronosBoltPipeline)
641
+ and self.prediction_length > self.model_pipeline.model_prediction_length
642
+ ):
643
+ batch_size = max(1, batch_size // 4)
644
+ logger.debug(
645
+ f"\tThe prediction_length {self.prediction_length} exceeds model's prediction_length {self.model_pipeline.model_prediction_length}. "
646
+ f"The inference batch_size has been reduced from {self.batch_size} to {batch_size} to avoid OOM errors."
647
+ )
648
+
631
649
  inference_data_loader = self._get_inference_data_loader(
632
650
  data=data,
651
+ batch_size=batch_size,
633
652
  num_workers=self.data_loader_num_workers,
634
653
  context_length=context_length,
635
654
  time_limit=kwargs.get("time_limit"),
636
655
  )
637
656
 
638
- self.model_pipeline.model.eval()
639
657
  with torch.inference_mode(), disable_duplicate_logs(logger):
640
658
  batch_quantiles, batch_means = [], []
641
659
  for batch in inference_data_loader:
642
- qs, mn = self.model_pipeline.predict_quantiles(
643
- batch,
644
- prediction_length=self.prediction_length,
645
- quantile_levels=self.quantile_levels,
646
- num_samples=self.num_samples,
647
- )
660
+ try:
661
+ qs, mn = self.model_pipeline.predict_quantiles(
662
+ batch,
663
+ prediction_length=self.prediction_length,
664
+ quantile_levels=self.quantile_levels,
665
+ num_samples=self.num_samples,
666
+ )
667
+ except torch.OutOfMemoryError as ex:
668
+ logger.error(
669
+ "The call to predict() resulted in an out of memory error. Try reducing the batch_size by setting:"
670
+ f" predictor.fit(..., hyperparameters={{'Chronos': {{'batch_size': {batch_size // 2}, ...}}}})"
671
+ )
672
+ raise ex
648
673
  batch_quantiles.append(qs.numpy())
649
674
  batch_means.append(mn.numpy())
650
675
 
@@ -381,6 +381,8 @@ class ChronosBoltPipeline(BaseChronosPipeline):
381
381
  def __init__(self, model: ChronosBoltModelForForecasting):
382
382
  super().__init__(inner_model=model)
383
383
  self.model = model
384
+ self.model_context_length: int = self.model.config.chronos_config["context_length"]
385
+ self.model_prediction_length: int = self.model.config.chronos_config["prediction_length"]
384
386
 
385
387
  @property
386
388
  def quantiles(self) -> List[float]:
@@ -394,14 +396,12 @@ class ChronosBoltPipeline(BaseChronosPipeline):
394
396
  ):
395
397
  context_tensor = self._prepare_and_validate_context(context=context)
396
398
 
397
- model_context_length = self.model.config.chronos_config["context_length"]
398
- model_prediction_length = self.model.config.chronos_config["prediction_length"]
399
399
  if prediction_length is None:
400
- prediction_length = model_prediction_length
400
+ prediction_length = self.model_prediction_length
401
401
 
402
- if prediction_length > model_prediction_length:
402
+ if prediction_length > self.model_prediction_length:
403
403
  msg = (
404
- f"We recommend keeping prediction length <= {model_prediction_length}. "
404
+ f"We recommend keeping prediction length <= {self.model_prediction_length}. "
405
405
  "The quality of longer predictions may degrade since the model is not optimized for it. "
406
406
  )
407
407
  if limit_prediction_length:
@@ -414,32 +414,47 @@ class ChronosBoltPipeline(BaseChronosPipeline):
414
414
 
415
415
  # We truncate the context here because otherwise batches with very long
416
416
  # context could take up large amounts of GPU memory unnecessarily.
417
- if context_tensor.shape[-1] > model_context_length:
418
- context_tensor = context_tensor[..., -model_context_length:]
417
+ if context_tensor.shape[-1] > self.model_context_length:
418
+ context_tensor = context_tensor[..., -self.model_context_length :]
419
419
 
420
- # TODO: We unroll the forecast of Chronos Bolt greedily with the full forecast
421
- # horizon that the model was trained with (i.e., 64). This results in variance collapsing
422
- # every 64 steps.
420
+ context_tensor = context_tensor.to(device=self.model.device, dtype=torch.float32)
421
+ # First block prediction
422
+ with torch.no_grad():
423
+ prediction: torch.Tensor = self.model(context=context_tensor).quantile_preds.to(context_tensor)
424
+
425
+ predictions.append(prediction)
426
+ remaining -= prediction.shape[-1]
427
+
428
+ # NOTE: The following heuristic for better prediction intervals with long-horizon forecasts
429
+ # uses all quantiles generated by the model for the first `model_prediction_length` steps,
430
+ # concatenating each quantile with the context and generating the next `model_prediction_length` steps.
431
+ # The `num_quantiles * num_quantiles` "samples" thus generated are then reduced to `num_quantiles`
432
+ # by computing empirical quantiles. Note that this option scales the batch size by `num_quantiles`
433
+ # when the `prediction_length` is greater than `model_prediction_length`.
434
+
435
+ if remaining > 0:
436
+ # Expand the context along quantile axis
437
+ context_tensor = context_tensor.unsqueeze(1).repeat(1, len(self.quantiles), 1)
438
+
439
+ quantile_tensor = torch.tensor(self.quantiles, device=context_tensor.device)
423
440
  while remaining > 0:
441
+ # Append the prediction to context
442
+ context_tensor = torch.cat([context_tensor, prediction], dim=-1)[..., -self.model_context_length :]
443
+ (batch_size, n_quantiles, context_length) = context_tensor.shape
444
+
424
445
  with torch.no_grad():
446
+ # Reshape (batch, n_quantiles, context_length) -> (batch * n_quantiles, context_length)
425
447
  prediction = self.model(
426
- context=context_tensor.to(
427
- device=self.model.device,
428
- dtype=torch.float32, # scaling should be done in 32-bit precision
429
- ),
448
+ context=context_tensor.reshape(batch_size * n_quantiles, context_length)
430
449
  ).quantile_preds.to(context_tensor)
450
+ # Reshape predictions from (batch * n_quantiles, n_quantiles, model_prediction_length) to (batch, n_quantiles * n_quantiles, model_prediction_length)
451
+ prediction = prediction.reshape(batch_size, n_quantiles * n_quantiles, -1)
452
+ # Reduce `n_quantiles * n_quantiles` to n_quantiles and transpose back to (batch_size, n_quantiles, model_prediction_length)
453
+ prediction = torch.quantile(prediction, q=quantile_tensor, dim=1).transpose(0, 1)
431
454
 
432
455
  predictions.append(prediction)
433
456
  remaining -= prediction.shape[-1]
434
457
 
435
- if remaining <= 0:
436
- break
437
-
438
- central_idx = torch.abs(torch.tensor(self.quantiles) - 0.5).argmin()
439
- central_prediction = prediction[:, central_idx]
440
-
441
- context_tensor = torch.cat([context_tensor, central_prediction], dim=-1)
442
-
443
458
  return torch.cat(predictions, dim=-1)[..., :prediction_length]
444
459
 
445
460
  def predict_quantiles(
@@ -1,4 +1,4 @@
1
1
  """This is the autogluon version file."""
2
2
 
3
- __version__ = "1.3.2b20250629"
3
+ __version__ = "1.3.2b20250630"
4
4
  __lite__ = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autogluon.timeseries
3
- Version: 1.3.2b20250629
3
+ Version: 1.3.2b20250630
4
4
  Summary: Fast and Accurate ML in 3 Lines of Code
5
5
  Home-page: https://github.com/autogluon/autogluon
6
6
  Author: AutoGluon Community
@@ -17,10 +17,10 @@ fugue>=0.9.0
17
17
  tqdm<5,>=4.38
18
18
  orjson~=3.9
19
19
  tensorboard<3,>=2.9
20
- autogluon.core[raytune]==1.3.2b20250629
21
- autogluon.common==1.3.2b20250629
22
- autogluon.features==1.3.2b20250629
23
- autogluon.tabular[catboost,lightgbm,xgboost]==1.3.2b20250629
20
+ autogluon.core[raytune]==1.3.2b20250630
21
+ autogluon.common==1.3.2b20250630
22
+ autogluon.features==1.3.2b20250630
23
+ autogluon.tabular[catboost,lightgbm,xgboost]==1.3.2b20250630
24
24
 
25
25
  [all]
26
26