Hanjun-Dai / graph_comb_opt

Implementation of "Learning Combinatorial Optimization Algorithms over Graphs"
https://arxiv.org/abs/1704.01665
MIT License
496 stars 135 forks source link

Assertion failed when running run_nstep_dqn.sh #11

Closed svenhsia closed 5 years ago

svenhsia commented 5 years ago

Thank for this great work!

I tried to reproduce the results but encountered a problem when training with n-step Q learning.

I am running the code on Ubuntu 18.04 with Python 3.6.7 (anaconda). (I modified the Python2 code to run under Python 3). The compilation of GraphNN was successful and the examples are run correctly. The dynamic libraries are also built successfully with only some slight warnings. When I ran

cd code/s2v_mvc
./run_nstep_dqn.sh

I got

mem_size = 500000
num_env = 1
n_step = 2
min_n = 15
max_n = 20
max_iter = 1000000
dev_id = 0
max_bp_iter = 5
batch_size = 64
embed_dim = 64
learning_rate = 0.0001
w_scale = 0.01
l2_penalty = 0
momentum = 0.9
generating validation graphs
100%|██████████| 100/100 [00:00<00:00, 4412.46it/s]generating new training graphs
100%|██████████| 1000/1000 [00:00<00:00, 4410.58it/s]iter 0 eps 1.0 average size of vc:  10.79
iter 300 eps 0.9715 average size of vc:  16.5
Assertion `fid` failed in src/nn/param_set.cpp line 32: file  is not found
/home/sven/Study/GML/graph_comb_opt/code/s2v_mvc/mvc_lib/build/dll/libmvc.so(_ZN3gnn8ParamSetINS_3GPUEfE4SaveENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x1a5)[0x7f6e72430b25]
/home/sven/Study/GML/graph_comb_opt/code/s2v_mvc/mvc_lib/build/dll/libmvc.so(SaveModel+0x8b)[0x7f6e723bc40b]
/home/sven/Apps/miniconda3/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call_unix64+0x4c)[0x7f6e81440ec0]
/home/sven/Apps/miniconda3/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call+0x22d)[0x7f6e8144087d]
/home/sven/Apps/miniconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(_ctypes_callproc+0x2ce)[0x7f6e83ce4e4e]
/home/sven/Apps/miniconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(+0x13885)[0x7f6e83ce5885]
python(_PyObject_FastCallDict+0x8b)[0x563bd22be5bb]
python(+0x19cd6e)[0x563bd2347d6e]
python(_PyEval_EvalFrameDefault+0x30a)[0x563bd236a71a]
python(+0x196d8b)[0x563bd2341d8b]
terminate called without an active exception

Would you please help me to solve this problem? Thanks in advance.

svenhsia commented 5 years ago

Switching to Python 2.7 solved the problem.

6cdh commented 3 years ago

I encountered this issue too.

For people who would like to use Python3. Make c_char_p point to bytes to avoid this issue.

For example, convert

p = ctypes.cast(path_to_model, ctypes.c_char_p)

to

p = ctypes.cast(path_to_model.encode('utf-8'), ctypes.c_char_p)