INK-USC / RE-Net

Recurrent Event Network: Autoregressive Structure Inference over Temporal Knowledge Graphs (EMNLP 2020)
http://inklab.usc.edu/renet/
435 stars 95 forks source link

Compilation environment problems #40

Closed fangyiming closed 3 years ago

fangyiming commented 3 years ago

Hello, do you need the same environment to run? My code is PORch1.7, Torchversion0.8.1, PYTHon3.7, DGL-CUDa11.0 0.5.3, and numpy1.19.2. There are errors in the direct running code.First, there was a problem when pickling. Load was reading TXT data during pre-training. Then I changed it to PKL file.There is no keys method or number_of_nodes etc

woojeongjin commented 3 years ago

Hi there might be errors if you use the latest version of DGL. To run our code safely, you should follow the instruction for installation. DGL should be < 0.5.

fangyiming commented 3 years ago

Hello, thank you for your patience. I reconfigured the environment according to your introduction, but there was an error: dgl._ffi.base.DGLError: [20:10:12] C:\Users\Administrator\dgl\src\runtime\c_runtime_api.cc:87: Check failed: allow_missing: Device API gpu is not enabled.

My environmental information is dgl             0.4.1 dgl-cuda10.1    0.4.3.post2 numpy           1.19.2 scikit-learn    0.23.2 scipy           1.5.2 sklearn         0.0 threadpoolctl   2.1.0 torch           1.6.0 torchvision     0.7.0

The command used is

python pretrain.py -d ICEWS14 --gpu 0 --dropout 0.5 --n-hidden 200 --lr 1e-3 --max-epochs 20 --batch-size 1024 Thank you again for your patience.

------------------ 原始邮件 ------------------ 发件人: "INK-USC/RE-Net" <notifications@github.com>; 发送时间: 2020年12月18日(星期五) 下午4:56 收件人: "INK-USC/RE-Net"<RE-Net@noreply.github.com>; 抄送: "房意明"<1043630181@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [INK-USC/RE-Net] Compilation environment problems (#40)

Hi there might be errors if you use the latest version of DGL. To run our code safely, you should follow the instruction for installation. DGL should be < 0.5.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

fangyiming commented 3 years ago

Traceback (most recent call last): File "pretrain.py", line 155, in train(args) File "pretrain.py", line 98, in train loss = model(batch_data, true_s, true_o, graph_dict) File "D:\Anaconda3\envs\renet1\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl result = self.forward(*input, kwargs) File "D:\PyCode\RE-Net\global_model.py", line 47, in forward packed_input = self.aggregator(sorted_t, self.ent_embeds, graph_dict, reverse=reverse) File "D:\Anaconda3\envs\renet1\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl result = self.forward(*input, *kwargs) File "D:\PyCode\RE-Net\Aggregator.py", line 420, in forward self.rgcn1(batched_graph, reverse) File "D:\Anaconda3\envs\renet1\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl result = self.forward(input, kwargs) File "D:\PyCode\RE-Net\RGCN.py", line 39, in forward self.propagate(g, reverse) File "D:\PyCode\RE-Net\RGCN.py", line 91, in propagate g.update_all(lambda x: self.msg_func(x, reverse), fn.sum(msg='msg', out='h'), self.apply_func) File "D:\PyCode\RE-Net\dgl\graph.py", line 2747, in update_all Runtime.run(prog) File "D:\PyCode\RE-Net\dgl\runtime\runtime.py", line 11, in run exe.run() File "D:\PyCode\RE-Net\dgl\runtime\ir\executor.py", line 1191, in run graph = self.graph.data(ctx) File "D:\PyCode\RE-Net\dgl\graph.py", line 3557, in get_immutable_gidx return self.graph._graph.get_immutable_gidx(ctx) File "D:\PyCode\RE-Net\dgl\utils\internal.py", line 482, in wrapper dic[key] = func(self, *args, **kwargs) File "D:\PyCode\RE-Net\dgl\graph_index.py", line 652, in get_immutable_gidx return self.to_immutable().asbits(self.bits_needed()).copy_to(ctx) File "D:\PyCode\RE-Net\dgl\graph_index.py", line 863, in copy_to return _CAPI_DGLImmutableGraphCopyTo(self, ctx.device_type, ctx.device_id) File "D:\PyCode\RE-Net\dgl_ffi_ctypes\function.py", line 190, in call ctypes.byref(ret_val), ctypes.byref(ret_tcode))) File "D:\PyCode\RE-Net\dgl_ffi\base.py", line 62, in check_call raise DGLError(py_str(_LIB.DGLGetLastError())) dgl._ffi.base.DGLError: [14:47:39] C:\Users\Administrator\dgl\src\runtime\c_runtime_api.cc:87: Check failed: allow_missing: Device API gpu is not enabled.

woojeongjin commented 3 years ago

Hi, I found a similar error here.

They said first try uninstalling DGL and then reinstalling GPU enabled DGL. It’s possible that you have multiple versions of DGL installed and the one you import is actually a version without GPU support.

Thanks!

fangyiming commented 3 years ago

Hello, I tried to uninstall and reinstall DGL-CUDa10.1, and uninstalled other versions of DGL, but the same information was reported. The DGL version should be less than 0.5, right? I tried 0.4.1 and 0.4.3, but they were not ok. I really don't know how to do it. Which version do you use? thank you

------------------ 原始邮件 ------------------ 发件人: "INK-USC/RE-Net" <notifications@github.com>; 发送时间: 2020年12月20日(星期天) 下午2:55 收件人: "INK-USC/RE-Net"<RE-Net@noreply.github.com>; 抄送: "房意明"<1043630181@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [INK-USC/RE-Net] Compilation environment problems (#40)

Hi, I found a similar error here.

They said first try uninstalling DGL and then reinstalling GPU enabled DGL. It’s possible that you have multiple versions of DGL installed and the one you import is actually a version without GPU support.

Thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

woojeongjin commented 3 years ago

My torch version is 1.6.0+cu101 and DGL version is 0.4.3post2. My code runs well on my local. Do you have the same error again?

fangyiming commented 3 years ago

Yes, I have tried a new version. Even if the environment is the same as yours, it is still the same problem. I changed a computer and used the same configuration environment, which is the same problem.

------------------ 原始邮件 ------------------ 发件人: "INK-USC/RE-Net" <notifications@github.com>; 发送时间: 2020年12月20日(星期天) 下午3:32 收件人: "INK-USC/RE-Net"<RE-Net@noreply.github.com>; 抄送: "房意明"<1043630181@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [INK-USC/RE-Net] Compilation environment problems (#40)

My torch version is 1.6.0+cu101 and DGL version is 0.4.3post2. My code runs well on my local. Do you have the same error again?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

fangyiming commented 3 years ago

I just re-git your code, and then there is no train_graphs. txt file in the folder of data, so the code will report an error。

with open('./data/' + args.dataset + '/train_graphs.txt', 'rb') as f:

    with open('./data/' + args.dataset + '/train.pkl', 'rb') as f:         graph_dict = pickle.load(f)

Then I tried to change it to train.txt。I got an error:

Traceback (most recent call last):   File "pretrain.py", line 140, in <module>     train(args)   File "pretrain.py", line 56, in train     graph_dict = pickle.load(f) _pickle.UnpicklingError: unpickling stack underflow

I tried to convert TXT to a PKL file: data = np.loadtxt('./data/' + args.dataset + '/train.txt', dtype=np.float32)     with open('./data/' + args.dataset + '/train.pkl', 'wb') as handle:         pickle.dump(data,handle)

Then came a new error:

Traceback (most recent call last):   File "pretrain.py", line 140, in <module>     train(args)   File "pretrain.py", line 84, in train     loss = model(batch_data, true_s, true_o, graph_dict)   File "D:\Anaconda3\envs\renet1\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl     result = self.forward(*input, *kwargs)   File "D:\PyCode\NEW\RE-Net\global_model.py", line 47, in forward     packed_input = self.aggregator(sorted_t, self.ent_embeds, graph_dict, reverse=reverse)   File "D:\Anaconda3\envs\renet1\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl     result = self.forward(input, **kwargs)   File "D:\PyCode\NEW\RE-Net\Aggregator.py", line 28, in forward     times = list(graph_dict.keys()) AttributeError: 'numpy.ndarray' object has no attribute 'keys'

I got the TransE data from Github and got the train_graphs. txt file under ICEWS14。 Only when reading the file train_graphs. TXT will he report an error: Only when reading the document train_graphs. txt under ICEWS14, he will report an error in the situation I communicated with you before, so the GPU is unenable.

This is all the problems I have encountered running your code. Thank you for your patient reply. Thank you very, very much!

------------------ 原始邮件 ------------------ 发件人: "INK-USC/RE-Net" <notifications@github.com>; 发送时间: 2020年12月20日(星期天) 下午3:32 收件人: "INK-USC/RE-Net"<RE-Net@noreply.github.com>; 抄送: "房意明"<1043630181@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [INK-USC/RE-Net] Compilation environment problems (#40)

My torch version is 1.6.0+cu101 and DGL version is 0.4.3post2. My code runs well on my local. Do you have the same error again?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

woojeongjin commented 3 years ago

Hi! You should run the following before training to create train_graphs.txt

cd data/DATA_NAME | python3 get_history_graph.py

Then it will create 'train_graphs.txt' in the data folder.

Thanks!