Detectron: La instalación de Docker falla con: "no tiene ningún miembro llamado 'numel'"

Creado en 19 nov. 2018  ·  13Comentarios  ·  Fuente: facebookresearch/Detectron

Hola, todos,
ultimamente tengo un problema, instalando detectron via docker. Fallo ahora con:

/usr/local/caffe2_build/include/caffe2/core/tensor.h:687:17: nota: el candidato espera 1 argumento, se proporciona 0
/detectron/detectron/ops/zero_even_op.cc:33:27: error: 'class caffe2::Tensor<:cpucontext i="7">' no tiene ningún miembro llamado 'numel'
for (auto i = 0; i < Y->numel(); i += 2) {

Encontré un problema relacionado aquí:
https://github.com/facebookresearch/Detectron/issues/732
pero no puedo usar la solución ya que detectron se está instalando directamente desde el repositorio. ¿Podrías cambiar el repositorio?
Gracias por adelantado,

erik

Comentario más útil

Conseguí que esto funcionara revisando d56e267 en lugar del último maestro

¿Quieres decir en el Dockerfile? p.ej

EJECUTE el clon git https://github.com/facebookresearch/detectron /detectron
EJECUTAR cd /detectron && git checkout d56e267

Todos 13 comentarios

Hola, tengo el mismo problema con el Dockerfile. Me pregunto si eso podría estar relacionado con la versión CUDA.

La compilación se está rompiendo ahora. Obteniendo esto:
¿No hay una compilación automatizada compatible de esto en ningún lugar en el concentrador acoplable?

Mi sistema tiene otros contenedores que usan CUDA que funcionan bien.

-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- CUDA detected: 9.0
-- Added CUDA NVCC flags for: sm_30 sm_35 sm_50 sm_52 sm_60 sm_61 sm_70
-- Found libcuda: /usr/local/cuda/lib64/stubs/libcuda.so
-- Found libnvrtc: /usr/local/cuda/lib64/libnvrtc.so
-- Found CUDNN: /usr/include  
-- Found cuDNN: v7.0.5  (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so)
-- Summary:
--   CMake version        : 3.5.1
--   CMake command        : /usr/bin/cmake
--   System name          : Linux
--   C++ compiler         : /usr/bin/c++
--   C++ compiler version : 5.4.0
--   CXX flags            :  -std=c++11 -O2 -fPIC -Wno-narrowing
--   Caffe2 version       : 0.8.1
--   Caffe2 include path  : /usr/local/caffe2_build/include
--   Have CUDA            : TRUE
--     CUDA version       : 9.0
--     CuDNN version      : 7.0.5
-- Configuring done
-- Generating done
-- Build files have been written to: /detectron/build
make[1]: Entering directory '/detectron/build'
make[2]: Entering directory '/detectron/build'
make[3]: Entering directory '/detectron/build'
make[3]: Entering directory '/detectron/build'
[ 20%] Building NVCC (Device) object CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/detectron/ops/caffe2_detectron_custom_ops_gpu_generated_zero_even_op.cu.o
Scanning dependencies of target caffe2_detectron_custom_ops
make[3]: Leaving directory '/detectron/build'
make[3]: Entering directory '/detectron/build'
[ 40%] Building CXX object CMakeFiles/caffe2_detectron_custom_ops.dir/detectron/ops/zero_even_op.cc.o
In file included from /usr/local/caffe2_build/include/caffe2/core/allocator.h:22:0,
                 from /usr/local/caffe2_build/include/caffe2/core/context.h:25,                                                                     
                 from /detectron/detectron/ops/zero_even_op.h:20,                                                                                   
                 from /detectron/detectron/ops/zero_even_op.cc:17:                                                                                  
/detectron/detectron/ops/zero_even_op.cc: In member function 'bool caffe2::ZeroEvenOp<T, Context>::RunOnDevice() [with T = float; Context = caffe2::CPUContext]':                                                                                                                                       
/detectron/detectron/ops/zero_even_op.cc:25:23: error: no matching function for call to 'caffe2::Tensor<caffe2::CPUContext>::dim() const'           
   CAFFE_ENFORCE(X.dim() == 1);                                                                                                                     
                       ^                                                                                                                            
In file included from /usr/local/caffe2_build/include/caffe2/core/net.h:34:0,                                                                       
                 from /usr/local/caffe2_build/include/caffe2/core/operator.h:29,                                                                    
                 from /detectron/detectron/ops/zero_even_op.h:21,                                                                                   
                 from /detectron/detectron/ops/zero_even_op.cc:17:                                                                                  
/usr/local/caffe2_build/include/caffe2/core/tensor.h:687:17: note: candidate: caffe2::TIndex caffe2::Tensor<Context>::dim(int) const [with Context = caffe2::CPUContext; caffe2::TIndex = long int]                                                                                                     
   inline TIndex dim(const int i) const {                                                                                                           
                 ^                                                                                                                                  
/usr/local/caffe2_build/include/caffe2/core/tensor.h:687:17: note:   candidate expects 1 argument, 0 provided                                       
/detectron/detectron/ops/zero_even_op.cc:33:27: error: 'class caffe2::Tensor<caffe2::CPUContext>' has no member named 'numel'                       
   for (auto i = 0; i < Y->numel(); i += 2) {                                                                                                       
                           ^                                                                                                                        
CMakeFiles/caffe2_detectron_custom_ops.dir/build.make:62: recipe for target 'CMakeFiles/caffe2_detectron_custom_ops.dir/detectron/ops/zero_even_op.cc.o' failed
make[3]: *** [CMakeFiles/caffe2_detectron_custom_ops.dir/detectron/ops/zero_even_op.cc.o] Error 1
make[3]: Leaving directory '/detectron/build'
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/caffe2_detectron_custom_ops.dir/all' failed
make[2]: *** [CMakeFiles/caffe2_detectron_custom_ops.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....                                                                                                        
Scanning dependencies of target caffe2_detectron_custom_ops_gpu
make[3]: Leaving directory '/detectron/build'
make[3]: Entering directory '/detectron/build'
[ 60%] Building CXX object CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/detectron/ops/zero_even_op.cc.o
In file included from /usr/local/caffe2_build/include/caffe2/core/allocator.h:22:0,
                 from /usr/local/caffe2_build/include/caffe2/core/context.h:25,                                                                     
                 from /detectron/detectron/ops/zero_even_op.h:20,
                 from /detectron/detectron/ops/zero_even_op.cc:17:
/detectron/detectron/ops/zero_even_op.cc: In member function 'bool caffe2::ZeroEvenOp<T, Context>::RunOnDevice() [with T = float; Context = caffe2::CPUContext]':
/detectron/detectron/ops/zero_even_op.cc:25:23: error: no matching function for call to 'caffe2::Tensor<caffe2::CPUContext>::dim() const'
   CAFFE_ENFORCE(X.dim() == 1);
                       ^
In file included from /usr/local/caffe2_build/include/caffe2/core/net.h:34:0,
                 from /usr/local/caffe2_build/include/caffe2/core/operator.h:29,
                 from /detectron/detectron/ops/zero_even_op.h:21,
                 from /detectron/detectron/ops/zero_even_op.cc:17:
/usr/local/caffe2_build/include/caffe2/core/tensor.h:687:17: note: candidate: caffe2::TIndex caffe2::Tensor<Context>::dim(int) const [with Context = caffe2::CPUContext; caffe2::TIndex = long int]
   inline TIndex dim(const int i) const {
                 ^
/usr/local/caffe2_build/include/caffe2/core/tensor.h:687:17: note:   candidate expects 1 argument, 0 provided
/detectron/detectron/ops/zero_even_op.cc:33:27: error: 'class caffe2::Tensor<caffe2::CPUContext>' has no member named 'numel'
   for (auto i = 0; i < Y->numel(); i += 2) {
                           ^
CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/build.make:69: recipe for target 'CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/detectron/ops/zero_even_op.cc.o' failed
make[3]: *** [CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/detectron/ops/zero_even_op.cc.o] Error 1
make[3]: Leaving directory '/detectron/build'
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/all' failed
make[2]: Leaving directory '/detectron/build'
make[2]: *** [CMakeFiles/caffe2_detectron_custom_ops_gpu.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make[1]: Leaving directory '/detectron/build'
make[1]: *** [all] Error 2
Makefile:13: recipe for target 'ops' failed
make: *** [ops] Error 2
The command '/bin/sh -c make ops' returned a non-zero code: 2

Conseguí que esto funcionara revisando d56e267efc92b65b8d899f1b89a7ed2bca3e5f44 en lugar del último maestro

@TheNeikos , también lo hago funcionar con d56e267efc92b65b8d899f1b89a7ed2bca3e5f44

Conseguí que esto funcionara revisando d56e267 en lugar del último maestro

¿Quieres decir en el Dockerfile? p.ej

EJECUTE el clon git https://github.com/facebookresearch/detectron /detectron
EJECUTAR cd /detectron && git checkout d56e267

@beatque sí exactamente

¡Gracias @TheNeikos ! Zuckerberg debería darte al menos 10 mil euros, porque sin tu comentario me hubiera dado por vencido con Detectron y usado solo la implementación de Matterport :D

@manyaafonso
¿Le importaría compartir más detalles sobre cómo resuelve este problema, por favor?

Sigo la sugerencia de @TheNeikos @beatthat @francois-wellenreiter
1. EJECUTE el clon git https://github.com/facebookresearch/detectron /detectron

  1. EJECUTAR cd /detectron && git checkout d56e267
    Y luego lo intenté
  2. EJECUTAR cd / ventana acoplable
  3. EJECUTE docker build -t detectron:c2-cuda9-cudnn7 .

Y todavía tengo la misma salida de error.
Creo que git checkout d56e267 me ayuda a cambiar a la versión anterior. Y en d56e267
"/detectron/ops/zero_even_op.cc" este archivo tiene
for (auto i = 0; i < Y->size(); i += 2) {

Pero cuando trato de construir, el mensaje de error aún se muestra

for (auto i = 0; i < Y->numel(); i += 2) {
                           ^

No estoy seguro de si hay algo que me olvidé de hacer.

Hola @randf102 ,

en realidad, apliqué esta modificación en Dockerfile y la compilación tuvo éxito:

```diferencia

diferencia --git a/docker/Dockerfile b/docker/Dockerfile
índice 38cc0ea..c02a110 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -10,6 +10,9 @@ ENV LD_LIBRARY_PATH /usr/local/caffe2_build/lib:${LD_LIBRARY_PATH}
# Clonar el repositorio de Detectron
EJECUTE el clon git https://github.com/facebookresearch/detectron /detectron

+WORKDIR /detectrón
+EJECUTAR git pago d56e267efc92b65b8d899f1b89a7ed2bca3e5f44
+
# Instalar dependencias de Python
EJECUTE pip install -r /detectron/requirements.txt
```

Hola @ randf102 , simplemente modifiqué el dockerfile cambiando la siguiente parte según los comentarios anteriores:

Clonar el repositorio de Detectron

EJECUTE el clon git https://github.com/facebookresearch/detectron /detectron

Basado en https://github.com/facebookresearch/Detectron/issues/756

EJECUTAR cd /detectron && git checkout d56e267

Y luego en el indicador de Linux:
nvidia-docker build -t my_detectron_image .

@francois-wellenreiter @manyaafonso
Gracias por ayudarme.
Debería modificar el Dockerfile, no ejecutar "git checkout d56e267" directamente en la terminal.
Lo he entendido y finalmente lo he construido con éxito.
¡Gracias!

@TheNeikos , gracias por tu respuesta

Pude compilar el Dockerfile con la última confirmación (7aa91aa) básicamente revirtiendo dos cambios de nombre de función, desde las confirmaciones c00e35a y 8181a32. Hecho esto agregando dos instrucciones sed después de "Instalar líneas API de COCO":

# Install the COCO API
RUN git clone https://github.com/cocodataset/cocoapi.git /cocoapi
WORKDIR /cocoapi/PythonAPI
RUN make install

# Patch
RUN sed -i 's/numel/size/g' /detectron/detectron/ops/zero_even_op.cc && \
    sed -i 's/X.dim/X.ndim/g' /detectron/detectron/ops/zero_even_op.cc
¿Fue útil esta página
0 / 5 - 0 calificaciones

Temas relacionados

rbgirshick picture rbgirshick  ·  3Comentarios

gaopeng-eugene picture gaopeng-eugene  ·  4Comentarios

Hwang-dae-won picture Hwang-dae-won  ·  3Comentarios

lilichu picture lilichu  ·  3Comentarios

kampelmuehler picture kampelmuehler  ·  4Comentarios