Commit ·
f291eba
1
Parent(s): 86fc8dc
Update README.md
Browse files
README.md
CHANGED
|
@@ -45,10 +45,49 @@ FLAME Large (10M) -- branch FLAME_Large
|
|
| 45 |
You need to install the following packages:
|
| 46 |
|
| 47 |
```shell
|
| 48 |
-
pip install transformers[torch]
|
| 49 |
|
| 50 |
-
pip install mamba-ssm[causal-conv1d]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
pip install zuko
|
| 53 |
```
|
| 54 |
|
|
|
|
| 45 |
You need to install the following packages:
|
| 46 |
|
| 47 |
```shell
|
| 48 |
+
# pip install transformers[torch]
|
| 49 |
|
| 50 |
+
# pip install mamba-ssm[causal-conv1d]
|
| 51 |
+
|
| 52 |
+
# pip install zuko
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
To make deterministic or probabilistic forecasts, just follow:
|
| 56 |
+
|
| 57 |
+
```python
|
| 58 |
+
from transformers import AutoModel, AutoConfig
|
| 59 |
+
import torch
|
| 60 |
+
|
| 61 |
+
model_path = "path/to/your/model"
|
| 62 |
+
config_path = "path/to/your/config"
|
| 63 |
+
|
| 64 |
+
config = AutoConfig.from_pretrained(config_path)
|
| 65 |
+
|
| 66 |
+
model = AutoModel.from_pretrained(model_path, config=config)
|
| 67 |
+
model.eval()
|
| 68 |
+
|
| 69 |
+
# The inputs need to be [batch_size, seq_len]. If multivariate, transform the inputs to [batch_size * n_vars, seq_len]
|
| 70 |
+
inputs = torch.randn(batch_size, seq_length)
|
| 71 |
+
|
| 72 |
+
# deterministic forecasting
|
| 73 |
+
with torch.no_grad():
|
| 74 |
+
outputs = model.generate(
|
| 75 |
+
inputs=inputs,
|
| 76 |
+
max_length=96,
|
| 77 |
+
revin=True,
|
| 78 |
+
num_samples=1,
|
| 79 |
+
inference_patch_len=48 # recommend to input the period length
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
# probabilistic forecasting
|
| 84 |
+
with torch.no_grad():
|
| 85 |
+
outputs = model.generate(
|
| 86 |
+
inputs=inputs,
|
| 87 |
+
max_length=96,
|
| 88 |
+
revin=True,
|
| 89 |
+
num_samples=100
|
| 90 |
+
)
|
| 91 |
|
|
|
|
| 92 |
```
|
| 93 |
|