Commit graph

141 commits

Author SHA1 Message Date
Abdul Fatir
fd533389c3
Bump version from 2.2.1 to 2.2.2 (#439)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-17 19:12:57 +01:00
Oleksandr Shchur
c50fed93df
Speed up predict_df (#437)
*Issue #, if available:*

*Description of changes:*
- Remove for-loop with numpy operations + single pd.DataFrame
construction


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-17 12:44:43 +00:00
Abdul Fatir
efb86e02c2
Chronos-2: Add after_batch callback (#436)
*Issue #, if available:*

*Description of changes:* Adds support for custom callbacks after each
batch is processed during prediction. This allows for keeping track of
the time limit in AutoGluon.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-17 11:45:16 +01:00
Abdul Fatir
2896499580
Update version to 2.2.1 (#435)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-16 13:07:19 +01:00
Abdul Fatir
71ff0d64ba
Chronos-2: Add option to disable DataParallel (#434)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-15 19:27:05 +01:00
Abdul Fatir
eb5b61234a
Chronos-2: Only pin_memory when device type is cuda (#431) 2025-12-10 14:59:13 +01:00
Abdul Fatir
086e660023
Add unittests for df_utils (#414)
*Issue #, if available:*

*Description of changes:* This PR improves test coverage by adding unit
tests for `df_utils`. Previously these methods were only being tested as
part of Chronos-2 integration tests.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-08 15:02:44 +00:00
Abdul Fatir
d608e0dd68
Chronos-2: Update quick start notebook with LoRA example (#415)
*Issue #, if available:*

*Description of changes:* 


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-08 14:52:25 +00:00
Abdul Fatir
75a2dfe228 Update docstring 2025-12-08 14:14:21 +00:00
Abdul Fatir
c74311fbeb
Add validate_inputs to predict_df in BaseChronosPipeline (#427)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-08 14:11:47 +00:00
Abdul Fatir
fdda16fc02
Bump version from 2.2.0rc4 to 2.2.0 (#426)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-08 13:49:34 +01:00
Abdul Fatir
5f5da1ac89
Bump version from 2.2.0rc3 to 2.2.0rc4 (#422)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-04 13:24:48 +01:00
Abdul Fatir
89031842fa
Chronos-2: Handle missing 'peft' and lora_config specified (#421)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-04 09:43:56 +00:00
Abdul Fatir
564218776a
Chronos-2: Ensure updated chronos_config is saved after fine-tuning (#420)
*Issue #, if available:*

*Description of changes:* Previously, only the returned pipeline had
correct configuration but it was not being saved to disk.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-03 17:32:14 +01:00
Abdul Fatir
f0e1ef5b8f
Chronos-2: Update context_length if fine-tuned with longer than default (#419)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-03 17:05:02 +01:00
Abdul Fatir
3cb8f8831a
Chronos-2: Rename predict_batches_jointly to cross_learning (#418)
*Issue #, if available:*

*Description of changes:*
- Rename `predict_batches_jointly` to `cross_learning`
- Add deprecation warning
- Add cross_learning to predict_df docstring

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-03 15:15:37 +00:00
Abdul Fatir
7513dee92d
Chronos-2: Do not catch exceptions in predict_fev when fine-tuning (#417)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-03 15:33:08 +01:00
Abdul Fatir
9afe64332f
Bump version to 2.2.0rc3 (#411)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-01 19:21:44 +01:00
Abdul Fatir
c1237a5259
Chronos-2: Add option to remove PrinterCallback (#410)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-01 17:56:37 +01:00
Abdul Fatir
1da6965318
Chronos-2: set default dataloader_num_workers=0 in Trainer (#409)
*Issue #, if available:*

*Description of changes:* 0 is a better default than 1. 


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-01 14:13:50 +00:00
Oleksandr Shchur
4eea8d0122
Handle prediction_length below 3 (#407)
*Issue #, if available:* Fixes #403

*Description of changes:*
- Update the `future_df` validation logic to only check that
`prediction_length` values are provided for each item.
- Update unit tests for DF-based methods in `test_chronos2.py`
- Ignore fine-tuned checkpoint folders with `.gitignore`


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-12-01 13:10:16 +01:00
Abdul Fatir
8c686cfa71
Bump version from 2.2.0rc1 to 2.2.0rc2 2025-11-30 16:53:59 +01:00
Abdul Fatir
5cde42eb1f
Chronos-2: Add option to specify callbacks in fit (#405)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-11-28 16:55:35 +01:00
Abdul Fatir
514019fb1c
Fix potential crash due to unbound local in df_utils (#404)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-11-28 13:54:52 +01:00
Abdul Fatir
a942c0609c
Update peft version constraint in pyproject.toml 2025-11-28 00:08:38 +01:00
Abdul Fatir
32023ec99f
Bump version to 2.2.0rc1 2025-11-28 00:07:25 +01:00
Abdul Fatir
b438bed63f
Chronos-2: Add option to skip dataframe validation in predict_df (#400)
*Issue #, if available:*

*Description of changes:* This PR adds a `validate_inputs ` argument to
`predict_df` (defaults to `True`), which allows the user to disable
dataframe validation when they know that their dataframe is in the right
format. This reduces runtime by removing the input validation component,
e.g., when calling this method from
[AutoGluon](https://github.com/autogluon/autogluon/pull/5427), and also
handles series with shorter than 3 timesteps.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-11-27 16:52:37 +01:00
Abdul Fatir
c5907ef52e
Chronos-2: Add LoRA fine-tuning support (#393)
*Issue #, if available:*

*Description of changes:* Adds support for LoRA fine-tuning.

- [x] Move peft/pandas dependency to an extra
- [x] Add tests for LoRA
- [x] Update notebook with LoRA info
- [x] Enable automatic recognition and loading of LoRA adapters


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-11-25 16:06:58 +01:00
Oleksandr Shchur
bcd563eb66
Optimize convert_df_input_to_list_of_dicts_input and validate_df_inputs (#395)
*Issue #, if available:* Addresses #391

*Description of changes:*

- Speed up `convert_df_input_to_list_of_dicts_input` and
`validate_df_inputs` via a few tricks:
- Replace `df.iloc[start_idx:end_idx][col]` with
`df[col].iloc[start_idx:end_idx]` to avoid copying data on each slice
  - Vectorize computation of future timestamps using numpy
- Work with `dict[str, np.ndarray]` instead of `pd.DataFrame` when
working with covariates to avoid repeated `.to_numpy()` calls.


**Before**
```
Benchmarking 20000 series, 200 steps, 0 covariates...
Average runtime: 27.33s
Benchmarking 20000 series, 200 steps, 5 covariates...
Average runtime: 44.69s
```

**After**
```
Benchmarking 20000 series, 200 steps, 0 covariates...
Average runtime: 4.60s
Benchmarking 20000 series, 200 steps, 5 covariates...
Average runtime: 8.92s
```

<details> 

```python
import time

import numpy as np
import pandas as pd

from chronos.df_utils import convert_df_input_to_list_of_dicts_input


def benchmark_convert_df_input(
    num_items: int, num_steps: int, num_covariates: int = 0, num_trials: int = 10, freq: str = "D"
) -> None:
    """
    Benchmark convert_df_input_to_list_of_dicts_input function.

    Args:
        num_items: Number of time series
        num_steps: Number of observations per series
        num_covariates: Number of covariates to include
        num_trials: Number of benchmark trials
        freq: Frequency string for timestamps
    """
    prediction_length = 24

    # Generate context DataFrame
    item_ids = np.repeat(np.arange(num_items), num_steps)
    timestamps = np.tile(pd.date_range("2020-01-01", periods=num_steps, freq=freq), num_items)

    df_data = {"item_id": item_ids, "timestamp": timestamps, "target": np.random.randn(num_items * num_steps)}
    df_data.update({f"cov_{i}": np.random.randn(num_items * num_steps) for i in range(num_covariates)})
    df = pd.DataFrame(df_data)

    # Generate future_df with covariates
    future_df = None
    if num_covariates > 0:
        future_item_ids = np.repeat(np.arange(num_items), prediction_length)
        offset = pd.tseries.frequencies.to_offset(freq)
        future_start = pd.Timestamp("2020-01-01") + num_steps * offset
        future_timestamps = np.tile(pd.date_range(start=future_start, periods=prediction_length, freq=freq), num_items)

        future_data = {"item_id": future_item_ids, "timestamp": future_timestamps}
        future_data.update({f"cov_{i}": np.random.randn(num_items * prediction_length) for i in range(num_covariates)})
        future_df = pd.DataFrame(future_data)

    times = []
    print(f"Benchmarking {num_items} series, {num_steps} steps, {num_covariates} covariates...")
    for _ in range(num_trials):
        start = time.perf_counter()
        convert_df_input_to_list_of_dicts_input(
            df=df,
            future_df=future_df,
            id_column="item_id",
            timestamp_column="timestamp",
            target_columns=["target"],
            prediction_length=prediction_length,
        )
        end = time.perf_counter()
        times.append(end - start)

    print(f"Average runtime: {sum(times) / len(times):.2f}s")


if __name__ == "__main__":
    # Test without covariates
    benchmark_convert_df_input(20_000, 200, num_covariates=0, num_trials=1)

    # Test with covariates
    benchmark_convert_df_input(20_000, 200, num_covariates=5, num_trials=1)
```

</details>

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-11-25 15:30:32 +01:00
Oleksandr Shchur
d6f8ea4301
Fix link in Chronos-Bolt tutorial notebook entry (#396)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-11-25 13:18:43 +01:00
Abdul Fatir
972a09b626
Chronos-2: Convert assert about batch size to warning (#392) 2025-11-24 09:22:43 +01:00
Abdul Fatir
7daaa7194c
Bump version to 2.1.0 (#389)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-11-21 11:50:52 +01:00
Abdul Fatir
182aafe184
Update torch dependency version to >=2.2,<3 (#388)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-11-21 11:37:14 +01:00
Abdul Fatir
67a6f91aec
Update version to 2.1.0rc1 for pre-release (#383)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-11-18 10:52:56 +01:00
Abdul Fatir
359d7ff1b9
Chronos-2: Change default fine-tuning learning rate and remove experimental label (#381)
*Issue #, if available:*

*Description of changes:* Lower learning rates generally appear to be
working better. This is probably because we are doing full fine-tuning
of a model with 120M params.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-11-18 10:33:38 +01:00
Abdul Fatir
0f3c5652e5
Mask past-only covariates during loss computation (#379)
*Issue #, if available:*

*Description of changes:* This PR masks rows corresponding to all
covariates in the future target. Specifically, this is to avoid the
contribution of past-only covariates in loss computation. The previous
setup was correct from the perspective of pretraining but I think this
makes more sense for fine-tuning.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-11-17 18:02:55 +01:00
Abdul Fatir
111972a6cc
Add Chronos2Pipeline.embed (#361)
*Issue #, if available:* #354 

*Description of changes:* This PR adds `Chronos2Pipeline.embed` to
enable users to extract embeddings from the last encoder layer in an
easy way. The API and behavior is similar to what Chronos and
Chronos-Bolt provides.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-11-17 17:16:50 +01:00
Abdul Fatir
e48f48071f
Add predict_df support for Chronos and Chronos-Bolt (#371)
*Issue #, if available:*

*Description of changes:* This PR adds `predict_df` to the base pipeline
which enables pandas support for the univariate Chronos and Chronos-Bolt
models.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-11-11 18:37:19 +01:00
Abdul Fatir
22c036bf07
Fix SageMaker deployment link in README 2025-11-07 16:04:35 +01:00
Abdul Fatir
46b20c2d54
Update long horizon heuristic for Chronos-Bolt (#366)
*Issue #, if available:*

*Description of changes:* In light of the planned AG dependency on this
package, this PR updates the long horizon heuristic of Chronos-Bolt to
what it was in AG (introduced in
https://github.com/autogluon/autogluon/pull/5177). Code has been
copy-pasted [from
AG](5fcebaa493/timeseries/src/autogluon/timeseries/models/chronos/pipeline/chronos_bolt.py (L441)).


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-11-06 11:25:48 +01:00
Ilias Aarab
78bd1c90ca
Set num_workers=0 in Chronos-2 test data loader (#365)
By default, the `transformers` library sets the `num_workers` argument
of the PyTorch DataLoader to `0`, ensuring out-of-the-box compatibility
across different platforms.

*Issue #, if available:*

*Description of changes:*

Set the DataLoader `num_workers` argument to `0` to improve
cross-platform compatibility, particularly on Windows systems where
multiprocessing requires guarded execution.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------

Co-authored-by: Abdul Fatir <Abdulfatirs@gmail.com>
2025-11-05 23:33:07 +01:00
Abdul Fatir
93419cfe9f
Relax transformers lower bound to >=4.41 (#364) 2025-11-05 14:27:46 +01:00
Abdul Fatir
c23d34cd88
Add FutureWarning for CloudFront (#357)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-10-31 11:05:09 +01:00
Abdul Fatir
c5aa5f4292
Update Notebooks and README (#356)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

---------

Co-authored-by: Oleksandr Shchur <oleks.shchur@gmail.com>
2025-10-31 10:09:04 +01:00
Oleksandr Shchur
dc5c438ab2
Remove logo from README (#355)
Removed logo image from the README.

*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-10-31 08:13:20 +01:00
Oleksandr Shchur
9f8fef2116
Update model link to Hugging Face (#353)
*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-10-30 18:08:57 +01:00
Oleksandr Shchur
c60bd2ce4e
Add Chronos-2 SageMaker notebook (#350)
*Issue #, if available:*

*Description of changes:*
- Add notebook showcasing how Chronos-2 can be deployed using Amazon
SageMaker

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-10-30 10:11:07 +01:00
Xiaoxuan(Alex) Zhang
6c6915501c
fix validate_and_prepare_single_dict_task by separating "past only" and "future known" cov keys (#344)
Closes #345 

Hi @abdulfatir 
Here is the bugfix about the function
"validate_and_prepare_single_dict_task", which had 2 issue points:

1. Originally, one of this func return, the "task_n_future_covariates",
will return the ["past only" + "future known"]covariates number, by
`task_n_future_covariates = len(task_future_covariates_list)` as
`task_future_covariates_list ` is filled by for` key in
task_covariates_keys`
2. The code seems not to guarantee the last "future known" rows are
atcually what we expected, even there is a sorted option.

So, this PR fixed them by separating "past only" and "future known" covs
from the "past_covariates" input, and explicitly put the "past only"
covs rows above "future known" cov rows, supported by a temp list
"ordered_covariate_keys".
2025-10-29 14:00:56 +01:00
Oleksandr Shchur
6d46e628ae
Revert "Move SageMaker notebook to a new path" (#349)
Reverts amazon-science/chronos-forecasting#348
2025-10-29 13:58:23 +01:00
Oleksandr Shchur
c09c33fcbe
Move SageMaker notebook to a new path (#348)
*Issue #, if available:*

*Description of changes:*
- Move the SageMaker deployment notebook to a new path to check that the
GitHub redirect feature works.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-10-29 13:50:40 +01:00