質問編集履歴

1

コード,マシンスペックの追加

2021/07/13 08:33

投稿

OakNot
OakNot

スコア0

test CHANGED
File without changes
test CHANGED
@@ -16,6 +16,80 @@
16
16
 
17
17
 
18
18
 
19
+ ### コード (pseudo)
20
+
21
+ コードの概要部分のみをpseudo code likeに記します.
22
+
23
+
24
+
25
+ ```python 3.7
26
+
27
+ import torch
28
+
29
+ from torch.utils.data import DataLoader
30
+
31
+ from torch.optim import Adam
32
+
33
+ from torch.cuda import amp
34
+
35
+ import gc
36
+
37
+
38
+
39
+ train_set, valid_set, test_set = load_dataset( input_file )
40
+
41
+
42
+
43
+ train_loader = DataLoader( dataset=train_set, batch_size=batch_size )
44
+
45
+ valid_loader = DataLoader( dataset=valid_set, batch_size=batch_size )
46
+
47
+ test_loader = DataLoader( dataset=test_set, batch_size=batch_size )
48
+
49
+
50
+
51
+ mode = MyModel( parameters )
52
+
53
+
54
+
55
+ loss_criterion = torch.nn.BCEWithLogitsLoss( reduction='none' )
56
+
57
+ oprimizer = Adam( model.parameters(), lr=..., weight_decay=... )
58
+
59
+ stopper = EarlyStopper( parameters )
60
+
61
+
62
+
63
+ model.to( 'cuda:0' )
64
+
65
+
66
+
67
+ for epoch in range( n_epochs ):
68
+
69
+
70
+
71
+ train_score = train( model, train_loader, loss_criterion, optimizer )
72
+
73
+ valid_score = eval( model, valid_loader )
74
+
75
+
76
+
77
+ early_stop = stopper.step( valid_score, model )
78
+
79
+ gc.collect()
80
+
81
+
82
+
83
+ print( train_score, valid_score )
84
+
85
+
86
+
87
+ ```
88
+
89
+ 学習自体は問題なく進むのですが,epochが進むにつれてじわじわとRAM使用率が上昇していってしまいます.
90
+
91
+
92
+
19
93
  ### 環境など
20
94
 
21
95
 
@@ -25,3 +99,11 @@
25
99
  PyTorch 1.7.0
26
100
 
27
101
  DGL 0.6
102
+
103
+
104
+
105
+ CPU Intel Core i9
106
+
107
+ RAM 32GB
108
+
109
+ GPU NVidia GeForce RTX 3070