deepfakes / faceswap-model

Tweaking the generative model
147 stars 133 forks source link

Use OpenCL for compatibility with AMD GPUs #4

Open Yutsa opened 6 years ago

Yutsa commented 6 years ago

I know the project is using tensorflow which uses CUDA, so for now it is exlusive to NVIDIA GPUs.

Is there a way to use another framework that would use OpenCL to make it work on AMD GPUs and maybe Intel integrated GPUs ?

Or is it completely unimaginable ?

Yutsa commented 6 years ago

I saw https://github.com/benoitsteiner/tensorflow-opencl which is a fork of tensorflow for openCL, would it be possible to use it do you think ?

Ganonmaster commented 6 years ago

Seeing as it is an unofficial fork and have yet to see any substantial coverage/testing for it, I would vote against including it. It also lacks a PyPi listing, which would mean we'd have to probably include it as a submodule or as a git package in the requirements.

However, have you looked at how Keras handles the machine learning backends? Maybe there's an OpenCL backend for Keras?

Yutsa commented 6 years ago

Oh yeah I wasn't suggesting adding it to this project but just wanted to know if that could work. I don't know exactly what we are using.

If there is an openCL backend for Keras we could use an AMD GPU ?

Ganonmaster commented 6 years ago

I think I saw someone use Theano as a backend and I think Theano has support for OpenCL.

I don't know how the performance compares to Nvidia CUDA with Tensorflow. I have a GTX1080 myself, so perhaps we should do some benchmarking with different backends soon.

Yutsa commented 6 years ago

So from what I understood we use Keras which uses Tensorflow as a backend but we could in theory use any other backend ?

I'd love to be able to use my AMD GPU with this project but support is really lacking.

Ganonmaster commented 6 years ago

Yes, that is my understanding also. It could be an idea to make these components pluggable. So you could choose which backend to use.

shaoanlu commented 6 years ago

I just found this: https://github.com/plaidml/plaidml https://twitter.com/fchollet/status/921815941112930304?lang=en It uses OpenCL and adapts keras code.