Closed Horace89 closed 4 years ago
It should be possible to use it with CPU only, although I never tried it :sweat_smile:.
If you just remove the cupy
line from requirements.txt
you should be able to install all requirements. But, to be honest, I can not guarantee that the code works without any problems on CPU only.
It just does not make much sense to use CPU, since it is quite slow on CPU.
The code should now work on CPU, too :wink:
Ok, I'll try. Thanks!
Hi,
It looks like it is still impossible to make it work without a GPU... 😟
I tried to use directly the command evaluate.py
with no success:
1 $ python evaluate.py --gpu 0 /Users/seb/git_dir/CUTE80/gt.npz logs/tests/train LSTMTextLocalizer_ --recognizer-name TransformerTextRecognizer_ --char-map train_utils/char-map-bos.json --results-path cute80_eval_results.json --dataset-name cute80 --strip-non-alpha -b 16
/Users/seb/.virtualenvs/kiss/lib/python3.7/site-packages/chainer/_environment_check.py:41: UserWarning: Accelerate has been detected as a NumPy backend library.
vecLib, which is a part of Accelerate, is known not to work correctly with Chainer.
We recommend using other BLAS libraries such as OpenBLAS.
For details of the issue, please see
https://docs.chainer.org/en/stable/tips.html#mnist-example-does-not-converge-in-cpu-mode-on-mac-os-x.
Please be aware that Mac OS X is not an officially supported OS.
''') # NOQA
Traceback (most recent call last):
File "evaluate.py", line 13, in <module>
from evaluation.text_recognition_evaluator import TextRecognitionEvaluator, \
File "/Users/seb/git_dir/kiss/evaluation/text_recognition_evaluator.py", line 10, in <module>
from evaluation.rotation_detection_evaluator import RotationMAPEvaluator
File "/Users/seb/git_dir/kiss/evaluation/rotation_detection_evaluator.py", line 9, in <module>
from image_manipulation.image_masking import ImageMasker
File "/Users/seb/git_dir/kiss/image_manipulation/image_masking.py", line 7, in <module>
create_mask_kernel = cuda.cupy.ElementwiseKernel(
AttributeError: 'object' object has no attribute 'ElementwiseKernel'
Hmm, you are right. Still a problem, there. I pushed a new version which should fix this kind of errors :sweat_smile:
Another problem seems to come from the fact that cupy
cannot be installed properly.
1 $ pip install cupy
Collecting cupy
Using cached https://files.pythonhosted.org/packages/67/4b/6960cdfeee8bbfa12450da6b83206b57f6d6951a74043f055905449bb657/cupy-6.5.0.tar.gz
ERROR: Command errored out with exit status 1:
command: /Users/seb/.virtualenvs/kiss/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/z_/yklxqshn4nv69bd4t63rsln40000gn/T/pip-install-4v6gv52e/cupy/setup.py'"'"'; __file__='"'"'/private/var/folders/z_/yklxqshn4nv69bd4t63rsln40000gn/T/pip-install-4v6gv52e/cupy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/z_/yklxqshn4nv69bd4t63rsln40000gn/T/pip-install-4v6gv52e/cupy/pip-egg-info
cwd: /private/var/folders/z_/yklxqshn4nv69bd4t63rsln40000gn/T/pip-install-4v6gv52e/cupy/
Complete output (46 lines):
Options: {'package_name': 'cupy', 'long_description': None, 'wheel_libs': [], 'wheel_includes': [], 'no_rpath': False, 'profile': False, 'linetrace': False, 'annotate': False, 'no_cuda': False}
-------- Configuring Module: cuda --------
/var/folders/z_/yklxqshn4nv69bd4t63rsln40000gn/T/tmpcnja2ith/a.cpp:1:10: fatal error: 'cublas_v2.h' file not found
#include <cublas_v2.h>
^~~~~~~~~~~~~
1 error generated.
command 'gcc' failed with exit status 1
************************************************************
* CuPy Configuration Summary *
************************************************************
Build Environment:
Include directories: []
Library directories: []
nvcc command : (not found)
Environment Variables:
CFLAGS : (none)
LDFLAGS : (none)
LIBRARY_PATH : (none)
CUDA_PATH : (none)
NVTOOLSEXT_PATH : (none)
NVCC : (none)
Modules:
cuda : No
-> Include files not found: ['cublas_v2.h', 'cuda.h', 'cuda_profiler_api.h', 'cuda_runtime.h', 'cufft.h', 'curand.h', 'cusparse.h', 'nvrtc.h']
-> Check your CFLAGS environment variable.
ERROR: CUDA could not be found on your system.
Please refer to the Installation Guide for details:
https://docs-cupy.chainer.org/en/stable/install.html
************************************************************
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/z_/yklxqshn4nv69bd4t63rsln40000gn/T/pip-install-4v6gv52e/cupy/setup.py", line 132, in <module>
ext_modules = cupy_setup_build.get_ext_modules()
File "/private/var/folders/z_/yklxqshn4nv69bd4t63rsln40000gn/T/pip-install-4v6gv52e/cupy/cupy_setup_build.py", line 632, in get_ext_modules
extensions = make_extensions(arg_options, compiler, use_cython)
File "/private/var/folders/z_/yklxqshn4nv69bd4t63rsln40000gn/T/pip-install-4v6gv52e/cupy/cupy_setup_build.py", line 387, in make_extensions
raise Exception('Your CUDA environment is invalid. '
Exception: Your CUDA environment is invalid. Please check above error log.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
And so this installation issue cascades into a failure:
1 $ python evaluate.py --gpu 0 /Users/seb/git_dir/CUTE80/gt.npz logs/tests/train LSTMTextLocalizer_ --recognizer-name TransformerTextRecognizer_ --char-map train_utils/char-map-bos.json --results-path cute80_eval_results.json --dataset-name cute80 --strip-non-alpha -b 16
/Users/seb/.virtualenvs/kiss/lib/python3.7/site-packages/chainer/_environment_check.py:41: UserWarning: Accelerate has been detected as a NumPy backend library.
vecLib, which is a part of Accelerate, is known not to work correctly with Chainer.
We recommend using other BLAS libraries such as OpenBLAS.
For details of the issue, please see
https://docs.chainer.org/en/stable/tips.html#mnist-example-does-not-converge-in-cpu-mode-on-mac-os-x.
Please be aware that Mac OS X is not an officially supported OS.
''') # NOQA
Traceback (most recent call last):
File "evaluate.py", line 310, in <module>
evaluator = Evaluator(args)
File "evaluate.py", line 105, in __init__
self.localizer.to_device(args.gpu)
File "/Users/seb.virtualenvs/kiss/lib/python3.7/site-packages/chainer/device_resident.py", line 171, in to_device
device = chainer.get_device(device)
File "/Users/seb.virtualenvs/kiss/lib/python3.7/site-packages/chainer/backend.py", line 148, in get_device
return _get_device_cupy_or_numpy(int_device_spec)
File "/Users/seb/.virtualenvs/kiss/lib/python3.7/site-packages/chainer/backend.py", line 181, in _get_device_cupy_or_numpy
return cuda.GpuDevice.from_device_id(device_spec)
File "/Users/sebastienvincent/.virtualenvs/kiss/lib/python3.7/site-packages/chainer/backends/cuda.py", line 219, in from_device_id
check_cuda_available()
File "/Users/sebastienvincent/.virtualenvs/kiss/lib/python3.7/site-packages/chainer/backends/cuda.py", line 138, in check_cuda_available
raise RuntimeError(msg)
RuntimeError: CUDA environment is not correctly set up
(see https://github.com/chainer/chainer#installation).No module named 'cupy'
It is of course not possible to install cupy... I already told you to not install this package.
Your problem is that you are trying to make the code use a gpu with saying --gpu 0
. It should be --gpu -1
(as indicated in the README
)
Sorry, I didn't try the --gpu -1
setting. But I'm not sure it is in the current README either. ☺️
Hmm, good point :sweat_smile: I'm sorry. I thought I added this to the README, but it seems you are right and only the script itself tells you how it behaves. Does it work now?
Hi. It looks like there is a problem when I try to do the install on my MacBook with no GPU :
Is it possible to use kiss with CPU only?