Spaces:
Sleeping
Sleeping
Evgueni Poloukarov
commited on
Commit
·
2c1d599
1
Parent(s):
7ff8b4c
fix: correct numpy median/quantile calls in inference pipeline
Browse filesFixed critical bug where NumPy arrays were incorrectly called with
.median() and .quantile() as methods instead of np.median() and
np.quantile() functions. This was causing forecasts to return empty
results (only timestamps, no predictions).
Changes:
- Added numpy import
- Changed forecast_numpy.median() to np.median(forecast_numpy, axis=0)
- Changed forecast_numpy.quantile() to np.quantile(forecast_numpy, q, axis=0)
This fix enables the HF Space to generate actual forecast predictions.
src/forecasting/chronos_inference.py
CHANGED
|
@@ -10,6 +10,7 @@ from typing import List, Dict, Optional
|
|
| 10 |
from datetime import datetime, timedelta
|
| 11 |
import polars as pl
|
| 12 |
import pandas as pd
|
|
|
|
| 13 |
import torch
|
| 14 |
from datasets import load_dataset
|
| 15 |
from chronos import ChronosPipeline
|
|
@@ -186,9 +187,9 @@ class ChronosInferencePipeline:
|
|
| 186 |
|
| 187 |
# Store results
|
| 188 |
results['borders'][border] = {
|
| 189 |
-
'median':
|
| 190 |
-
'q10':
|
| 191 |
-
'q90':
|
| 192 |
'inference_time_s': time.time() - border_start
|
| 193 |
}
|
| 194 |
|
|
|
|
| 10 |
from datetime import datetime, timedelta
|
| 11 |
import polars as pl
|
| 12 |
import pandas as pd
|
| 13 |
+
import numpy as np
|
| 14 |
import torch
|
| 15 |
from datasets import load_dataset
|
| 16 |
from chronos import ChronosPipeline
|
|
|
|
| 187 |
|
| 188 |
# Store results
|
| 189 |
results['borders'][border] = {
|
| 190 |
+
'median': np.median(forecast_numpy, axis=0).tolist(),
|
| 191 |
+
'q10': np.quantile(forecast_numpy, 0.1, axis=0).tolist(),
|
| 192 |
+
'q90': np.quantile(forecast_numpy, 0.9, axis=0).tolist(),
|
| 193 |
'inference_time_s': time.time() - border_start
|
| 194 |
}
|
| 195 |
|