cooooorn / Pytorch-XNOR-Net

XNOR-Net, with binary gemm and binary conv2d kernels, support both CPU and GPU.
BSD 3-Clause "New" or "Revised" License
79 stars 21 forks source link

No module named 'binop' #1

Open aoreskovic opened 6 years ago

aoreskovic commented 6 years ago

No matter what i try, I can run the training. I have tried compiling binop, and it compiles fine, but running doenst work:

on Ubuntu LTS 18.04: (Python 3.6, Pytorch 4.0, no GPU)

python3 main.py --arch Bin_LeNet
Traceback (most recent call last):
  File "main.py", line 18, in <module>
    import models as models
  File "/home/aoreskovic/GitHub/Pytorch-XNOR-Net-master/MNIST/models/__init__.py", line 2, in <module>
    from .Bin_LeNet import Bin_LeNet_test
  File "/home/aoreskovic/GitHub/Pytorch-XNOR-Net-master/MNIST/models/Bin_LeNet.py", line 6, in <module>
    from util import BinLinear
  File "../util/__init__.py", line 1, in <module>
    from .util import *
  File "../util/util.py", line 1, in <module>
    import binop
ModuleNotFoundError: No module named 'binop'

on Win10: (Python 3.6, Pytorch 4.0, no GPU)

python main.py --arch Bin_LeNet
Traceback (most recent call last):
  File "main.py", line 18, in <module>
    import models as models
  File "H:\Dropbox\NeuralXNOR\Pytorch-XNOR-Net\MNIST\models\__init__.py", line 2, in <module>
    from .Bin_LeNet import Bin_LeNet_test
  File "H:\Dropbox\NeuralXNOR\Pytorch-XNOR-Net\MNIST\models\Bin_LeNet.py", line 6, in <module>
    from util import BinLinear
  File "..\util\__init__.py", line 1, in <module>
    from .util import *
  File "..\util\util.py", line 1, in <module>
    import binop
  File "..\binop\__init__.py", line 3, in <module>
    from ._binop import lib as _lib, ffi as _ffi
ModuleNotFoundError: No module named 'binop._binop'

It looks like there should be some module named binop.py that acts like a wrapper for _binop, but that isnt generated?

cooooorn commented 6 years ago

try ./make.sh , and run the training.

cooooorn commented 6 years ago

and if you use Pytorch 0.4.0, it will be very slow, because the usage of .data. for more details, you can read PyTorch 0.4.0 release notes.

weitianli commented 5 years ago

When I run the training, I also meet the problem above. I try ./make.sh. But I such a problem.

on Ubuntu 16.04, (Python 3.5, Pytorch 0.4.1, gcc 5.4, CUDA 9.0)

_binop.c:28:20: fatal error: Python.h: No such file or directory
compilation terminated.
Traceback (most recent call last):
  File "/usr/lib/python3.5/distutils/unixccompiler.py", line 118, in _compile
    extra_postargs)
  File "/usr/lib/python3.5/distutils/ccompiler.py", line 909, in spawn
    spawn(cmd, dry_run=self.dry_run)
  File "/usr/lib/python3.5/distutils/spawn.py", line 36, in spawn
    _spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/usr/lib/python3.5/distutils/spawn.py", line 159, in _spawn_posix
    % (cmd, exit_status))
distutils.errors.DistutilsExecError: command 'x86_64-linux-gnu-gcc' failed with exit status 1
weitianli commented 5 years ago

I solved the problem that I used Pytorch 0.4.0 version. But I met a new problem.

Traceback (most recent call last):
  File "main.py", line 19, in <module>
    import binop
  File "../binop/__init__.py", line 3, in <module>
    from ._binop import lib as _lib, ffi as _ffi
ImportError: dynamic module does not define module export function (PyInit__binop)

How to figure it out?

FITZET commented 6 days ago

here are the extensions for C++, cuda and numpy, maybe it'll work:https://github.com/pminhtam/xnor_conv_pytorch_extension