NeuralStyleTransfer on local machine

Hi,

Have anyone tried running this on python on a desktop/laptop?
I’m planning to have some fun with this (for a very long time). When trying to recreate the week4 assignment 2 outputs, it is extreme slow.

I mean it should output an image every 250 epoch, but it took ages to see the 2nd picture.

I noticed the computer is using CPU while GPU is at 0 to 2%. Is that the reason for the slow speed? Is there a way to make it run on GPU?

Thanks,

regards,

Hey, yeah that could be the case. Can you make sure you’ve installed the gpu version of tensorflow (and have an nvidia gpu?)

1 Like

Thanks, your response pointed me to the right path and making some progress.

If i’m reading my web searches correctly. Installing Tensorflow 2.4 from Anaconda will have gpu version built in (so I’m ok here).

Then using this:
tf.config.list_physical_devices()
Out[3]: [PhysicalDevice(name=’/physical_device:CPU:0’, device_type=‘CPU’)] ← not see GPU yet

It was due to CUDA ToolKit is missing. and this is the fun part since I found out the hard way Tensorflow didn’t like my CUDA v11.3. So reinstalled with CUDA v11.2

then I see this:
2021-06-24 14:22:18.848677: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cudart64_110.dll
2021-06-24 14:22:43.039098: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library nvcuda.dll
2021-06-24 14:22:43.069653: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1733] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1070 with Max-Q Design computeCapability: 6.1
coreClock: 1.379GHz coreCount: 16 deviceMemorySize: 8.00GiB deviceMemoryBandwidth: 238.66GiB/s ← This I like!

2021-06-24 14:22:43.191330: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library ‘cudnn64_8.dll’; dlerror: cudnn64_8.dll not found
Skipping registering GPU devices… ← This I don’t like…

Found out I also needed cuDNN v8.1 from Nvdia. This requires signing up for a developer account. It is basically a zip file with folder structures exactly like CUDA v11.2. So I copied the files into CUDA folders.

then let’s try again:
import tensorflow as tf
2021-06-24 14:42:40.755132: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library cudart64_110.dll

tf.config.list_physical_devices()
Out[2]:
[PhysicalDevice(name=’/physical_device:CPU:0’, device_type=‘CPU’),
PhysicalDevice(name=’/physical_device:GPU:0’, device_type=‘GPU’)]

I assume it works now

1 Like