automl icon indicating copy to clipboard operation
automl copied to clipboard

How to run this model_inspect.py on CPU instead of GPU?

Open uysalmustafa opened this issue 6 years ago • 1 comments

Hi, when I try to inference on images.

MODEL = 'efficientdet-d0'
saved_model_dir = 'savedmodel'
serve_image_out = 'serve_image_out'
!python model_inspect.py --runmode=saved_model_infer \
  --saved_model_dir={saved_model_dir} \
  --model_name={MODEL}  --input_image=testdata/img1.jpg  \
  --output_image_dir={serve_image_out}

I see this error:

2020-05-02 23:44:28.441833: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-05-02 23:44:28.441833: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
WARNING:tensorflow:From C:\Users\mustafa\anaconda3\lib\site-packages\tensorflow_core\python\compat\v2_compat.py:88: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
2020-05-02 23:44:32.353043: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-05-02 23:44:32.587043: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1555] Found device 0 with properties: 
pciBusID: 0000:01:00.0 name: GeForce GT 540M computeCapability: 2.1
coreClock: 1.344GHz coreCount: 2 deviceMemorySize: 1.00GiB deviceMemoryBandwidth: 23.84GiB/s
2020-05-02 23:44:32.587043: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-05-02 23:44:32.587043: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cublas64_10.dll'; dlerror: cublas64_10.dll not found
2020-05-02 23:44:32.587043: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cufft64_10.dll'; dlerror: cufft64_10.dll not found
2020-05-02 23:44:32.587043: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'curand64_10.dll'; dlerror: curand64_10.dll not found
2020-05-02 23:44:32.587043: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cusolver64_10.dll'; dlerror: cusolver64_10.dll not found
2020-05-02 23:44:32.587043: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cusparse64_10.dll'; dlerror: cusparse64_10.dll not found
2020-05-02 23:44:32.977044: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2020-05-02 23:44:32.977044: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1592] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2020-05-02 23:44:33.273444: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1096] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-05-02 23:44:33.273444: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102]      0 
2020-05-02 23:44:33.273444: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] 0:   N 
WARNING:tensorflow:From C:\Users\mustafa\Downloads\automl-master (1)\automl-master\efficientdet\inference.py:604: load (from tensorflow.python.saved_model.loader_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This function will only be available through the v1 compatibility library as tf.compat.v1.saved_model.loader.load or tf.compat.v1.saved_model.load. There will be a new function for importing SavedModels in Tensorflow 2.0.
W0502 23:44:33.320245  1780 deprecation.py:323] From C:\Users\mustafa\Downloads\automl-master (1)\automl-master\efficientdet\inference.py:604: load (from tensorflow.python.saved_model.loader_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This function will only be available through the v1 compatibility library as tf.compat.v1.saved_model.loader.load or tf.compat.v1.saved_model.load. There will be a new function for importing SavedModels in Tensorflow 2.0.

My GPU doesn't support CUDA. I think that is the reason of error. So I want to use CPU. But I couldn't see where/how to use CPU instead of GPU.

uysalmustafa avatar May 02 '20 21:05 uysalmustafa

Hi @MustafaUysal160207077 you have two ways:

(1) directly set environment in shell:

! export CUDA_VISIBLE_DEVICES=-1

(2) add the following code to the beginning of model_inspect.py:

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

mingxingtan avatar May 02 '20 22:05 mingxingtan