rikdz / GraphWriter

Code for "Text Generation from Knowledge Graphs with Graph Transformers"
517 stars 90 forks source link

CUDA out of memory. #7

Open sjzabc opened 5 years ago

sjzabc commented 5 years ago

~/桌面/GraphWriter-master$ python3.6 train.py -save res Save File Exists, OverWrite? for no Loading Data from data/preprocessed.train.tsv building vocab done Sorting training data by len ds sizes: 11880 26156 684 1000 Vocab sizes: src 6343 ent 53343 nerd 8 rel 17 out 11738 graph cuda:0 epoch 0 lr 0.1 Training 1 /home/ryf/桌面/GraphWriter-master/models/last_graph.py:75: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requiresgrad(True), rather than torch.tensor(sourceTensor). ngraph = torch.tensor(vgraph.repeat(N,1).view(N,N,-1),requires_grad=False) /home/ryf/桌面/GraphWriter-master/models/newmodel.py:62: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requiresgrad(True), rather than torch.tensor(sourceTensor). cx = torch.tensor(hx) Traceback (most recent call last): File "train.py", line 130, in main(args) File "train.py", line 115, in main train(m,o,ds,args) File "train.py", line 32, in train p,z,planlogits = m(b) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, kwargs) File "/home/ryf/桌面/GraphWriter-master/models/newmodel.py", line 96, in forward _, z = self.mattn(l,(ents,entlens)) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, *kwargs) File "/home/ryf/桌面/GraphWriter-master/models/attention.py", line 15, in forward decsmall = self.attnlin(dec) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(input, kwargs) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/linear.py", line 87, in forward return F.linear(input, self.weight, self.bias) File "/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py", line 1371, in linear output = input.matmul(weight.t()) RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 2.95 GiB total capacity; 2.41 GiB already allocated; 14.19 MiB free; 51.57 MiB cached)

rikdz commented 5 years ago

Reduce batch sizes with -t1size -t2size -t3size flags

wutaiqiang commented 4 years ago

推荐使用TiTAN X