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

Fails in CUDA #2

Open
sergei-sh opened this issue Jun 20, 2017 · 1 comment
Open

Fails in CUDA #2

sergei-sh opened this issue Jun 20, 2017 · 1 comment

Comments

@sergei-sh
Copy link

sergei-sh commented Jun 20, 2017

Finally I've managed to install all prerequisites (cunn, CUDA, cutorch)
Now I try to run an example as in your notebook:

import lutorpy as lua
import numpy as np
from skimage import io
from utils.img_processing import process_img
from utils.face_dlib import AlignDlib
from utils.Classifier import HotOrNotTorchRegression

# define face model
fdet = AlignDlib()
# define scoring model
net = HotOrNotTorchRegression(gpu_mode=0,model_path='trained/', model_file='model_best.t7', image_size=224)

# score function
def score_image(img):
    # find all faces
    dets = fdet.getAllFaceBoundingBoxes(img)
    # if there is only one match, go and score
    if len(dets) != 0:
        det = dets[0]
        img2, face_img = process_img(img, fdet, size=224, is_shortest=True,
                                    margins={'width':0.5, "bottom":0.5, "top":0.5},
                                    bbox={'x1':int(np.round(det.left())),
                                           'x2':int(np.round(det.right())),
                                           'y1':int(np.round(det.top())),
                                           'y2':int(np.round(det.bottom()))})
        score =  net.classify_image(img2)[1]
        return img2, score
    else:
        return None, None

# read an example image from web
img_url = "https://s-media-cache-ak0.pinimg.com/originals/9a/3b/65/9a3b65c368c712ca322394ee4d19d407.jpg"
img = io.imread(img_url)
score = score_image(img)[1]

Output:

THCudaCheck FAIL file=/home/serj/torch/extra/cutorch/lib/THC/THCGeneral.c line=66 error=30 : unknown error
Traceback (most recent call last):
  File "example.py", line 6, in <module>
    from utils.Classifier import HotOrNotTorchRegression
  File "/home/serj/work/beautytorch/beauty.torch/utils/Classifier.py", line 11, in <module>
    lua.require('cunn')
  File "/home/serj/work/beautytorch/venv/local/lib/python2.7/site-packages/lutorpy/__init__.py", line 112, in require
    ret = luaRuntime.require(module_name)
  File "lutorpy/_lupa.pyx", line 318, in lutorpy._lupa.LuaRuntime.require (lutorpy/_lupa.c:6189)
  File "lutorpy/_lupa.pyx", line 1658, in lutorpy._lupa.call_lua (lutorpy/_lupa.c:25877)
  File "lutorpy/_lupa.pyx", line 1667, in lutorpy._lupa.execute_lua_call (lutorpy/_lupa.c:25987)
  File "lutorpy/_lupa.pyx", line 1620, in lutorpy._lupa.raise_lua_error (lutorpy/_lupa.c:25297)
lutorpy._lupa.LuaError: cuda runtime error (30) : unknown error at /home/serj/torch/extra/cutorch/lib/THC/THCGeneral.c:66

Maybe the problem is that my GPU is not NVidia. Can I disable cunn somehow? Please help!

ADD: can't run convert2cpu because of the same.

UPD As adviced by cutorch developers the conversion from GPU to CPU model is not possible without having NVidia GPU. It would be very helpful if CPU model could be shared as well.

@amirid amirid mentioned this issue Sep 5, 2017
@erogol
Copy link
Owner

erogol commented Nov 4, 2017

I'll pass everything to PyTorch at any time soon. Then everything 'll be there.

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

2 participants