ajbrock / Neural-Photo-Editor

A simple interface for editing natural photos with generative neural networks.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CPU support

ruXlab opened this issue · comments

commented

Hello

Thanks for releasing source code. I've got problem while running script on laptop without cuda gpu:

Traceback (most recent call last):
  File "NPE.py", line 57, in <module>
    config_module = imp.load_source('config',config_path)
  File "IAN_simple.py", line 10, in <module>
    import lasagne.layers.dnn
  File "/usr/local/lib/python2.7/dist-packages/lasagne/layers/dnn.py", line 14, in <module>
    "requires GPU support -- see http://lasagne.readthedocs.org/en/"
ImportError: requires GPU support -- see http://lasagne.readthedocs.org/en/latest/user/installation.html#gpu-support

How can I enforce CPU mode?

If you remove all my explicit conv2DDNNLayer calls (aliased as C2D) and replace them with standard Conv2D layer calls it should work, but keep in mind that those DeconvLayers are adapted from Radford's DCGAN and make explicit DNN calls, so you would need some workaround for that as I don't think the TransposedConv2D layer will work identically (what with the 5x5 kernels in the DeconvLayers). I've had trouble with it in the past.

I've added support for not explicitly making DNN calls, so you should, presumably, be able to try running this on CPU. At the very least, it shouldn't crash.

Looks like it still fails:

Traceback (most recent call last):
  File "NPE.py", line 53, in <module>
    model = IAN(config_path = 'IAN_simple.py', dnn = True)
  File "API.py", line 21, in __init__
    self.model = config_module.get_model(dnn=dnn)
  File "IAN_simple.py", line 58, in get_model
    import lasagne.layers.dnn
  File "/usr/local/lib/python2.7/site-packages/lasagne/layers/dnn.py", line 15, in <module>
    "requires GPU support -- see http://lasagne.readthedocs.org/en/"
ImportError: requires GPU support -- see http://lasagne.readthedocs.org/en/latest/user/installation.html#gpu-support

@dkandalov Change the dnn=True line on line 53 to dnn=False, and it won't attempt to import cuDNN.

commented

@ajbrock It appears the correct line for this change is 18.

Yes, following a commit after the above comments, the proper line for this is now 18.

commented

Might want to update the README