You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/05/11 06:00:14 UTC

[GitHub] cvtower opened a new issue #10899: ctypes.c_int(ctx.device_id) TypeError: an integer is required

cvtower opened a new issue #10899: ctypes.c_int(ctx.device_id)     TypeError: an integer is required
URL: https://github.com/apache/incubator-mxnet/issues/10899
 
 
   ## Description
   (Brief description of the problem in no more than 2 sentences.)
   ctypes.c_int(ctx.device_id), TypeError: an integer is required
   
   ## Environment info (Required)
   python 2.7
   centos 7
   cuda 8.0
   cudnn 6.0
   mxnet-cu80 (1.1.0.post0)
   GPU:1080Ti
   pip list attached.
   [piplist.txt](https://github.com/apache/incubator-mxnet/files/1994106/piplist.txt)
   
   What to do:
   1. Download the repo from https://github.com/deepinsight/insightface#test-on-megaface.
   2. Download LResNet34E-IR model file:https://pan.baidu.com/s/1jKahEXw and copy into the models folder.
   step 2 could also use other models.
   
   ## Build info (Required if built from source)
   NAN.
   
   ## Error Message:
   loading ../models/model-r34-amf/model 0
   [05:37:56] src/nnvm/legacy_json_util.cc:190: Loading symbol saved by previous version v0.12.1. Attempting to upgrade...
   [05:37:56] src/nnvm/legacy_json_util.cc:198: Symbol successfully upgraded!
   Traceback (most recent call last):
     File "test.py", line 19, in <module>
       model = face_embedding.FaceModel(args)
     File "/root/Insightface_test/insightface-master/deploy/face_embedding.py", line 54, in __init__
       model.bind(data_shapes=[('data', (1, 3, image_size[0], image_size[1]))])
     File "/usr/local/lib/python2.7/dist-packages/mxnet/module/module.py", line 429, in bind
       state_names=self._state_names)
     File "/usr/local/lib/python2.7/dist-packages/mxnet/module/executor_group.py", line 264, in __init__
       self.bind_exec(data_shapes, label_shapes, shared_group)
     File "/usr/local/lib/python2.7/dist-packages/mxnet/module/executor_group.py", line 360, in bind_exec
       shared_group))
     File "/usr/local/lib/python2.7/dist-packages/mxnet/module/executor_group.py", line 638, in _bind_ith_exec
       shared_buffer=shared_data_arrays, **input_shapes)
     File "/usr/local/lib/python2.7/dist-packages/mxnet/symbol/symbol.py", line 1479, in simple_bind
       ctypes.c_int(ctx.device_id),
   TypeError: an integer is required
   
   ## Minimum reproducible example
   please see above ops
   
   ## Steps to reproduce
   
   cd deploy, run  python test.py.
   
   ## What have you tried to solve it?
   
   1. i debug and found the ctx.device_id is NULL. I guess setting the ctx.device_id to 0(I have been working with cuda/opencl for 8 years then i guess the ctx.device_id might be gpu id of the current ctx here) might work since gpu 0 is available now, and then:
   
   vim /usr/local/lib/python2.7/dist-packages/mxnet/symbol/symbol.py   +1479
   --     ctypes.c_int(ctx.device_id),
   ++   ctypes.c_int(0),
   
   and then the inference work fine and i got correct result.
   
   In fact, i used to work with tensorflow/keras/paddlepaddle and have not reviewed any detail code of mxnet yet. Personally. i guess the ctx.device_id is missing here, according to personal experience this is an common issue in sconscript related compiling tasks.
   
   Hope this will at least help someone.
   Thank you.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services