Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: out of memory #26

Open
nishantprateek opened this issue Dec 6, 2015 · 5 comments
Open

ValueError: out of memory #26

nishantprateek opened this issue Dec 6, 2015 · 5 comments

Comments

@nishantprateek
Copy link

I am trying to run the neural_artistic_Style code. I get the following error on the example images:

Traceback (most recent call last):
File "neural_artistic_style.py", line 139, in
run()
File "neural_artistic_style.py", line 131, in run
cost = np.mean(net.update())
File "/home/nishant/neural_artistic_style-master/style_network.py", line 130, in update
next_x = layer.fprop(next_x)
File "/home/nishant/neural_artistic_style-master/style_network.py", line 18, in fprop
y = self.conv_op.fprop(x, self.weights.array)
File "/usr/local/lib/python2.7/dist-packages/cudarray-0.1.dev0-py2.7-linux-x86_64.egg/cudarray/nnet/conv.py", line 36, in fprop
convout = ca.empty(convout_shape, dtype=imgs.dtype)
File "/usr/local/lib/python2.7/dist-packages/cudarray-0.1.dev0-py2.7-linux-x86_64.egg/cudarray/cudarray.py", line 246, in empty
return ndarray(shape, dtype=dtype)
File "/usr/local/lib/python2.7/dist-packages/cudarray-0.1.dev0-py2.7-linux-x86_64.egg/cudarray/cudarray.py", line 36, in init
self._data = ArrayData(self.size, dtype, np_data)
File "cudarray/wrap/array_data.pyx", line 16, in cudarray.wrap.array_data.ArrayData.init (./cudarray/wrap/array_data.cpp:1401)
File "cudarray/wrap/cudart.pyx", line 12, in cudarray.wrap.cudart.cudaCheck (./cudarray/wrap/cudart.cpp:763)
ValueError: out of memory

I also tried running the code on some images of my own. I am getting this error on them:
terminate called after throwing an instance of 'std::runtime_error'
what(): src/image/img2win.cu:56: invalid configuration argument
Aborted (core dumped)

Any idea how to fix either?

@filmo
Copy link

filmo commented Dec 6, 2015

Use a smaller source and/or style image. Unless your GPU has a lot of memory, you'll only be able to work with smaller images. On my 1GB Geforce 650M, I can only get it to work up to about 400x300 pixel images. Image complexity and style complexity also seem to factor in. For some I have to go even smaller than that.

One of my classmates experimented using a K80 and was able to get 1600 x 1197 to work, another using an older M2090 topped out around 800 x 600.

@bafu
Copy link

bafu commented Jan 19, 2016

For someone if your GPU memory is small (i.e. less than 2 GB) but you still want to use a large style image, it is a workaround to use CPU instead of GPU by setting the environment variable CUDARRAY_BACKEND to "numpy".

@filmo
Copy link

filmo commented Jan 26, 2016

^^^^^
That probably won't work so well in terms of time. Rendering will be several orders of magnitude slower than via the cudnn library. (at least that was my experience when I played with it prior to using it on a CUDA device. Pretty much this project doesn't work unless you've got a CUDA card to play with.

@bafu
Copy link

bafu commented Jan 29, 2016

@filmo Agree with you. I did a brief benchmark on Dell Inspiron 3543 with Broadwell-U (i3-5005U 2GHz) and GeForce 820M, the execution time ratio of CPU/GPU modes is around 400:1, and it takes around 5 minutes to create an artistic style image under GPU mode. CPU mode is the bottom line for someone really interested in this project but does not have any GPU computing resource.

@sirisian
Copy link

sirisian commented Apr 1, 2016

I just tried this with 1920x1080 and 1600x900 images on 2x 980 GTX and it got the same out of memory error. It would be amazing if this could be updated to run slower but with larger images. The 1400x788 examples I tried took about 3 minutes to run. I'm just messing around with this for fun though applying game styles from one video game to another. The 1400x788 images lacks details. What I really wanted to do was to load some massive collage images of a game and see what happens, but with the 1400x788 limit on my 4 GB cards it's not possible. (Examples: http://imgur.com/a/cbYOE )

edited: I tried other resolutions that worked as long as Firefox was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants