-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIncremental_train.py
36 lines (23 loc) · 1.21 KB
/
Incremental_train.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
import model_graph_old as model
import torch
class BaoTrainingException(Exception):
pass
def train_and_save_model(fn, verbose=True, emphasize_experiments=0):
reg = model.BaoRegression(have_cache_data=True, verbose=verbose)
reg.load("./model/model_imdb_time_4layer_gpu")
reg.incremental_train("./data/incremental/graph/train000.txt", "./data/incremental/graph/part0.txt", fn)
#reg.save(fn)
return reg
if __name__ == "__main__":
allocated = torch.cuda.memory_allocated()
print(f"Current GPU memory allocated: {allocated} bytes")
train_and_save_model("./model/model_incremental_feature_test")
max_allocated = torch.cuda.max_memory_allocated()
print(f"Max GPU memory allocated: {max_allocated} bytes")
print("Incremental training, attempting load...")
# model_plansql.to('cuda:0') # 移动模型到cuda
reg = model.BaoRegression(have_cache_data=True, verbose=True)
#reg.load("./model/model_incremental_feature0andtrain")
#reg.load("./model/model_imdb_time_4layer_gpu")
#reg.incremental_train("./data/incremental/feature/feation000.txt", "./data/incremental/feature/feature1.txt", "./model/model_incremental_feature1")
#10-2000 20-1000 30- -0.002 25-2000 8-4000