Detectron: A instalação do Docker falha com: "não tem membro chamado 'numel'"

Criado em 19 nov. 2018  ·  13Comentários  ·  Fonte: facebookresearch/Detectron

Olá a todos,
ultimamente estou com um problema, instalando o detectron via docker. Eu falho agora com:

/usr/local/caffe2_build/include/caffe2/core/tensor.h:687:17: nota: o candidato espera 1 argumento, 0 fornecido
/detectron/detectron/ops/zero_even_op.cc:33:27: erro: 'class caffe2::Tensor<:cpucontext i="7">' não tem membro chamado 'numel'
for (auto i = 0; i < Y->numel(); i += 2) {

Encontrei um problema relacionado aqui:
https://github.com/facebookresearch/Detectron/issues/732
mas não posso usar a correção, pois o detectron está instalando diretamente do repositório. Você poderia mudar o repositório?
Desde já, obrigado,

Erik

Comentários muito úteis

Eu consegui isso trabalhando fazendo check-out d56e267 em vez do mestre mais recente

você quer dizer no Dockerfile? por exemplo

EXECUTAR git clone https://github.com/facebookresearch/detectron/detectron
EXECUTAR cd /detectron && git checkout d56e267

Todos 13 comentários

Oi, eu tenho o mesmo problema com o Dockerfile. Eu estou querendo saber se isso poderia estar relacionado à versão CUDA.

A compilação está quebrando agora. Obtendo isso:
Não existe uma compilação automatizada com suporte disso em qualquer lugar no docker hub?

Meu sistema tem outros contêineres usando CUDA que funcionam bem.

-- 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

Eu consegui isso trabalhando fazendo check-out d56e267efc92b65b8d899f1b89a7ed2bca3e5f44 em vez do mestre mais recente

@TheNeikos , também consigo trabalhar com d56e267efc92b65b8d899f1b89a7ed2bca3e5f44

Eu consegui isso trabalhando fazendo check-out d56e267 em vez do mestre mais recente

você quer dizer no Dockerfile? por exemplo

EXECUTAR git clone https://github.com/facebookresearch/detectron/detectron
EXECUTAR cd /detectron && git checkout d56e267

@beatthat sim exatamente

Obrigado @TheNeikos ! Zuckerberg deveria te dar pelo menos 10 mil euros, porque sem seu comentário eu teria desistido do Detectron e usado apenas a implementação do Matterport :D

@manyaafonso
Você se importaria de compartilhar mais detalhes sobre como você resolve esse problema, por favor?

Sigo a sugestão de @TheNeikos @beatthat @francois-wellenreiter
1.EXECUTAR git clone https://github.com/facebookresearch/detectron/detectron

  1. EXECUTAR cd /detectron && git checkout d56e267
    E então eu tentei
  2. EXECUTAR cd/docker
  3. RUN docker build -t detectron:c2-cuda9-cudnn7 .

E ainda obteve a mesma saída de erro.
Acho que git checkout d56e267 me ajuda a mudar para a versão mais antiga. E em d56e267
"/detectron/ops/zero_even_op.cc" este arquivo tem
for (auto i = 0; i < Y->size(); i += 2) {

Mas quando tento compilar, a mensagem de erro ainda aparece

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

Não tenho certeza se há algo que eu esqueci de fazer.

Olá @randf102 ,

na verdade, apliquei essa modificação no Dockerfile e a compilação foi bem-sucedida:

```diferença

diff --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}
# Clone o repositório Detectron
EXECUTAR git clone https://github.com/facebookresearch/detectron/detectron

+WORKDIR /detectron
+EXECUTAR git checkout d56e267efc92b65b8d899f1b89a7ed2bca3e5f44
+
#Instala dependências do Python
EXECUTAR pip install -r /detectron/requirements.txt
```

Oi @randf102 , eu simplesmente modifiquei o dockerfile alterando a seguinte parte conforme os comentários acima:

Clone o repositório Detectron

EXECUTAR git clone https://github.com/facebookresearch/detectron/detectron

Baseado em https://github.com/facebookresearch/Detectron/issues/756

EXECUTAR cd /detectron && git checkout d56e267

E então no prompt do linux:
nvidia-docker build -t my_detectron_image .

@francois-wellenreiter @manyaafonso
Obrigado por me ajudar.
Devo modificar o Dockerfile, não executar "git checkout d56e267" diretamente no terminal.
Eu o entendi e finalmente o construí com sucesso.
Obrigado!

@TheNeikos , obrigado pela sua resposta

Consegui compilar o Dockerfile com o último commit (7aa91aa) basicamente revertendo duas mudanças de renomeação de função, dos commits c00e35a e 8181a32. Feito isso adicionando duas instruções sed após o "Install COCO API lines":

# 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
Esta página foi útil?
0 / 5 - 0 avaliações

Questões relacionadas

kampelmuehler picture kampelmuehler  ·  4Comentários

kampelmuehler picture kampelmuehler  ·  4Comentários

743341 picture 743341  ·  4Comentários

fangpengcheng95 picture fangpengcheng95  ·  4Comentários

coldgemini picture coldgemini  ·  3Comentários