0
votes

I have been trying to run this Tensorflow style transfer implementation - https://github.com/anishathalye/neural-style on Windows (the GPU version), but I am getting this error:

ResourceExhaustedError (see above for traceback): OOM when allocating tensor with shape[64,239400] [[Node: gradients/MatMul_grad/MatMul = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=true, _device="/job:localhost/replica:0/task:0/gpu:0"](gradients/truediv_2_grad/tuple/control_dependency, Reshape)]]

I am a complete beginner in both Tensorflow and Python so I don't really know how to fix this.

1

1 Answers

0
votes

This is an Out Of Memory error. You don't have enough GPU memory to run the deep network for this image.

You have 2 solutions :

  1. If you don't care about speed, use the CPU version, because you probably have more CPU memory (RAM) than GPU memory. You set CUDA_VISIBLE_DEVICES to disable GPU : CUDA_VISIBLE_DEVICES= python neural_style.py <content file> --styles <style file> --output <output file>
  2. Process a smaller image. Feeding an image of smaller dimensions can really decrease memory usage. So try downsampling your image before feeding it to the script; you can try multiple sizes to see what's the maximum size you can fit into your GPU memory.