Spaces:
Sleeping
Sleeping
Evgueni Poloukarov
commited on
Commit
·
f197da0
1
Parent(s):
cfde20b
feat: add comprehensive error tracking with full tracebacks
Browse files- Capture exception type and full traceback for better debugging
- Include traceback in debug files for failed forecasts
- Bump version to v1.0.4 for deployment tracking
- This will help diagnose the mysterious empty error messages
src/forecasting/chronos_inference.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
"""
|
| 3 |
Chronos-2 Inference Pipeline
|
| 4 |
Standalone inference script for HuggingFace Space deployment.
|
| 5 |
-
FORCE REBUILD: v1.0.
|
| 6 |
"""
|
| 7 |
|
| 8 |
import os
|
|
@@ -172,7 +172,7 @@ class ChronosInferencePipeline:
|
|
| 172 |
|
| 173 |
# Get target column name (note: dynamic_forecast renames it to 'target')
|
| 174 |
target_col = 'target'
|
| 175 |
-
print(f"[DEBUG v1.0.
|
| 176 |
|
| 177 |
# Extract context values
|
| 178 |
context = context_data[target_col].values
|
|
@@ -198,8 +198,12 @@ class ChronosInferencePipeline:
|
|
| 198 |
print(f" ✓ Complete in {time.time() - border_start:.1f}s")
|
| 199 |
|
| 200 |
except Exception as e:
|
| 201 |
-
|
| 202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
|
| 204 |
# Add summary metadata
|
| 205 |
results['metadata']['total_time_s'] = time.time() - total_start
|
|
@@ -317,6 +321,8 @@ def run_inference(
|
|
| 317 |
for border, data in results['borders'].items():
|
| 318 |
if 'error' in data:
|
| 319 |
f.write(f" {border}: ERROR - {data['error']}\n")
|
|
|
|
|
|
|
| 320 |
else:
|
| 321 |
f.write(f" {border}: OK\n")
|
| 322 |
f.write(f" median count: {len(data.get('median', []))}\n")
|
|
|
|
| 2 |
"""
|
| 3 |
Chronos-2 Inference Pipeline
|
| 4 |
Standalone inference script for HuggingFace Space deployment.
|
| 5 |
+
FORCE REBUILD: v1.0.4
|
| 6 |
"""
|
| 7 |
|
| 8 |
import os
|
|
|
|
| 172 |
|
| 173 |
# Get target column name (note: dynamic_forecast renames it to 'target')
|
| 174 |
target_col = 'target'
|
| 175 |
+
print(f"[DEBUG v1.0.4] Using target_col='{target_col}', columns available: {list(context_data.columns)}", flush=True)
|
| 176 |
|
| 177 |
# Extract context values
|
| 178 |
context = context_data[target_col].values
|
|
|
|
| 198 |
print(f" ✓ Complete in {time.time() - border_start:.1f}s")
|
| 199 |
|
| 200 |
except Exception as e:
|
| 201 |
+
import traceback
|
| 202 |
+
error_msg = f"{type(e).__name__}: {str(e)}"
|
| 203 |
+
traceback_str = traceback.format_exc()
|
| 204 |
+
print(f" ✗ Error: {error_msg}", flush=True)
|
| 205 |
+
print(f"Traceback:\n{traceback_str}", flush=True)
|
| 206 |
+
results['borders'][border] = {'error': error_msg, 'traceback': traceback_str}
|
| 207 |
|
| 208 |
# Add summary metadata
|
| 209 |
results['metadata']['total_time_s'] = time.time() - total_start
|
|
|
|
| 321 |
for border, data in results['borders'].items():
|
| 322 |
if 'error' in data:
|
| 323 |
f.write(f" {border}: ERROR - {data['error']}\n")
|
| 324 |
+
if 'traceback' in data:
|
| 325 |
+
f.write(f"\nFull Traceback:\n{data['traceback']}\n")
|
| 326 |
else:
|
| 327 |
f.write(f" {border}: OK\n")
|
| 328 |
f.write(f" median count: {len(data.get('median', []))}\n")
|