dgl._ffi.base.DGLError: [14:39:47] - PullRequest
       29

dgl._ffi.base.DGLError: [14:39:47]

0 голосов
/ 13 июля 2020

У меня есть вопрос по исправлению ошибки.
Я пытаюсь построить модель, которая объединяет структуру CNN и структуру GCN.
Я использовал dgl для модели GCN в среде pytorch.
Ввод модели состоит из изображения и графика. изображение размером 100 на 100 изображений.

Структура модели

self.CNN = nn.Sequential(
                                nn.Conv2d(input_channel_1,output_channel_1,kernel_size_1,stride=stride_1),
                                nn.ReLU(),
                                nn.MaxPool2d(2),
                                nn.Conv2d(input_channel_2,output_channel_2,kernel_size_2,stride=stride_2),
                                nn.ReLU(),
                                nn.MaxPool2d(2),
                                nn.Conv2d(input_channel_3,output_channel_3,kernel_size_3,stride=stride_3),
                                nn.ReLU(),
                                nn.MaxPool2d(2),
                                nn.Flatten()
                                )

        # GCN layer for updating node embedding
        self.GCN = nn.ModuleList([
                                GraphConv(node_dimension_0, node_dimension_1),
                                GraphConv(node_dimension_1, node_dimension_2)
                                ])

        # classifier layer
        self.classifier = nn.Sequential(
                                nn.Linear(node_dimension_2,num_class)
                                )

Среды

pytorch               1.5.1
dgl                   dgl-cu102
torch-cluster         1.5.4
torch-geometric       1.5.0
torch-scatter         2.0.4
torch-sparse          0.6.1
torch-spline-conv     1.2.0
torchvision           0.6.0a0+35d732a
python                3.7.7
cuda                  10.2

ОШИБКА

Traceback (most recent call last):
  File "main.py", line 85, in <module>
    model_predict = NET(tt_X, tt_graph)[:3600]
  File "/home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/admin/project/Landcover/Landcover.py", line 81, in forward
    hidden = self.GCN[0](graph, node_feature)
  File "/home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/nn/pytorch/conv/graphconv.py", line 151, in forward
    fn.sum(msg='m', out='h'))
  File "/home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/graph.py", line 3238, in update_all
    Runtime.run(prog)
  File "/home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/runtime/runtime.py", line 11, in run
    exe.run()
  File "/home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/runtime/ir/executor.py", line 1191, in run
    graph = self.graph.data(ctx)
  File "/home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/graph.py", line 4336, in get_immutable_gidx
    return self.graph._graph.get_immutable_gidx(ctx)
  File "/home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/utils.py", line 452, in wrapper
    dic[key] = func(self, *args, **kwargs)
  File "/home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/graph_index.py", line 670, in get_immutable_gidx
    return self.to_immutable().asbits(self.bits_needed()).copy_to(ctx)
  File "/home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/graph_index.py", line 882, in copy_to
    return _CAPI_DGLImmutableGraphCopyTo(self, ctx.device_type, ctx.device_id)
  File "dgl/_ffi/_cython/./function.pxi", line 287, in dgl._ffi._cy3.core.FunctionBase.__call__
  File "dgl/_ffi/_cython/./function.pxi", line 222, in dgl._ffi._cy3.core.FuncCall
  File "dgl/_ffi/_cython/./function.pxi", line 211, in dgl._ffi._cy3.core.FuncCall3
  File "dgl/_ffi/_cython/./base.pxi", line 155, in dgl._ffi._cy3.core.CALL
dgl._ffi.base.DGLError: [14:39:47] /opt/dgl/src/runtime/cuda/cuda_device_api.cc:97: Check failed: e == cudaSuccess || e == cudaErrorCudartUnloading: CUDA: out of memory
Stack trace:
  [bt] (0) /home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/libdgl.so(dgl::runtime::CUDADeviceAPI::AllocDataSpace(DLContext, unsigned long, unsigned long, DLDataType)+0xdc6) [0x7f0f93fbe3f6]
  [bt] (1) /home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/libdgl.so(dgl::runtime::NDArray::Empty(std::vector<long, std::allocator<long> >, DLDataType, DLContext)+0x289) [0x7f0f93eaf939]
  [bt] (2) /home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/libdgl.so(dgl::runtime::NDArray::CopyTo(DLContext const&) const+0xb7) [0x7f0f93f19627]
  [bt] (3) /home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/libdgl.so(dgl::CSR::CopyTo(DLContext const&) const+0x43) [0x7f0f93f0fe23]
  [bt] (4) /home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/libdgl.so(dgl::ImmutableGraph::CopyTo(std::shared_ptr<dgl::ImmutableGraph>, DLContext const&)+0x5b) [0x7f0f93f163bb]
  [bt] (5) /home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/libdgl.so(+0xd43513) [0x7f0f93f17513]
  [bt] (6) /home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/libdgl.so(DGLFuncCall+0x52) [0x7f0f93e8d872]
  [bt] (7) /home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/_ffi/_cy3/core.cpython-37m-x86_64-linux-gnu.so(+0x19cdb) [0x7f0f91fb9cdb]
  [bt] (8) /home/admin/anaconda3/envs/Landsat/lib/python3.7/site-packages/dgl/_ffi/_cy3/core.cpython-37m-x86_64-linux-gnu.so(+0x1a25b) [0x7f0f91fba25b]

Не могли бы вы помочь мне исправить ошибку? Спасибо

...