Transformers
crypto
deep-learning
time-series
forecasting
transformer
state-space-models
open-source
scaling-laws
Instructions to use duonlabs/apogee-21.3M-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use duonlabs/apogee-21.3M-base with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("duonlabs/apogee-21.3M-base", dtype="auto") - Notebooks
- Google Colab
- Kaggle
Update handler.py
Browse files- handler.py +9 -0
handler.py
CHANGED
|
@@ -121,6 +121,15 @@ class EndpointHandler:
|
|
| 121 |
_, _, scenarios = self.tokenizer.decode(tokens)
|
| 122 |
scenarios = scenarios[:, -steps:]
|
| 123 |
print(f"Generated {n_scenarios} scenarios in {time.time() - t_start:.2f} seconds ⏱")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
return {
|
| 125 |
"timestamps": (timestamps[-1] + torch.arange(1, steps+1) * torch.median(torch.diff(timestamps)).item()).tolist(),
|
| 126 |
"open": scenarios[:, :, 0].tolist(),
|
|
|
|
| 121 |
_, _, scenarios = self.tokenizer.decode(tokens)
|
| 122 |
scenarios = scenarios[:, -steps:]
|
| 123 |
print(f"Generated {n_scenarios} scenarios in {time.time() - t_start:.2f} seconds ⏱")
|
| 124 |
+
print("Nans:", torch.isnan(scenarios).sum().item())
|
| 125 |
+
print("Infs:", torch.isinf(scenarios).sum().item())
|
| 126 |
+
high_not_highest = (scenarios[..., :4].max(-1).values > scenarios[..., 1])
|
| 127 |
+
low_not_lowest = (scenarios[..., :4].min(-1).values < scenarios[..., 2])
|
| 128 |
+
invalid_candle = high_not_highest | low_not_lowest
|
| 129 |
+
print("Highest not high rate:", high_not_highest.float().mean().item())
|
| 130 |
+
print("Lowest not low rate:", low_not_lowest.float().mean().item())
|
| 131 |
+
print("Invalid candles rate:", invalid_candle.float().mean().item())
|
| 132 |
+
print("Invalid scenario rate:", invalid_candle.any(dim=-1).float().mean().item())
|
| 133 |
return {
|
| 134 |
"timestamps": (timestamps[-1] + torch.arange(1, steps+1) * torch.median(torch.diff(timestamps)).item()).tolist(),
|
| 135 |
"open": scenarios[:, :, 0].tolist(),
|