ajbrock / Neural-Photo-Editor

A simple interface for editing natural photos with generative neural networks.
MIT License
2.08k stars 197 forks source link

CPU support #2

Open ruXlab opened 7 years ago

ruXlab commented 7 years ago

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?

ajbrock commented 7 years ago

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.

ajbrock commented 7 years ago

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.

dkandalov commented 7 years ago

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
ajbrock commented 7 years ago

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

dacb commented 6 years ago

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

ajbrock commented 6 years ago

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

dacb commented 6 years ago

Might want to update the README