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

E tensorflow/stream_executor/cuda/cuda_driver.cc:313] failed call to cuInit: UNKNOWN ERROR (303 on Docker Debian 9 #34

Closed
dan-developer opened this issue May 20, 2020 · 17 comments

Comments

@dan-developer
Copy link

I have this error using debian on the docker, I would like to disable cuda support, is there how?

Below is the output:

Using TensorFlow backend.
^[[AUsing VGG-Face model backend and cosine distance.
2020-05-20 14:35:39.426369: E tensorflow/stream_executor/cuda/cuda_driver.cc:313] failed call to cuInit: UNKNOWN ERROR (303)
Verification: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 1.46it/s]
{'pair_1': {'distance': 0.23476946353912354,
'max_threshold_to_verify': 0.4,
'model': 'VGG-Face',
'similarity_metric': 'cosine',
'verified': True}}

@serengil
Copy link
Owner

Try to put the following code block in the first line of your program.

import os
os.environ["CUDA_VISIBLE_DEVICES"]=""

@serengil
Copy link
Owner

Alternatively, you can call the following command. It tries to allocate required GPU memory. If it cannot allocate, then continue with CPU.

DeepFace.allocateMemory()

@dan-developer
Copy link
Author

dan-developer commented May 21, 2020

I tried both methods, but the error doesn't go away:

Using TensorFlow backend.
Analyzing your system...
DeepFace will run on CPU
Using VGG-Face model backend and cosine distance.
2020-05-21 13:13:01.045449: E tensorflow/stream_executor/cuda/cuda_driver.cc:313] failed call to cuInit: UNKNOWN ERROR (303)
Verification: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00,  1.31it/s]
{'pair_1': {'distance': 0.29093843698501587,
            'max_threshold_to_verify': 0.4,
            'model': 'VGG-Face',
            'similarity_metric': 'cosine',
            'verified': True}}

The python code:

from pprint import pprint
import os
from deepface import DeepFace
from deepface.basemodels import VGGFace, OpenFace, Facenet, FbDeepFace

os.environ["CUDA_VISIBLE_DEVICES"]=""
DeepFace.allocateMemory()


obj = DeepFace.verify([
    ["db/01_eu.jpg", "./db/S5/1.tif"],

])

pprint(obj)

@serengil
Copy link
Owner

Even though you got an error, you can see the content of obj variable. It is interesting.

@serengil
Copy link
Owner

Could you try to install tensorflow instead of tensorflow-gpu

pip install tensorflow==1.9.0

@dan-developer
Copy link
Author

Using TensorFlow backend.
/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
Traceback (most recent call last):
  File "teste-deepface.py", line 3, in <module>
    from deepface import DeepFace
  File "/usr/local/lib/python3.6/site-packages/deepface/DeepFace.py", line 1, in <module>
    from keras.preprocessing import image
  File "/usr/local/lib/python3.6/site-packages/keras/__init__.py", line 3, in <module>
    from . import utils
  File "/usr/local/lib/python3.6/site-packages/keras/utils/__init__.py", line 6, in <module>
    from . import conv_utils
  File "/usr/local/lib/python3.6/site-packages/keras/utils/conv_utils.py", line 9, in <module>
    from .. import backend as K
  File "/usr/local/lib/python3.6/site-packages/keras/backend/__init__.py", line 1, in <module>
    from .load_backend import epsilon
  File "/usr/local/lib/python3.6/site-packages/keras/backend/load_backend.py", line 90, in <module>
    from .tensorflow_backend import *
  File "/usr/local/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 54, in <module>
    get_graph = tf_keras_backend.get_graph
AttributeError: module 'tensorflow.python.keras.backend' has no attribute 'get_graph'

@serengil
Copy link
Owner

Could you run the following code block?

import tensorflow as tf
print(tf.__version__)
import keras
print(keras.__version__)

@dan-developer
Copy link
Author

Continues the same error:

/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
1.9.0
Using TensorFlow backend.
Traceback (most recent call last):
  File "teste-deepface.py", line 3, in <module>
    import keras
  File "/usr/local/lib/python3.6/site-packages/keras/__init__.py", line 3, in <module>
    from . import utils
  File "/usr/local/lib/python3.6/site-packages/keras/utils/__init__.py", line 6, in <module>
    from . import conv_utils
  File "/usr/local/lib/python3.6/site-packages/keras/utils/conv_utils.py", line 9, in <module>
    from .. import backend as K
  File "/usr/local/lib/python3.6/site-packages/keras/backend/__init__.py", line 1, in <module>
    from .load_backend import epsilon
  File "/usr/local/lib/python3.6/site-packages/keras/backend/load_backend.py", line 90, in <module>
    from .tensorflow_backend import *
  File "/usr/local/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 54, in <module>
    get_graph = tf_keras_backend.get_graph
AttributeError: module 'tensorflow.python.keras.backend' has no attribute 'get_graph'

@serengil
Copy link
Owner

I cannot see your keras versions. If line 3 has keras import, then your keras installation is problematic. Try to reinstall the package.

pip uninstall tensorflow
pip install tensorflow==1.9.9
pip uninstall keras
pip install keras==2.2.0

@dan-developer
Copy link
Author

ERROR: Could not find a version that satisfies the requirement tensorflow==1.9.9

@serengil
Copy link
Owner

My fault. The correct version are below.

pip uninstall tensorflow
pip install tensorflow==1.9.0
pip uninstall keras
pip install keras==2.2.0

@dan-developer
Copy link
Author

/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

@dan-developer
Copy link
Author

Using TensorFlow backend.
Directory /root /.deepface created
Directory /root /.deepface/weights created
Analyzing your system...
DeepFace will run on CPU
Using VGG-Face model backend and cosine distance.
vgg_face_weights.h5 will be downloaded...
Access denied with the following error:

    Too many users have viewed or downloaded this file recently. Please
    try accessing the file again later. If the file you are trying to
    access is particularly large or is shared with many people, it may
    take up to 24 hours to be able to view or download the file. If you
    still can't access a file after 24 hours, contact your domain
    administrator.

You may still be able to access the file from the browser:

     https://drive.google.com/uc?id=1CPSeum3HpopfomUEK1gybeuIVoeJT_Eo

@serengil
Copy link
Owner

Oke, download this file manually and copy it to the /root /.deepface/weights folder.

@rockstarvibu
Copy link

Continues the same error:

/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
1.9.0
Using TensorFlow backend.
Traceback (most recent call last):
  File "teste-deepface.py", line 3, in <module>
    import keras
  File "/usr/local/lib/python3.6/site-packages/keras/__init__.py", line 3, in <module>
    from . import utils
  File "/usr/local/lib/python3.6/site-packages/keras/utils/__init__.py", line 6, in <module>
    from . import conv_utils
  File "/usr/local/lib/python3.6/site-packages/keras/utils/conv_utils.py", line 9, in <module>
    from .. import backend as K
  File "/usr/local/lib/python3.6/site-packages/keras/backend/__init__.py", line 1, in <module>
    from .load_backend import epsilon
  File "/usr/local/lib/python3.6/site-packages/keras/backend/load_backend.py", line 90, in <module>
    from .tensorflow_backend import *
  File "/usr/local/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 54, in <module>
    get_graph = tf_keras_backend.get_graph
AttributeError: module 'tensorflow.python.keras.backend' has no attribute 'get_graph'

in api.py at line 83 change from graph = tf.get_default_graph() to graph = tf.compat.v1.get_default_graph()

it will run.. getting same error but now i solved it...

@serengil
Copy link
Owner

in the exception message, it says 'module 'tensorflow.python.keras.backend'. You are running tensorflow 2.0? Because this seems to come from 2.0.

In previous message, I mentioned that you should have the following versions.

pip install tensorflow==1.9.0
pip install keras==2.2.0

@serengil
Copy link
Owner

no response

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

3 participants