hughperkins / tf-coriander

OpenCL 1.2 implementation for Tensorflow
Apache License 2.0
792 stars 90 forks source link

KeyError: 'TensorArrayV3' while import_graph_def #65

Open algoking opened 7 years ago

algoking commented 7 years ago

my environment is python 3.5 ubuntu 16.04, AMD RX480 It's work fine with basic calculation in GPU, such as: with tf.device('/gpu:0'): a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a') b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b') c = tf.matmul(a, b)

but when I use object detection,

    with detection_graph.as_default():
        od_graph_def = tf.GraphDef()
        with tf.gfile.GFile(PATH_TO_CKPT, 'r') as fid:
            serialized_graph = fid.read()
            od_graph_def.ParseFromString(serialized_graph)
            tf.import_graph_def(od_graph_def, name='')

exception by KeyError: 'TensorArrayV3', I found a issue in tensorflow related to "TensorArrayV3", but there is no any solution on it. Some guy said that tensorflow write in py2.7, when migrate to py3, there will have lots of issue need to fix, such as annoying encode, decode stuff. But my AMD only can work by your open-cl version tensorflow, and it's py3, is it possible to compile tf-coriander to py2.7? or any work around? Great thanks, I stuck with AMD OpenCl Tensorflow in past few weeks.

Below it's my clinfo: Number of platforms 1 Platform Name AMD Accelerated Parallel Processing Platform Vendor Advanced Micro Devices, Inc. Platform Version OpenCL 2.0 AMD-APP (2442.7) Platform Profile FULL_PROFILE Platform Extensions cl_khr_icd cl_amd_event_callback cl_amd_offline_devices Platform Extensions function suffix AMD

Platform Name AMD Accelerated Parallel Processing Number of devices 1 Device Name Ellesmere Device Vendor Advanced Micro Devices, Inc. Device Vendor ID 0x1002 Device Version OpenCL 1.2 AMD-APP (2442.7) Driver Version 2442.7 Device OpenCL C Version OpenCL C 1.2 Device Type GPU Device Profile FULL_PROFILE Device Board Name (AMD) AMD Radeon (TM) RX 480 Graphics Device Topology (AMD) PCI-E, 01:00.0 Max compute units 36 SIMD per compute unit (AMD) 4 SIMD width (AMD) 16 SIMD instruction width (AMD) 1 Max clock frequency 1291MHz Graphics IP (AMD) 8.0 Device Partition (core) Max number of sub-devices 36 Supported partition types none specified Max work item dimensions 3 Max work item sizes 256x256x256 Max work group size 256 Preferred work group size multiple 64 Wavefront width (AMD) 64 Preferred / native vector sizes
char 4 / 4
short 2 / 2
int 1 / 1
long 1 / 1
half 1 / 1 (cl_khr_fp16) float 1 / 1
double 1 / 1 (cl_khr_fp64) Half-precision Floating-point support (cl_khr_fp16) Denormals No Infinity and NANs No Round to nearest No Round to zero No Round to infinity No IEEE754-2008 fused multiply-add No Support is emulated in software No Correctly-rounded divide and sqrt operations No Single-precision Floating-point support (core) Denormals No Infinity and NANs Yes Round to nearest Yes Round to zero Yes Round to infinity Yes IEEE754-2008 fused multiply-add Yes Support is emulated in software No Correctly-rounded divide and sqrt operations Yes Double-precision Floating-point support (cl_khr_fp64) Denormals Yes Infinity and NANs Yes Round to nearest Yes Round to zero Yes Round to infinity Yes IEEE754-2008 fused multiply-add Yes Support is emulated in software No Correctly-rounded divide and sqrt operations No Address bits 64, Little-Endian Global memory size 3392765952 (3.16GiB) Global free memory (AMD) 3291040 (3.139GiB) Global memory channels (AMD) 8 Global memory banks per channel (AMD) 16 Global memory bank width (AMD) 256 bytes Error Correction support No Max memory allocation 2415919104 (2.25GiB) Unified memory for Host and Device No Minimum alignment for any data type 128 bytes Alignment of base address 2048 bits (256 bytes) Global Memory cache type Read/Write Global Memory cache size 16384 Global Memory cache line 64 bytes Image support Yes Max number of samplers per kernel 16 Max size for 1D images from buffer 134217728 pixels Max 1D or 2D image array size 2048 images Base address alignment for 2D image buffers 256 bytes Pitch alignment for 2D image buffers 256 bytes Max 2D image size 16384x16384 pixels Max 3D image size 2048x2048x2048 pixels Max number of read image args 128 Max number of write image args 8 Local memory type Local Local memory size 32768 (32KiB) Local memory syze per CU (AMD) 65536 (64KiB) Local memory banks (AMD) 32 Max constant buffer size 2415919104 (2.25GiB) Max number of constant args 8 Max size of kernel argument 1024 Queue properties
Out-of-order execution No Profiling Yes Prefer user sync for interop Yes Profiling timer resolution 1ns Profiling timer offset since Epoch (AMD) 1505395864920699653ns (Thu Sep 14 21:31:04 2017) Execution capabilities
Run OpenCL kernels Yes Run native kernels No Thread trace supported (AMD) Yes SPIR versions 1.2 printf() buffer size 1048576 (1024KiB) Built-in kernels
Device Available Yes Compiler Available Yes Linker Available Yes Device Extensions cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_image2d_from_buffer cl_khr_spir cl_khr_gl_event

NULL platform behavior clGetPlatformInfo(NULL, CL_PLATFORM_NAME, ...) No platform clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, ...) No platform clCreateContext(NULL, ...) [default] No platform clCreateContext(NULL, ...) [other] Success [AMD] clCreateContextFromType(NULL, CL_DEVICE_TYPE_CPU) No platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_GPU) No platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_ACCELERATOR) No platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_CUSTOM) No platform clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL) No platform

hughperkins commented 7 years ago

I think tf-coriander should be buildable for python 2.7. You will need to replace python3 with python2 in the scripts inside util directory, something like:

cd util
sed -i -e 's/python3/python2/g' *

I'm not sure how far this will get you. Let me know how this goes please, pasting the full output logs to a https://gist.github.com , when you hit the first issue/error.

algoking commented 7 years ago

fix bunch of error when build from the source, then stuck here

~/tf-coriander ~/tf-coriander
No Google Cloud Platform support will be enabled for TensorFlow
No Hadoop File System support will be enabled for TensorFlow
Found possible Python library paths:
  /usr/local/lib/python2.7/dist-packages
  /usr/lib/python2.7/dist-packages
Please input the desired Python library path to use.  Default is [/usr/local/lib/python2.7/dist-packages]
/usr/local/lib/python2.7/dist-packages
No GPU support will be enabled for TensorFlow
checking operating system
Configuration finished
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
........
____Loading package: tensorflow/tools/pip_package
____Downloading http://github.com/google/protobuf/archive/v3.1.0.tar.gz via codeload.github.com: 13,700 bytes
____Downloading http://github.com/google/protobuf/archive/v3.1.0.tar.gz via codeload.github.com: 40,240 bytes
____Downloading http://github.com/google/protobuf/archive/v3.1.0.tar.gz via codeload.github.com: 96,186 bytes
____Downloading http://github.com/google/protobuf/archive/v3.1.0.tar.gz via codeload.github.com: 206,932 bytes
____Downloading http://github.com/google/protobuf/archive/v3.1.0.tar.gz via codeload.github.com: 331,378 bytes
____Downloading http://github.com/google/protobuf/archive/v3.1.0.tar.gz via codeload.github.com: 659,002 bytes
____Downloading http://github.com/google/protobuf/archive/v3.1.0.tar.gz via codeload.github.com: 943,010 bytes
____Downloading http://github.com/google/protobuf/archive/v3.1.0.tar.gz via codeload.github.com: 1,665,388 bytes
____Downloading http://github.com/google/protobuf/archive/v3.1.0.tar.gz via codeload.github.com: 2,847,776 bytes
INFO: All external dependencies fetched successfully.
+ util/build_tf.sh
++ uname
+ [[ Linux == Darwin ]]
+ bash util/build_tf_u1604.sh
+ echo BUILDTYPE
BUILDTYPE
+ bazel build @grpc//:grpc_cpp_plugin
INFO: Found 1 target...
ERROR: /home/davinci/.cache/bazel/_bazel_davinci/aaa0efdc1b9af1206a63d0304b90b478/external/protobuf/BUILD:73:1: undeclared inclusion(s) in rule '@protobuf//:protobuf_lite':
this rule is missing dependency declarations for the following files included by 'external/protobuf/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc':
  '/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdarg.h'
  '/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stddef.h'
  '/usr/lib/gcc/x86_64-linux-gnu/4.9/include/stdint.h'
  '/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/limits.h'
  '/usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed/syslimits.h'.
Target @grpc//:grpc_cpp_plugin failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 2.092s, Critical Path: 0.36s
masadcv commented 6 years ago

@algoking did you manage to fix this error? I get the same error myself.

varun19299 commented 6 years ago

@algoking and @devkicks which version of tensorflow did you build? Google's object detection API requires a minimum of tensorflow 1.5.

Has the tf-corrainder project been updated for more recent builds (1.5+)?