-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtools.py
More file actions
43 lines (29 loc) · 1018 Bytes
/
tools.py
File metadata and controls
43 lines (29 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from __future__ import annotations
import numpy as np
# Underlying implementations
from local_model_predictor import (
InferenceInterface,
)
import config
class ViTimePredictor:
"""Thin wrapper around the underlying inference interface.
Initializes model weights from `config.VITIME_MODEL_PATH` and exposes
a callable that maps a time series and `future_length` to predictions.
"""
def __init__(
self,
device: str = 'cuda:0',
model_name: str = 'MAE',
tempature=1,
) -> None:
model_path_env = config.VITIME_MODEL_PATH
self.tempature=tempature
self._iface = InferenceInterface(model_path_env, model_name=model_name, device=device)
def __call__(self, time_series, future_length,sampleNumber) -> np.ndarray:
pred = self._iface.inference(
np.asarray(time_series),
future_length,
sampleNumber,
tempature=self.tempature
)
return pred