Update README.md
Browse filesInitial PR. Update the README
README.md
CHANGED
@@ -1,3 +1,72 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
---
|
4 |
+
|
5 |
+
# TimesFM (Time Series Foundation Model)
|
6 |
+
|
7 |
+
TimesFM is a pretrained time-series foundation model developed by Google
|
8 |
+
Research for time-series forecasting.
|
9 |
+
|
10 |
+
Paper link: https://arxiv.org/abs/2310.10688 (to appear in ICML 2024)
|
11 |
+
|
12 |
+
Blog post: https://research.google/blog/a-decoder-only-foundation-model-for-time-series-forecasting/
|
13 |
+
|
14 |
+
This repo contains the code to load public TimesFM checkpoints and run model
|
15 |
+
inference locally.
|
16 |
+
|
17 |
+
This is not an officially supported Google product.
|
18 |
+
|
19 |
+
## Installation
|
20 |
+
|
21 |
+
We have two environment files. For GPU installation (assuming CUDA 12 has been setup), you can create a conda environment from the base folder through:
|
22 |
+
|
23 |
+
```
|
24 |
+
conda env create --file=environment.yml
|
25 |
+
```
|
26 |
+
|
27 |
+
For a CPU setup please use,
|
28 |
+
|
29 |
+
```
|
30 |
+
conda env create --file=environment_cpu.yml
|
31 |
+
```
|
32 |
+
followed by
|
33 |
+
|
34 |
+
```
|
35 |
+
conda activate tfm_env
|
36 |
+
pip install -e .
|
37 |
+
```
|
38 |
+
to install the package.
|
39 |
+
|
40 |
+
## Usage
|
41 |
+
|
42 |
+
Then the base class can be loaded as,
|
43 |
+
|
44 |
+
```python
|
45 |
+
import timesfm
|
46 |
+
|
47 |
+
tfm = timesfm.TimesFm(
|
48 |
+
context_len=<context>,
|
49 |
+
horizon_len=<horizon>,
|
50 |
+
input_patch_len=32,
|
51 |
+
output_patch_len=128,
|
52 |
+
num_layers=20,
|
53 |
+
model_dims=1280,
|
54 |
+
backend=<backend>,
|
55 |
+
per_core_batch_size=<batch_size>,
|
56 |
+
quantiles=<quantiles>,
|
57 |
+
)
|
58 |
+
tfm.load_from_checkpoint(
|
59 |
+
<checkpoint_path>,
|
60 |
+
checkpoint_type=checkpoints.CheckpointType.FLAX,
|
61 |
+
)
|
62 |
+
```
|
63 |
+
|
64 |
+
1. The context_len here can be set as the max context length of the model. You can provide shorter series to the `tfm.forecast()` function and the model will handle it. Currently the model handles a max context length of 512, which can be increased in later releases.
|
65 |
+
|
66 |
+
2. The horizon length can be set to anything. We recommend setting it to the largest horizon length you would need in the forecasting tasks for your application. We generally recommend horizon length <= context length but it is not a requirement in the function call.
|
67 |
+
|
68 |
+
3. We also provide an API to forecast from pandas dataframe. Please look at the documentation of the function `tfm.forecast_on_df()`.
|
69 |
+
|
70 |
+
## Benchmarks
|
71 |
+
|
72 |
+
Please look into the README files in the respective benchmark directories within `experiments/` for instructions for running TimesFM on the respective benchmarks.
|