deepfakes / faceswap

Deepfakes Software For All
https://www.faceswap.dev
GNU General Public License v3.0
50.52k stars 13.06k forks source link

[AMD, TF-Coriander] ModuleNotFoundError: No module named '_pywrap_tensorflow' #146

Closed rogerisp closed 6 years ago

rogerisp commented 6 years ago

OS: MACOS HIGH SIERRA MACBOOK PRO LATE 2014, 15 inch

I first installed the latest tensor flow and then installed tf-corinander using:

pip3 install --upgrade tensorflow-0.11.0rc0-py3-none-any.whl

Faceswap works fine until I install coriander. Then it looks as if it is going to run, but does not.

I have since removed coda toolkit, I thought it might be interfering. It runs fine on cpu after removing cudann and toolkit. Any ideas on getting it to run with AMD using TF-Coriander? (https://github.com/hughperkins/tf-coriander/blob/master/doc/build-from-source.md)

But I get this error:

/Users/name/anaconda3/lib/python3.6/site-packages/h5py/init.py:34: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters Using TensorFlow backend. Exception in thread Thread-1: Traceback (most recent call last): File "/Users/name/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 14, in swig_import_helper return importlib.import_module(mname) File "/Users/name/anaconda3/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 658, in _load_unlocked File "", line 571, in module_from_spec File "", line 922, in create_module File "", line 219, in _call_with_frames_removed ImportError: dlopen(/Users/name/anaconda3/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow.so, 10): Symbol not found: __Z17setKernelArgInt32i Referenced from: /Users/name/anaconda3/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow.so Expected in: /usr/local/lib/libcocl.dylib in /Users/name/anaconda3/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow.so

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/name/anaconda3/lib/python3.6/site-packages/tensorflow/python/init.py", line 69, in from tensorflow.python import pywrap_tensorflow File "/Users/name/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 17, in _pywrap_tensorflow = swig_import_helper() File "/Users/name/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 16, in swig_import_helper return importlib.import_module('_pywrap_tensorflow') File "/Users/name/anaconda3/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/name/anaconda3/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/Users/name/anaconda3/lib/python3.6/threading.py", line 864, in run self._target(*self._args, *self._kwargs) File "/Users/name/Desktop/folder/scripts/train.py", line 122, in processThread model = PluginLoader.get_model(trainer)(self.arguments.model_dir) File "/Users/name/Desktop/folder/plugins/PluginLoader.py", line 13, in get_model return PluginLoader.import("Model", "Model{0}".format(name)) File "/Users/name/Desktop/folder/plugins/PluginLoader.py", line 22, in _import module = import(name, globals(), locals(), [], 1) File "/Users/name/Desktop/folder/plugins/Model_Original.py", line 3, in from keras.models import Model as KerasModel File "/Users/name/anaconda3/lib/python3.6/site-packages/keras/init.py", line 3, in from . import utils File "/Users/name/anaconda3/lib/python3.6/site-packages/keras/utils/init.py", line 6, in from . import conv_utils File "/Users/name/anaconda3/lib/python3.6/site-packages/keras/utils/conv_utils.py", line 9, in from .. import backend as K File "/Users/name/anaconda3/lib/python3.6/site-packages/keras/backend/init.py", line 83, in from .tensorflow_backend import File "/Users/name/anaconda3/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 5, in import tensorflow as tf File "/Users/name/anaconda3/lib/python3.6/site-packages/tensorflow/init.py", line 23, in from tensorflow.python import * File "/Users/name/anaconda3/lib/python3.6/site-packages/tensorflow/python/init.py", line 92, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "/Users/name/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 14, in swig_import_helper return importlib.import_module(mname) File "/Users/name/anaconda3/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 658, in _load_unlocked File "", line 571, in module_from_spec File "", line 922, in create_module File "", line 219, in _call_with_frames_removed ImportError: dlopen(/Users/name/anaconda3/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow.so, 10): Symbol not found: __Z17setKernelArgInt32i Referenced from: /Users/name/anaconda3/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow.so Expected in: /usr/local/lib/libcocl.dylib in /Users/name/anaconda3/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow.so

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/name/anaconda3/lib/python3.6/site-packages/tensorflow/python/init.py", line 69, in from tensorflow.python import pywrap_tensorflow File "/Users/name/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 17, in _pywrap_tensorflow = swig_import_helper() File "/Users/name/anaconda3/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 16, in swig_import_helper return importlib.import_module('_pywrap_tensorflow') File "/Users/name/anaconda3/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named '_pywrap_tensorflow'

Error importing tensorflow. Unless you are using bazel, you should not try to import tensorflow from its source directory; please exit the tensorflow source tree, and relaunch your python interpreter from there.

Any ideas?

Tyrannosaurus1234 commented 6 years ago

Tf-Coriander does not work for deepfakes because it's based on an outdated version of Tensorflow, use the dev/amd_gpu branch of https://github.com/lukeiwanski/tensorflow.

I have a full guide for getting the deepfake scripts running on AMD cards on Ubuntu 16.04 here: https://hastebin.com/yodusucilo which you may be able to modify to get it running on MacOS, it mostly depends on AMD having drivers that support your OS that expose your card to OpenCL, which they probably do considering it's in your machine.

rogerisp commented 6 years ago

Oh, wow. No wonder haha. I kept seeing a few modules get deleted and I noticed every time they did, face swap would no longer work. Thanks so much, the tutorial is awesome! I'm guessing I can't do it on MacOS though?

Tyrannosaurus1234 commented 6 years ago

You won't be able to copy it verbatim, but the general principle (installing all the various dependencies, compiling, etc) should remain the same on MacOS. You could try using Brew instead of Aptitude to install packages.

Clorr commented 6 years ago

See #86 if that can help. Otherwise reopen an issue in faceswap-playground