BVLC / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
33.98k stars 18.72k forks source link

Not able to test on Python 2.7.12 Cuda 10 and Cudnn 7. Error in caffe_pb2.py. TypeError: __init__() got an unexpected keyword argument 'syntax' #6933

Open astronaut71 opened 4 years ago

astronaut71 commented 4 years ago

Hello

Im using Ubuntu 16.04, Python 2.7.12 Cuda 10 and Cudnn 7., and protoc version 3.11 ibprotoc 3.11.4. and protobuf 3. 11.4. as well. I followed the Ubuntu 16 Installation guide for Caffee here

https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-Installation-Guide

Then find out that caffe is not compatible with cudnn 5.1, and a code error will be reported when compiling caffe with newer version of cudnn. As Im using cudnn 7 and Cuda 10 was wondering if the changes made in order to work with cudnn 5.1 can be good enough to work with v7. So far I done this:

Replaced the corresponding files of faster rcnn with the following files of the latest caffe source: include / caffe / layers / cudnn_relu_layer.hpp, src / caffe / layers / cudnn_relu_layer.cpp, src / caffe / layers / cudnn_relu_layer.cu, src / caffe / layers / cudnn_sigmoid_layer.cpp, src / caffe / layers / cudnn_sigmoid_layer.cu, include / caffe / layers / cudnn_sigmoid_layer.hpp, include / caffe / layers / cudnn_tanh_layer.hpp, src / caffe / layers / cudnn_tanh_layer.cpp, src / caffe / layers / cudnn_tanh_layer.cu

Then Replace the corresponding file include / caffe / util / cudnn.hpp with this file in the caffe source code. Replace all cudnnConvolutionBackwardData_v3 function names in the src / caffe / layers / cudnn_conv_layer.cu with cudnnConvolutionBackwardData and cudnnConvolutionBackwardFilter_v3 function names with cudnnConvolutionBackwardFilter

So I was able to compile and pass all the test. In Makefile i done this settings PYTHON_LIBRARIES := boost_python python2.7 For Makefile.config have this settings

USE_CUDNN := 1
# CPU_ONLY := 1
# OPENCV_VERSION := 3

CUDA_ARCH := #-gencode arch=compute_20,code=sm_20 \
        #-gencode arch=compute_20,code=sm_21 \
        -gencode arch=compute_30,code=sm_30 \
        -gencode arch=compute_35,code=sm_35 \
        -gencode arch=compute_50,code=sm_50 \
        -gencode arch=compute_52,code=sm_52 \
        -gencode arch=compute_60,code=sm_60 \
        -gencode arch=compute_61,code=sm_61 \
        -gencode arch=compute_61,code=compute_61

BLAS := atlas
PYTHON_INCLUDE := /usr/include/python2.7 /usr/local/lib/python2.7/dist-packages/numpy/core/include  

PYTHON_LIB := /usr/lib
 LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial

After success of all cafe test then I tried some examples demo I got this error

File "/.../caffe/python/caffe/proto/caffe_pb2.py", line 22, in Method\x12\x07\n\x03MAX\x10\x00\x12\x07\n\x03\x41VE\x10\x01\x12\x0e\n\nSTOCHASTIC\x10\x02"W\n\x0ePReLUParameter\x12&\n\x06\x66iller\x18\x01 \x01(\x0b\x32\x16.caffe.FillerParameter\x12\x1d\n\x0e\x63hannel_shared\x18\x02 \x01(\x08:\x05\x66\x61lse*\x1c\n\x05Phase\x12\t\n\x05TRAIN\x10\x00\x12\x08\n\x04TEST\x10\x01' TypeError: init() got an unexpected keyword argument 'syntax'

Try to solve it but no help. Please can you advice. Thanks