Detectron: Установка Docker завершается с ошибкой: «нет члена с именем 'numel'»

Созданный на 19 нояб. 2018  ·  13Комментарии  ·  Источник: facebookresearch/Detectron

Всем привет,
в последнее время у меня возникла проблема, установка детектрона через докер. Теперь я терплю неудачу с:

/usr/local/caffe2_build/include/caffe2/core/tensor.h:687:17: примечание: кандидат ожидает 1 аргумент, предоставлено 0
/detectron/detectron/ops/zero_even_op.cc:33:27: ошибка: 'класс caffe2::Tensor<:cpucontext i="7">' не имеет члена с именем 'numel'
for (auto i = 0; i < Y->numel(); i += 2) {

Я нашел связанную проблему здесь:
https://github.com/facebookresearch/Detectron/issues/732
но я не могу использовать исправление, так как Детектор устанавливается прямо из репозитория. Не могли бы вы изменить репозиторий?
Заранее спасибо,

Эрик

Самый полезный комментарий

Я заставил это работать, проверив d56e267 вместо последнего мастера

вы имеете в виду в Dockerfile? например

ЗАПУСК клона git https://github.com/facebookresearch/detectron/detectron
ЗАПУСК cd /detectron && git checkout d56e267

Все 13 Комментарий

Привет, у меня такая же проблема с Dockerfile. Мне интересно, может ли это быть связано с версией CUDA.

Компиляция ломается сейчас. Получение этого:
Разве в Docker Hub нет поддерживаемой автоматической сборки?

В моей системе есть другие контейнеры, использующие CUDA, которые отлично работают.

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

Я заставил это работать, проверив d56e267efc92b65b8d899f1b89a7ed2bca3e5f44 вместо последнего мастера

@TheNeikos , у меня также работает с d56e267efc92b65b8d899f1b89a7ed2bca3e5f44

Я заставил это работать, проверив d56e267 вместо последнего мастера

вы имеете в виду в Dockerfile? например

ЗАПУСК клона git https://github.com/facebookresearch/detectron/detectron
ЗАПУСК cd /detectron && git checkout d56e267

@beatthat да точно

Спасибо @TheNeikos ! Цукерберг должен дать вам как минимум 10 тысяч евро, потому что без вашего комментария я бы отказался от Detectron и использовал только реализацию Matterport :D

@manyaafonso
Не могли бы вы поделиться более подробно о том, как вы решаете эту проблему, пожалуйста?

Я следую совету @TheNeikos @beatthat @francois-wellenreiter
1. ЗАПУСТИТЕ клон git https://github.com/facebookresearch/detectron/detectron

  1. ЗАПУСК cd /detectron && git checkout d56e267
    А потом я попытался
  2. ВЫПОЛНИТЬ компакт-диск / докер
  3. ЗАПУСТИТЬ сборку докера -t детектрон: c2-cuda9-cudnn7 .

И все равно получил тот же вывод ошибки.
Я думаю, что git checkout d56e267 поможет мне перейти на более старую версию. А в д56е267
"/detectron/ops/zero_even_op.cc" этот файл имеет
for (auto i = 0; i < Y->size(); i += 2) {

Но когда я пытаюсь построить, сообщение об ошибке все еще отображается

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

Я не уверен, что я что-то забыл сделать.

Привет @randf102 ,

на самом деле я применил эту модификацию к Dockerfile, и сборка прошла успешно:

```разница

diff --git a/docker/файл Docker b/docker/файл Docker
индекс 38cc0ea..c02a110 100644
--- а/докер/Dockerfile
+++ б/докер/Dockerfile
@@ -10,6 +10,9 @@ ENV LD_LIBRARY_PATH /usr/local/caffe2_build/lib:${LD_LIBRARY_PATH}
# Клонируем репозиторий Detectron
ЗАПУСК клона git https://github.com/facebookresearch/detectron/detectron

+РАБОЧИЙ_КАТАЛОГ /detectron
+ЗАПУСТИТЬ git checkout d56e267efc92b65b8d899f1b89a7ed2bca3e5f44
+
# Установить зависимости Python
ЗАПУСК pip install -r /detectron/requirements.txt
```

Привет @ randf102 , я просто изменил файл докеры, изменив следующую часть в соответствии с комментариями выше:

Клонировать репозиторий Detectron

ЗАПУСК клона git https://github.com/facebookresearch/detectron/detectron

На основе https://github.com/facebookresearch/Detectron/issues/756

ЗАПУСК cd /detectron && git checkout d56e267

И затем в командной строке Linux:
nvidia-docker build -t my_detectron_image .

@francois-wellenreiter @manyaafonso
Спасибо за помощь мне.
Я должен изменить Dockerfile, а не запускать «git checkout d56e267» непосредственно в терминале.
Я понял это и, наконец, успешно построил его.
Спасибо!

@TheNeikos , спасибо за ответ

Мне удалось скомпилировать Dockerfile с последним коммитом (7aa91aa), в основном отменив два изменения переименования функций из коммитов c00e35a и 8181a32. Сделано это, добавив две инструкции sed после «Установить строки COCO API»:

# 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
Была ли эта страница полезной?
0 / 5 - 0 рейтинги