Spaces:
Paused
Paused
Tonic commited on
Commit ·
548b797
1
Parent(s): 20791aa
move all model and components to cuda
Browse files
app.py
CHANGED
|
@@ -60,7 +60,7 @@ def load_pipeline():
|
|
| 60 |
print("Loading Chronos model...")
|
| 61 |
pipeline = ChronosPipeline.from_pretrained(
|
| 62 |
"amazon/chronos-t5-large",
|
| 63 |
-
device_map="
|
| 64 |
torch_dtype=torch.float16,
|
| 65 |
low_cpu_mem_usage=True,
|
| 66 |
trust_remote_code=True,
|
|
@@ -365,6 +365,10 @@ def make_prediction(symbol: str, timeframe: str = "1d", prediction_days: int = 5
|
|
| 365 |
for buffer in pipe.model.buffers():
|
| 366 |
buffer.data = buffer.data.to(device)
|
| 367 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 368 |
# Use predict_quantiles with proper formatting
|
| 369 |
quantiles, mean = pipe.predict_quantiles(
|
| 370 |
context=context,
|
|
|
|
| 60 |
print("Loading Chronos model...")
|
| 61 |
pipeline = ChronosPipeline.from_pretrained(
|
| 62 |
"amazon/chronos-t5-large",
|
| 63 |
+
device_map="auto", # Let the model decide the best device mapping
|
| 64 |
torch_dtype=torch.float16,
|
| 65 |
low_cpu_mem_usage=True,
|
| 66 |
trust_remote_code=True,
|
|
|
|
| 365 |
for buffer in pipe.model.buffers():
|
| 366 |
buffer.data = buffer.data.to(device)
|
| 367 |
|
| 368 |
+
# Ensure the distribution head is properly initialized
|
| 369 |
+
if hasattr(pipe.model, 'distribution_head'):
|
| 370 |
+
pipe.model.distribution_head = pipe.model.distribution_head.to(device)
|
| 371 |
+
|
| 372 |
# Use predict_quantiles with proper formatting
|
| 373 |
quantiles, mean = pipe.predict_quantiles(
|
| 374 |
context=context,
|