My Python code fails with the following error:
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xe
How do you translate 0x10 and 0xe in numpy versions? I currently have numpy 1.21.0, so I suppose 1.21.0 == 0xe, but how do I translate 0x10 in semantic versioning?
Related
I used
import tensorflow as tf
model = tf.keras.models.load_model('model.h5')
tf.saved_model.save(model,'model')
for saving my image classification model (tensorflow version on google colab = 2.9.2, intel open vino version[Development Tools] = 2021.4.2 LTS)
---------------------------------------------------------------------------------------
C:\Program Files (x86)\Intel\openvino_2021.4.752\deployment_tools\model_optimizer>python mo_tf.py --saved_model_dir C:\Users\dchoi\CNNProejct_Only_saved_English\saved_model --input_shape [1,32,320,240,3] --output_dir C:\Users\dchoi\CNNproject_only_output_English\output_model
Model Optimizer arguments:
Common parameters:
- Path to the Input Model: None
- Path for generated IR: C:\Users\dchoi\CNNproject_only_output_English\output_model
- IR output name: saved_model
- Log level: ERROR
- Batch: Not specified, inherited from the model
- Input layers: Not specified, inherited from the model
- Output layers: Not specified, inherited from the model
- Input shapes: [1,32,320,240,3]
- Mean values: Not specified
- Scale values: Not specified
- Scale factor: Not specified
- Precision of IR: FP32
- Enable fusing: True
- Enable grouped convolutions fusing: True
- Move mean values to preprocess section: None
- Reverse input channels: False
TensorFlow specific parameters:
- Input model in text protobuf format: False
- Path to model dump for TensorBoard: None
- List of shared libraries with TensorFlow custom layers implementation: None
- Update the configuration file with input/output node names: None
- Use configuration file used to generate the model with Object Detection API: None
- Use the config file: None
- Inference Engine found in: C:\Users\dchoi\AppData\Local\Programs\Python\Python38\lib\site-packages\openvino
Inference Engine version: 2021.4.0-3839-cd81789d294-releases/2021/4
Model Optimizer version: 2021.4.2-3974-e2a469a3450-releases/2021/4
[ WARNING ] Model Optimizer and Inference Engine versions do no match.
[ WARNING ] Consider building the Inference Engine Python API from sources or reinstall OpenVINO (TM) toolkit using "pip install openvino==2021.4"
2022-11-19 01:34:44.207311: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-11-19 01:34:44.207542: 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.
C:\Users\dchoi\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\autograph\impl\api.py:22: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
2022-11-19 01:34:46.961002: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2022-11-19 01:34:46.961949: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2022-11-19 01:34:46.962904: W tensorflow/stream_executor/cuda/cuda_driver.cc:326] failed call to cuInit: UNKNOWN ERROR (303)
2022-11-19 01:34:46.969471: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-SCBPOUA
2022-11-19 01:34:46.969727: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-SCBPOUA
2022-11-19 01:34:46.970663: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-11-19 01:34:46.971135: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
[ FRAMEWORK ERROR ] Cannot load input model: SavedModel format load failure: NodeDef mentions attr 'validate_shape' not in Op<name=AssignVariableOp; signature=resource:resource, value:dtype -> ; attr=dtype:type; is_stateful=true>; NodeDef: {{node AssignNewValue}}. (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
------------------------------------------------------------------------------------------
I am getting this kind of error even after I downloaded
install_prerequirement/install_prerequisites_tf2.bat
need help
Your error seems to indicate the mismatch between the TensorFlow version used to load GraphDef file. From my replication, I am able to generate the Intermediate Representation (IR) files using TensorFlow 2.5.3 version. Here is the full Model Optimizer command used:
mo_tf.py --saved_model_dir <path_to_model\IMGC.h5_to_saved_model.pb> --input_shape [1,320,240,3] --output_dir <path_for_output_files>
I was instaling tensorflow on my cpu when I got these 2 errors:
2022-03-13 17:59:56.171741: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-03-13 17:59:56.171872: 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.
Can anybody help me out here a little bit because I was also following a tutorial from a few years ago.
This is just a Warning and Information message that CUDA libraries cannot be found.
The I message at line 2: ignore the W message that comes above it if no CUDA GPU is installed on your machine.
The only effect of this is that training will happen on CPU only.
If you are using NVIDIA GPU, you can refer to how to install the missing files.
If you don't use NVIDIA GPU, or simply want to ignore the I and W messages, you can add the 2 lines below at the beginning of your code:
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
You can see more about TF_CPP_MIN_LOG_LEVEL at TensorFlow logging.
I'm using CUDA Toolkit 10.1, my PATH is set correctly.
I am compiling:
import cupy
x = cupy.array([1., 2., 3.])
y = cupy.arange(10)
This gives
Traceback (most recent call last):
File "C:\Python39\lib\site-packages\cupy\cuda\compiler.py", line 625, in compile
nvrtc.compileProgram(self.ptr, options)
File "cupy_backends\cuda\libs\nvrtc.pyx", line 133, in cupy_backends.cuda.libs.nvrtc.compileProgram
File "cupy_backends\cuda\libs\nvrtc.pyx", line 145, in cupy_backends.cuda.libs.nvrtc.compileProgram
File "cupy_backends\cuda\libs\nvrtc.pyx", line 64, in cupy_backends.cuda.libs.nvrtc.check_status
cupy_backends.cuda.libs.nvrtc.NVRTCError: NVRTC_ERROR unknown (7)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Dropbox\Emil\Binance\a.py", line 4, in <module>
y = cupy.arange(10)
File "C:\Python39\lib\site-packages\cupy\_creation\ranges.py", line 57, in arange
_arange_ufunc(typ(start), typ(step), ret, dtype=dtype)
File "cupy\_core\_kernel.pyx", line 1185, in cupy._core._kernel.ufunc.__call__
File "cupy\_core\_kernel.pyx", line 1212, in cupy._core._kernel.ufunc._get_ufunc_kernel
File "cupy\_core\_kernel.pyx", line 952, in cupy._core._kernel._get_ufunc_kernel
File "cupy\_core\_kernel.pyx", line 62, in cupy._core._kernel._get_simple_elementwise_kernel
File "cupy\_core\core.pyx", line 2030, in cupy._core.core.compile_with_cache
File "C:\Python39\lib\site-packages\cupy\cuda\compiler.py", line 434, in compile_with_cache
return _compile_with_cache_cuda(
File "C:\Python39\lib\site-packages\cupy\cuda\compiler.py", line 476, in _compile_with_cache_cuda
base = _preprocess('', options, arch, backend)
File "C:\Python39\lib\site-packages\cupy\cuda\compiler.py", line 375, in _preprocess
result, _ = prog.compile(options)
File "C:\Python39\lib\site-packages\cupy\cuda\compiler.py", line 637, in compile
raise CompileException(log, self.src, self.name, options,
cupy.cuda.compiler.CompileException: nvrtc: error: failed to open nvrtc-builtins64_101.dll.
Make sure that nvrtc-builtins64_101.dll is installed correctly.
I checked, the required DLL is in the \bin folder. What could be wrong here?
Show-config data is below
OS : Windows-10-10.0.19041-SP0
Python Version : 3.9.1
CuPy Version : 9.3.0
CuPy Platform : NVIDIA CUDA
NumPy Version : 1.19.5
SciPy Version : 1.6.2
Cython Build Version : 0.29.24
Cython Runtime Version : None
CUDA Root : C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1
nvcc PATH : C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.EXE
CUDA Build Version : 10010
CUDA Driver Version : 11040
CUDA Runtime Version : 10010
cuBLAS Version : (available)
cuFFT Version : 10010
cuRAND Version : 10010
cuSOLVER Version : (10, 1, 0)
cuSPARSE Version : (available)
NVRTC Version : (10, 1)
Thrust Version : 100906
CUB Build Version : 100800
Jitify Build Version : 60e9e72
cuDNN Build Version : None
cuDNN Version : None
NCCL Build Version : None
NCCL Runtime Version : None
cuTENSOR Version : None
cuSPARSELt Build Version : None
Device 0 Name : NVIDIA GeForce RTX 2080
Device 0 Compute Capability : 75
Device 0 PCI Bus ID : 0000:1A:00.0
Device 1 Name : NVIDIA GeForce RTX 2080
Device 1 Compute Capability : 75
Device 1 PCI Bus ID : 0000:68:00.0
Process finished with exit code 0
Here are the logs:
CUDA_PATH: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1
Wheel shared libraries: C:\Python39\lib\site-packages\cupy\.data\lib
Adding DLL search path: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin
Adding DLL search path: C:\Python39\lib\site-packages\cupy\.data\lib
CuPy wheel package built for CUDA 10.1
CuPy CUDA library directory: C:\Users\Dmitri/.cupy/cuda_lib
Looking for cudnn version 8.0.5 (cudnn64_8.dll)
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\lib\cudnn64_8.dll
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\lib64\cudnn64_8.dll
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\bin\cudnn64_8.dll
File cudnn64_8.dll could not be found
Trying to load cudnn64_8.dll from default search path
Library cudnn could not be preloaded: Could not find module 'cudnn64_8.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Looking for cudnn version 8.0.5 (cudnn_ops_infer64_8.dll)
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\lib\cudnn_ops_infer64_8.dll
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\lib64\cudnn_ops_infer64_8.dll
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\bin\cudnn_ops_infer64_8.dll
File cudnn_ops_infer64_8.dll could not be found
Trying to load cudnn_ops_infer64_8.dll from default search path
Library cudnn could not be preloaded: Could not find module 'cudnn_ops_infer64_8.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Looking for cudnn version 8.0.5 (cudnn_ops_train64_8.dll)
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\lib\cudnn_ops_train64_8.dll
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\lib64\cudnn_ops_train64_8.dll
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\bin\cudnn_ops_train64_8.dll
File cudnn_ops_train64_8.dll could not be found
Trying to load cudnn_ops_train64_8.dll from default search path
Library cudnn could not be preloaded: Could not find module 'cudnn_ops_train64_8.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Looking for cudnn version 8.0.5 (cudnn_cnn_infer64_8.dll)
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\lib\cudnn_cnn_infer64_8.dll
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\lib64\cudnn_cnn_infer64_8.dll
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\bin\cudnn_cnn_infer64_8.dll
File cudnn_cnn_infer64_8.dll could not be found
Trying to load cudnn_cnn_infer64_8.dll from default search path
Library cudnn could not be preloaded: Could not find module 'cudnn_cnn_infer64_8.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Looking for cudnn version 8.0.5 (cudnn_cnn_train64_8.dll)
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\lib\cudnn_cnn_train64_8.dll
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\lib64\cudnn_cnn_train64_8.dll
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\bin\cudnn_cnn_train64_8.dll
File cudnn_cnn_train64_8.dll could not be found
Trying to load cudnn_cnn_train64_8.dll from default search path
Library cudnn could not be preloaded: Could not find module 'cudnn_cnn_train64_8.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Looking for cudnn version 8.0.5 (cudnn_adv_infer64_8.dll)
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\lib\cudnn_adv_infer64_8.dll
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\lib64\cudnn_adv_infer64_8.dll
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\bin\cudnn_adv_infer64_8.dll
File cudnn_adv_infer64_8.dll could not be found
Trying to load cudnn_adv_infer64_8.dll from default search path
Library cudnn could not be preloaded: Could not find module 'cudnn_adv_infer64_8.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Looking for cudnn version 8.0.5 (cudnn_adv_train64_8.dll)
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\lib\cudnn_adv_train64_8.dll
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\lib64\cudnn_adv_train64_8.dll
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cudnn\8.0.5\bin\cudnn_adv_train64_8.dll
File cudnn_adv_train64_8.dll could not be found
Trying to load cudnn_adv_train64_8.dll from default search path
Library cudnn could not be preloaded: Could not find module 'cudnn_adv_train64_8.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Not preloading nccl
Looking for cutensor version 1.2.2 (cutensor.dll)
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cutensor\1.2.2\lib\cutensor.dll
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cutensor\1.2.2\lib64\cutensor.dll
Rejected candidate (not found): C:\Users\Dmitri/.cupy/cuda_lib\10.1\cutensor\1.2.2\bin\cutensor.dll
File cutensor.dll could not be found
Trying to load cutensor.dll from default search path
Library cutensor could not be preloaded: Could not find module 'cutensor.dll' (or one of its dependencies). Try using the full path with constructor syntax.
Process finished with exit code 0
I got this when using keras with Tensorflow backend:
tensorflow.python.framework.errors_impl.InvalidArgumentError: device CUDA:0 not supported by XLA service
while setting up XLA_GPU_JIT device number 0
Relevant code:
tfconfig = tf.ConfigProto()
tfconfig.graph_options.optimizer_options.global_jit_level = tf.OptimizerOptions.ON_1
tfconfig.gpu_options.allow_growth = True
K.tensorflow_backend.set_session(tf.Session(config=tfconfig))
tensorflow version: 1.14.0
Chairman Guo's code:
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
solved my problem of jupyter notebook kernel crashing at:
tf.keras.models.load_model(path/to/my/model)
The fatal message was:
2020-01-26 11:31:58.727326: F
tensorflow/stream_executor/lib/statusor.cc:34] Attempting to fetch
value instead of handling error Internal: failed initializing
StreamExecutor for CUDA device ordinal 0: Internal: failed call to
cuDevicePrimaryCtxRetain: CUDA_ERROR_UNKNOWN: unknown error
My TF's version is: 2.2.0-dev20200123. There are 2 GPUs on this system.
This could be due to your TF-default (i.e. 1st) GPU is running out of memory. If you have multiple GPUs, divert your Python program to run on other GPUs. In TF (suppose using TF-2.0-rc1), set the following:
# Specify which GPU(s) to use
os.environ["CUDA_VISIBLE_DEVICES"] = "1" # Or 2, 3, etc. other than 0
# On CPU/GPU placement
config = tf.compat.v1.ConfigProto(allow_soft_placement=True, log_device_placement=True)
config.gpu_options.allow_growth = True
tf.compat.v1.Session(config=config)
# Note that ConfigProto disappeared in TF-2.0
Suppose, however, your environment have only one GPU, then perhaps you have no choice but ask your buddy to stop his program, then treat him a cup of coffee.
I'd like to use the function bitrand(), which is in the compat.jl package. Here is what I did:
julia> Pkg.add("compat")
INFO: Nothing to be done
julia> using Compat
julia> bitrand()
ERROR: bitrand not defined
julia> Pkg.update()
INFO: Updating METADATA...
INFO: Computing changes...
INFO: No packages to install, update or remove
julia> using Compat
julia> bitrand()
ERROR: bitrand not defined
julia> Compat.bitrand()
ERROR: bitrand not defined
For info, I am using Julia-0.3.2. Thank you!
EDIT
julia> Pkg.status()
3 required packages:
- Compat 0.2.10
- Distributions 0.6.3
- StatsBase 0.6.10
3 additional packages:
- ArrayViews 0.4.8
- JSON 0.4.0
- PDMats 0.3.1
julia> Pkg.add("Compat")
INFO: Nothing to be done
julia> using Compat
julia> bitrand()
ERROR: bitrand not defined
This definitely works for me on Julia v0.3.3 with Compat.jl v0.2.10, so can you do the following:
Pkg.rm("Compat")
Run readdir(Pkg.dir()) to confirm its gone
Pkg.update()
Pkg.add("Compat") with a capital C
Close and re-open Julia, just to be sure
using Compat