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

When running on a CPU-only Google Colab kernel, no CUDA-capable device is detected #9

Open
xjdeng opened this issue Apr 1, 2020 · 4 comments

Comments

@xjdeng
Copy link

xjdeng commented Apr 1, 2020

  • face_recognition version: 0.3
  • Python version: 3.6
  • Operating System: Google Colab (cpu-only)

Description

My face encoder doesn't work when running on a CPU-only instance of Google Colab because dlib seems to expect a GPU.

What I Did

import face_recognition_models
import dlib

predictor_5_point_model = face_recognition_models.pose_predictor_five_point_model_location()
pose_predictor_5_point = dlib.shape_predictor(predictor_5_point_model)

predictor_68_point_model = face_recognition_models.pose_predictor_model_location()
pose_predictor_68_point = dlib.shape_predictor(predictor_68_point_model)

face_recognition_model = face_recognition_models.face_recognition_model_location()

face_encoder = dlib.face_recognition_model_v1(face_recognition_model)

And got the following error:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-4-2d57e5cbaae3> in <module>()
----> 1 face_encoder = dlib.face_recognition_model_v1(face_recognition_model)

RuntimeError: Error while calling cudaGetDevice(&the_device_id) in file /tmp/pip-wheel-b9ck8go0/dlib/dlib/cuda/gpu_data.cpp:201. code: 100, reason: no CUDA-capable device is detected
---------------------------------------------------------------------------

Note that this works fine on a GPU instance on Google Colab but not on a cpu-only one. And sometimes, I can't get a GPU instance on Colab which makes it impossible to run some code the uses the face_encoder (which should still work at a reasonable speed on the CPU.)

Here's a link to my Google Colab notebook to reproduce this: https://colab.research.google.com/drive/1wdCrks6Mdx-O9A77umQKUb8wCk8i43Uu

@erisitohang
Copy link

you can enable GPU in colab and it's free.
Runtime => Change runtime type and select GPU as Hardware accelerator.

@xjdeng
Copy link
Author

xjdeng commented Jun 23, 2020

That doesn't solve the problem. Sometimes, Colab denies me a GPU and this library stops working as a result.

@jbichene95
Copy link

the problem here is that the version of dlib that comes preinstalled with colab is configured to work with GPU.
the work around here is either to pip uninstall the default dlib and pip install a new one ,or use virtual environments to isolate that dependency

@Finki007
Copy link

@jbichene95 i tried to uninstall and reinstall dlib and still getting the error.
@xjdeng could you solve this issue?

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

4 participants