Commit graph

80 commits

Author SHA1 Message Date
Abdul Fatir
226386ca3e
Revise WaveToken code release note in README
Updated README to reflect changes in WaveToken code release status.
2025-11-23 16:39:33 +01:00
Abdul Fatir
c5c9492401
Fix paper link 2025-05-28 14:15:13 +02:00
Abdul Fatir
81929a9927
Update README.md for WaveToken 2025-05-28 14:14:02 +02:00
Abdul Fatir
6a9c8dadac
Bump version to 1.5.2 (#299)
*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-05-06 10:20:46 +02:00
Tyler
c5880604df
Bump accelerate>=0.32,<2 (#298)
*Issue #, if available:*

*Description of changes:*

Just increased the max version allowed. Tests pass.

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-05-06 10:15:22 +02:00
Lorenzo Stella
f40a266a55
Fix type-checking issues (#295)
*Issue #, if available:* See example build
https://github.com/amazon-science/chronos-forecasting/actions/runs/14302765904/job/40313421985

*Description of changes:*
- Address type-checker complaints, where possible
- Bump bugfix version of the package


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-04-10 17:23:59 +02:00
Abdul Fatir
eec771e339
Fix scaling that affects constant series (#294) 2025-04-07 08:54:03 +02:00
Lorenzo Stella
94e20ea7e5
Fix date in readme (#284)
*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-02-19 08:47:59 +01:00
Oleksandr Shchur
a996ca79ad
Add example notebook for SageMaker JumpStart (#281)
*Issue #, if available:*

*Description of changes:*
- Add pointers to fev and JumpStart notebook in the README
- Add notebook describing how to deploy Chronos with SageMaker JumpStart


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-02-17 10:35:42 +01:00
Lorenzo Stella
8178798f4e
Bump transformers to >=4.48 (#280)
*Issue #, if available:* addresses
https://github.com/amazon-science/chronos-forecasting/security/dependabot/1

*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-02-13 13:46:47 +01:00
Lorenzo Stella
73d6c9aa1a
Bump package version to 1.5.0 (#278)
*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-02-06 16:37:26 +01:00
Lorenzo Stella
75803f241f
Relax torch compatibility to <3 (#277)
*Issue #, if available:* Solves #273

*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-02-06 16:29:32 +01:00
Lorenzo Stella
39515ff0fc
Update issue templates (#269)
*Description of changes:* remove blank issue button, update description
of link to discussions


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2025-01-18 14:55:03 +01:00
Abdul Fatir
ad410c9c0a
Add pipeline.embed support for Chronos-Bolt (#247) 2024-12-22 13:56:41 +01:00
Caner Turkmen
28e7b3281f
remove eval-pr-comment workflow (#239) 2024-12-17 00:14:14 +03:00
Abdul Fatir
751f5f5f34
Fix training install instructions (#236)
*Issue #, if available:* Fixes #235 

*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.
2024-12-15 01:32:19 +01:00
Lorenzo Stella
133761a901
Bump version number to 1.4.1 (#228)
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-12-04 18:35:22 +01:00
Lorenzo Stella
67f008432a
Fix padding for int contexts (#227)
*Issue #, if available:* On Linux, the final call to `.to` creates
trouble when input tensors are integer. For example:

```
>>> a = torch.tensor([1])
>>> b = torch.stack([torch.full((1,), torch.nan), a])
>>> b
tensor([[nan],
        [1.]])
>>> b.to(a)
tensor([[-9223372036854775808],
        [                   1]])
```


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-12-04 16:46:17 +01:00
Abdul Fatir
47cac082c1
Bump version to 1.4.0 (#225)
*Issue #, if available:*

*Description of changes:* Title.


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 Ansari <ansarnd@amazon.de>
2024-12-02 12:02:20 +01:00
Abdul Fatir
60bcded58f
Use absolute link to images in the README (#223)
*Issue #, if available:*

*Description of changes:* This PR uses absolute link to the images so
they show up correct on other places such as PyPi.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-12-02 11:53:52 +01:00
Abdul Fatir
86f755c179
Fix auto eval workflow (#224)
*Issue #, if available:*

*Description of changes:* This PR fixes the auto evaluation workflow.
The second workflow step did not work because it did not know the right
PR number to post the comment on. The fix is to include the PR number in
the CSV file name and read it in the second workflow.

PS: This is a really poor user experience because there's no way to test
that this works right without merging!


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 Ansari <ansarnd@amazon.de>
2024-12-02 11:47:29 +01:00
Abdul Fatir
eac768ce28
Add workflow to run evaluation on a subset of datasets (#222)
*Issue #, if available:*

*Description of changes:* This PR adds a workflow that will run the
evaluation script on `chronos-bolt-small` for a subset of datasets
specified in `ci/evaluate/backtest_configs.yaml`. After evaluation, a
comment will be made on the PR. The workflow will only run if the
`run-eval` label is present on a PR. The end-to-end workflow has been
split into two workflows:

- `eval-model.yml`: only has read access (can be run from forks). This
will evaluate the model and upload the metrics CSV file as a Github
artifact.
- `eval-pr-comment.yml`: has read and write access (can only be run when
in the `main` branch). This will be triggered when the first job
finishes, will download the CSV from the eval job and make the comment.
According to [this
post](https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/),
splitting into two jobs as done here is the recommended and secure way
to do this.

**NOTE**: The first steps works as expected, but we can only test the
second step after the merging because this workflow needs to be part of
the `main` branch for this to work.

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 Ansari <ansarnd@amazon.de>
2024-12-02 10:05:57 +01:00
Abdul Fatir
e3bbda7207
Fix README example to use predict_quantiles (#220)
*Issue #, if available:*

*Description of changes:* `predict` returns different things based on
model type. This fixes the example to use `predict_quantiles` which will
give correct quantiles.


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 Ansari <ansarnd@amazon.de>
2024-11-29 16:54:48 +01:00
Abdul Fatir
4c43cfbdac
Return predictions in fp32 on CPU (#219)
*Issue #, if available:* N/A

*Description of changes:* This PR ensures that predictions are returned
in FP32 and on the CPU device. This choice is now better because we have
two types of models which have different types of forecasts (samples vs.
quantiles). Furthermore, `int64` input_type (our README example is one
such case) ran into issues with `predict_quantiles` before. This choice
also fixes that.


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 Ansari <ansarnd@amazon.de>
2024-11-29 16:54:21 +01:00
Abdul Fatir
c887278706
Clean up evaluation script (#218)
*Issue #, if available:*

*Description of changes:* This PR cleans up eval script by using
`DateTimeIndex.to_period()` instead of the ugly frequency mapping. Not
sure what I was doing before. 🫠


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 Ansari <ansarnd@amazon.de>
2024-11-29 10:33:41 +01:00
Lorenzo Stella
ead8323d76
Run type checks on Python 3.11 only (#217)
*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.
2024-11-28 16:28:30 +01:00
Abdul Fatir Ansari
5918c8153a Change indetation of bibtex 2024-11-28 15:19:31 +00:00
Abdul Fatir Ansari
96b3e45637 Update source install command 2024-11-28 15:11:35 +00:00
Abdul Fatir
98b917cc2c
Remove reference to MPS (#216)
*Issue #, if available:*

*Description of changes:* MPS mostly causes issues for users, so let's
remove the reference to MPS from the README. Plus, Chronos-Bolt models
currently fail on MPS.


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 Ansari <ansarnd@amazon.de>
2024-11-28 16:05:32 +01:00
Abdul Fatir
ebaa13cbf0
Update project information and workflows (#214)
*Description of changes:* This PR updates project information and
workflows to allow for PyPi release.


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 Ansari <ansarnd@amazon.de>
2024-11-28 13:37:58 +01:00
Abdul Fatir
72ab64166c
Add support for Chronos-Bolt models (#204)
*Issue #, if available:* N/A

*Description of changes:* This PR adds support for Chronos-Bolt models.

TODOs:

- [x] Update evaluation script
- [x] Fix and add tests for Bolt
- [x] Update docstrings
- [x] Update README example and mention Chronos-Bolt
- [x] Update results bar plot in README
- [x] Add versions for libraries in `pyproject.toml`
- [x] Check that the training and eval scripts work
- [x] Change `autogluon` -> `amazon` in model names

Post Merge:
- [ ] Update Citation style in README, both Github and HuggingFace repos
- [ ] Remove note about AutoGluon
- [ ] Update READMEs of original Chronos models to refer to Chronos-Bolt

NOTE: To be merged after Chronos-Bolt models are available under the
`amazon` namespace on HF.

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 Ansari <ansarnd@amazon.de>
Co-authored-by: Caner Turkmen <turkmen.ac@gmail.com>
Co-authored-by: Lorenzo Stella <stellalo@amazon.com>
2024-11-26 17:47:14 +01:00
Abdul Fatir
d0c114c81d
Update README.md (#206)
*Issue #, if available:*

*Description of changes:* Update README. 


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-11-19 18:56:07 +01:00
Lorenzo Stella
d2eef92009
Force context scaling and quantization in float32, add assertions to tests (#197)
*Issue #, if available:* Fixes #193

*Description of changes:* Passing in contexts in lower precision than
float32 may result in a drop of accuracy. This change ensures that the
tokenizer (which does scaling and quantization) operates on a float32
batch.

Tested across GPU/CPU and different context dtypes with

```python
from itertools import product

import pandas as pd
import torch
from chronos import ChronosPipeline

import matplotlib.pyplot as plt  # requires: pip install matplotlib
import numpy as np

df = pd.read_csv("https://raw.githubusercontent.com/AileenNielsen/TimeSeriesAnalysisWithPython/master/data/AirPassengers.csv")

for context_dtype, context_device, model_dtype, model_device in product(
    [torch.bfloat16, torch.float16, torch.float32],
    ["cpu"],  # only cpu input supported at the moment
    [torch.bfloat16, torch.float16, torch.float32],
    ["cpu", "cuda"],
):
    pipeline = ChronosPipeline.from_pretrained(
        "amazon/chronos-t5-tiny",
        device_map=model_device,
        torch_dtype=model_dtype,
    )

    forecast = pipeline.predict(
        context=torch.tensor(df["#Passengers"]).to(dtype=context_dtype, device=context_device),
        prediction_length=65,
        num_samples=20,
        limit_prediction_length=False,
    )

    assert forecast.dtype == context_dtype, f"{forecast.dtype=} but {context_dtype=}"
    assert str(forecast.device) == context_device, f"{forecast.device=} but {context_device=}"

    forecast_index = range(len(df), len(df) + 65)
    low, median, high = np.quantile(forecast[0].to(device="cpu", dtype=torch.float32).numpy(), [0.1, 0.5, 0.9], axis=0)

    plt.figure(figsize=(8, 4))
    plt.plot(df["#Passengers"], color="royalblue", label="historical data")
    plt.plot(forecast_index, median, color="tomato", label="median forecast")
    plt.fill_between(forecast_index, low, high, color="tomato", alpha=0.3, label="80% prediction interval")
    plt.legend()
    plt.grid()
    plt.show()
```


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-11-18 09:55:54 +01:00
Alvaro Perez-Diaz
ac6ee36ace
Fix number of quantisation buckets (#182)
Fixes https://github.com/amazon-science/chronos-forecasting/issues/181.

Chronos' tokenizer has a vocabulary size of `n_tokens`. Among these,
there are `n_special_tokens` reserved for EOS, PAD, etc. and `n_tokens -
n_special_tokens` allocated to numerical values. However, the provided
`MeanScaleUniformBins` tokenizer creates` n_tokens - n_special_tokens +
1` different buckets, resulting in a total of `n_tokens + 1` possible
tokens. This causes training and inference errors when one of the data
points gets allocated to the largest bucket, as the model requires 0 <=
token_id < n_tokens.

This PR modifies the `MeanScaleUniformBins` tokenizer, so that it
creates one less bucket for numerical values.

---

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: Lorenzo Stella <lorenzostella@gmail.com>
2024-10-04 23:00:42 +02:00
Lorenzo Stella
eb7bdfc047
Simplify pretraining README snippet (#160)
*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.
2024-07-24 11:23:33 +02:00
Lorenzo Stella
050d600f64
Bound number of workers by number of datasets (#157)
*Issue #, if available:* Fixes #154

*Description of changes:* Prior to the fix, some workers have no dataset
to consume if `dataloader_num_workers > len(training_data_paths)`.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-07-23 10:37:14 +02:00
Abdul Fatir
9d59057b72
Add generation params to eval script (#138)
*Description of changes:* Adds generation params to command line options
for the evaluation script.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-06-27 23:11:05 +02:00
Abdul Fatir
df67c3eb44
Add datasets badge (#137)
*Description of changes:* Title.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-06-27 20:22:16 +02:00
Abdul Fatir
61a9c4dded
Update README.md with dataset and evaluation details (#136)
*Description of changes:* This PR updates README.md with dataset and
evaluation details


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-06-27 19:26:07 +02:00
Abdul Fatir
fead4ecbca
Add evaluation script (#134)
*Description of changes:* This PR adds configs and a script to evaluate
Chronos models in the same way as described in the paper.


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 Ansari <ansarnd@amazon.de>
2024-06-27 17:13:35 +02:00
Abdul Fatir
afd9cfd062
Update README.md 2024-06-22 10:08:45 +02:00
Abdul Fatir
d2e0c9d6d5
Set drop_prob = 0 for causal models (#125)
*Description of changes:* This PR sets `drop_prob = 0` when training
causal models. Missing values are problematic for causal model training.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-06-16 17:28:47 +02:00
Abdul Fatir
2f92a126d3
Add support for causal models (#113)
*Description of changes:* This PR adds support for training
causal/decoder-only models.


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 Ansari <ansarnd@amazon.de>
2024-06-13 17:37:04 +02:00
Lorenzo Stella
79028e3154
Add issue templates (#109)
*Description of changes:* adding templates for GitHub issues.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-06-12 18:09:17 +02:00
Abdul Fatir
f49c4ee4b5
Remove print statements from train.py (#101)
*Description of changes:* Removes print statements that got left inside
from a debugging session.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-06-07 23:36:45 +02:00
Lorenzo Stella
601d52db75
Add FAQ badge to README (#97)
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-06-03 15:04:06 +02:00
Abdul Fatir
c63145aeb9
Update ci.yml with schedule (#95)
*Description of changes:* Run CI at 8 AM UTC every day.


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: Lorenzo Stella <stellalo@amazon.com>
2024-06-03 09:16:36 +02:00
Lorenzo Stella
0ea0adb9b3
Uncap transformers dependency (#94)
*Issue #, if available:* We had to cap transformers in #77 due to
https://github.com/huggingface/transformers/issues/30892. The issue was
solved and released in [transformers
4.41.1](https://github.com/huggingface/transformers/releases/tag/v4.41.1).

*Description of changes:* Remove previous version cap introduced in #77.


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-06-03 09:14:07 +02:00
Abdul Fatir
6bcd4584a3
Enhance training script: auto tf32 detection and reorder default seed setting (#91)
*Description of changes:* Automatically set `tf32` to `False` if used on
an older NVIDIA GPU. Reorder seed so that the seed is saved as part of
the training config.


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 Ansari <ansarnd@amazon.de>
2024-05-31 15:13:49 +02:00
Abdul Fatir
b0bdbd9d1a
Fix citation (#86)
*Description of changes:* Updates the citation. 


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
2024-05-29 10:47:15 +02:00