-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexp_basic.py
executable file
·42 lines (34 loc) · 1.12 KB
/
exp_basic.py
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
import os
import torch
# from models import Autoformer, Transformer, TimesNet, Nonstationary_Transformer, DLinear, FEDformer, \
# Informer, LightTS, Reformer, ETSformer, Pyraformer, PatchTST, MICN
from models import LLM4HRSI
class Exp_Basic(object):
def __init__(self, args):
self.args = args
self.model_dict = {
'LLM4HRSI': LLM4HRSI,
}
self.device = self._acquire_device()
self.model = self._build_model().to(self.device)
def _build_model(self):
raise NotImplementedError
return None
def _acquire_device(self):
if self.args.use_gpu:
os.environ["CUDA_VISIBLE_DEVICES"] = str(
self.args.gpu) if not self.args.use_multi_gpu else self.args.devices
device = torch.device('cuda:{}'.format(self.args.gpu))
print('Use GPU: cuda:{}'.format(self.args.gpu))
else:
device = torch.device('cpu')
print('Use CPU')
return device
def _get_data(self):
pass
def vali(self):
pass
def train(self):
pass
def test(self):
pass