Jittor / JNeRF

JNeRF is a NeRF benchmark based on Jittor. JNeRF re-implemented instant-ngp and achieved same performance with original paper.
Apache License 2.0
640 stars 74 forks source link

windows wsl: RuntimeError: Wrong inputs arguments, Please refer to examples(help(jt.ops.array)) #42

Open tlightsky opened 2 years ago

tlightsky commented 2 years ago

image

tlightsky commented 2 years ago
(base) width@width:/mnt/d/source/py/JNeRF$ conda create -n jnerf38 python=3.8
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/width/mambaforge/envs/jnerf38

  added / updated specs:
    - python=3.8

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    setuptools-65.0.1          |   py38h578d9bd_0         1.3 MB  conda-forge
    ------------------------------------------------------------
                                           Total:         1.3 MB

The following NEW packages will be INSTALLED:

  _libgcc_mutex      conda-forge/linux-64::_libgcc_mutex-0.1-conda_forge
  _openmp_mutex      conda-forge/linux-64::_openmp_mutex-4.5-2_gnu
  bzip2              conda-forge/linux-64::bzip2-1.0.8-h7f98852_4
  ca-certificates    conda-forge/linux-64::ca-certificates-2022.6.15-ha878542_0
  ld_impl_linux-64   conda-forge/linux-64::ld_impl_linux-64-2.36.1-hea4e1c9_2
  libffi             conda-forge/linux-64::libffi-3.4.2-h7f98852_5
  libgcc-ng          conda-forge/linux-64::libgcc-ng-12.1.0-h8d9b700_16
  libgomp            conda-forge/linux-64::libgomp-12.1.0-h8d9b700_16
  libnsl             conda-forge/linux-64::libnsl-2.0.0-h7f98852_0
  libsqlite          conda-forge/linux-64::libsqlite-3.39.2-h753d276_1
  libuuid            conda-forge/linux-64::libuuid-2.32.1-h7f98852_1000
  libzlib            conda-forge/linux-64::libzlib-1.2.12-h166bdaf_2
  ncurses            conda-forge/linux-64::ncurses-6.3-h27087fc_1
  openssl            conda-forge/linux-64::openssl-3.0.5-h166bdaf_1
  pip                conda-forge/noarch::pip-22.2.2-pyhd8ed1ab_0
  python             conda-forge/linux-64::python-3.8.13-ha86cf86_0_cpython
  python_abi         conda-forge/linux-64::python_abi-3.8-2_cp38
  readline           conda-forge/linux-64::readline-8.1.2-h0f457ee_0
  setuptools         conda-forge/linux-64::setuptools-65.0.1-py38h578d9bd_0
  sqlite             conda-forge/linux-64::sqlite-3.39.2-h4ff8645_1
  tk                 conda-forge/linux-64::tk-8.6.12-h27826a3_0
  wheel              conda-forge/noarch::wheel-0.37.1-pyhd8ed1ab_0
  xz                 conda-forge/linux-64::xz-5.2.6-h166bdaf_0

Proceed ([y]/n)? y

Downloading and Extracting Packages
setuptools-65.0.1    | 1.3 MB    | ############################################################################# | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate jnerf38
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(base) width@width:/mnt/d/source/py/JNeRF$ conda activate jnerf38
(jnerf38) width@width:/mnt/d/source/py/JNeRF$ pip install -r requirements.txt
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting jittor>=1.3.4.13
  Using cached jittor-1.3.5.9-py3-none-any.whl
Collecting numpy
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/2c/5b/ba2f6d662dfc0c8c9927c05faf2e722a7a7f417ad4665800f819174b818f/numpy-1.23.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB)
Collecting tqdm
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/8a/c4/d15f1e627fff25443ded77ea70a7b5532d6371498f9285d44d62587e209c/tqdm-4.64.0-py2.py3-none-any.whl (78 kB)
Collecting opencv-python
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/af/bf/8d189a5c43460f6b5c8eb81ead8732e94b9f73ef8d9abba9e8f5a61a6531/opencv_python-4.6.0.66-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (60.9 MB)
Collecting Pillow
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d8/80/ff6b6ae88982f73d050907dc2c307f387f6a04ce2ca7230ef3a568fbccac/Pillow-9.2.0-cp38-cp38-manylinux_2_28_x86_64.whl (3.2 MB)
Collecting imageio
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/19/ea/fe0cf58fe26999fc22b7cc75215a6093e1f9e146b747b1c39ad7ed320e92/imageio-2.21.1-py3-none-any.whl (3.4 MB)
Collecting pyyaml
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d7/42/7ad4b6d67a16229496d4f6e74201bdbebcf4bc1e87d5a70c9297d4961bd2/PyYAML-6.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (701 kB)
Collecting astunparse
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/2b/03/13dde6512ad7b4557eb792fbcf0c653af6076b81e5941d36ec61f7ce6028/astunparse-1.6.3-py2.py3-none-any.whl (12 kB)
Requirement already satisfied: wheel<1.0,>=0.23.0 in /home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages (from astunparse->jittor>=1.3.4.13->-r requirements.txt (line 1)) (0.37.1)
Collecting six<2.0,>=1.6.1
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: tqdm, six, pyyaml, Pillow, numpy, opencv-python, imageio, astunparse, jittor
Successfully installed Pillow-9.2.0 astunparse-1.6.3 imageio-2.21.1 jittor-1.3.5.9 numpy-1.23.2 opencv-python-4.6.0.66 pyyaml-6.0 six-1.16.0 tqdm-4.64.0
(jnerf38) width@width:/mnt/d/source/py/JNeRF$ cd python
(jnerf38) width@width:/mnt/d/source/py/JNeRF/python$ pip install -e .
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Obtaining file:///mnt/d/source/py/JNeRF/python
  Preparing metadata (setup.py) ... done
Requirement already satisfied: jittor>=1.3.4.13 in /home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages (from jnerf==0.1.0) (1.3.5.9)
Requirement already satisfied: numpy in /home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages (from jnerf==0.1.0) (1.23.2)
Requirement already satisfied: tqdm in /home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages (from jnerf==0.1.0) (4.64.0)
Requirement already satisfied: opencv-python in /home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages (from jnerf==0.1.0) (4.6.0.66)
Requirement already satisfied: Pillow in /home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages (from jnerf==0.1.0) (9.2.0)
Requirement already satisfied: imageio in /home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages (from jnerf==0.1.0) (2.21.1)
Requirement already satisfied: pyyaml in /home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages (from jnerf==0.1.0) (6.0)
Requirement already satisfied: astunparse in /home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages (from jittor>=1.3.4.13->jnerf==0.1.0) (1.6.3)
Requirement already satisfied: wheel<1.0,>=0.23.0 in /home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages (from astunparse->jittor>=1.3.4.13->jnerf==0.1.0) (0.37.1)
Requirement already satisfied: six<2.0,>=1.6.1 in /home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages (from astunparse->jittor>=1.3.4.13->jnerf==0.1.0) (1.16.0)
Installing collected packages: jnerf
  Running setup.py develop for jnerf
Successfully installed jnerf-0.1.0
(jnerf38) width@width:/mnt/d/source/py/JNeRF/python$ cd ..
(jnerf38) width@width:/mnt/d/source/py/JNeRF$ python tools/run_net.py --config-file ./projects/ngp/configs/ngp_base.py
[i 0817 12:06:22.069915 44 compiler.py:955] Jittor(1.3.5.9) src: /home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages/jittor
[i 0817 12:06:22.072268 44 compiler.py:956] g++ at /usr/bin/g++(9.4.0)
[i 0817 12:06:22.072314 44 compiler.py:957] cache_path: /home/width/.cache/jittor/jt1.3.5/g++9.4.0/py3.8.13/Linux-5.10.16.x27/12thGenIntelRCx51/default
[i 0817 12:06:22.311053 44 install_cuda.py:88] cuda_driver_version: [11, 6]
[i 0817 12:06:22.311228 44 install_cuda.py:76] restart /home/width/mambaforge/envs/jnerf38/bin/python ['tools/run_net.py', '--config-file', './projects/ngp/configs/ngp_base.py']
[i 0817 12:06:22.453702 40 compiler.py:955] Jittor(1.3.5.9) src: /home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages/jittor
[i 0817 12:06:22.457734 40 compiler.py:956] g++ at /usr/bin/g++(9.4.0)
[i 0817 12:06:22.457788 40 compiler.py:957] cache_path: /home/width/.cache/jittor/jt1.3.5/g++9.4.0/py3.8.13/Linux-5.10.16.x27/12thGenIntelRCx51/default
[i 0817 12:06:22.606851 40 install_cuda.py:88] cuda_driver_version: [11, 6]
[i 0817 12:06:22.615981 40 __init__.py:411] Found /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/bin/nvcc(11.2.152) at /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/bin/nvcc.
[i 0817 12:06:22.661263 40 __init__.py:411] Found addr2line(2.34) at /usr/bin/addr2line.
[i 0817 12:06:22.763265 40 compiler.py:1010] cuda key:cu11.2.152_sm_
[e 0817 12:06:26.594820 40 compiler.py:886] jit_utils updated, please rerun your command.
(jnerf38) width@width:/mnt/d/source/py/JNeRF$ python tools/run_net.py --config-file ./projects/ngp/configs/ngp_base.py
[i 0817 12:06:40.878620 52 compiler.py:955] Jittor(1.3.5.9) src: /home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages/jittor
[i 0817 12:06:40.880397 52 compiler.py:956] g++ at /usr/bin/g++(9.4.0)
[i 0817 12:06:40.880450 52 compiler.py:957] cache_path: /home/width/.cache/jittor/jt1.3.5/g++9.4.0/py3.8.13/Linux-5.10.16.x27/12thGenIntelRCx51/default
[i 0817 12:06:41.021549 52 install_cuda.py:88] cuda_driver_version: [11, 6]
[i 0817 12:06:41.021719 52 install_cuda.py:76] restart /home/width/mambaforge/envs/jnerf38/bin/python ['tools/run_net.py', '--config-file', './projects/ngp/configs/ngp_base.py']
[i 0817 12:06:41.157142 44 compiler.py:955] Jittor(1.3.5.9) src: /home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages/jittor
[i 0817 12:06:41.160295 44 compiler.py:956] g++ at /usr/bin/g++(9.4.0)
[i 0817 12:06:41.160347 44 compiler.py:957] cache_path: /home/width/.cache/jittor/jt1.3.5/g++9.4.0/py3.8.13/Linux-5.10.16.x27/12thGenIntelRCx51/default
[i 0817 12:06:41.308999 44 install_cuda.py:88] cuda_driver_version: [11, 6]
[i 0817 12:06:41.314697 44 __init__.py:411] Found /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/bin/nvcc(11.2.152) at /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/bin/nvcc.
[i 0817 12:06:41.356138 44 __init__.py:411] Found addr2line(2.34) at /usr/bin/addr2line.
[i 0817 12:06:41.455521 44 compiler.py:1010] cuda key:cu11.2.152_sm_
[i 0817 12:06:41.662092 44 __init__.py:227] Total mem: 31.24GB, using 10 procs for compiling.
Compiling jittor_core(148/148) used: 19.421s eta: 0.000s
[i 0817 12:07:01.351093 44 jit_compiler.cc:28] Load cc_path: /usr/bin/g++
[i 0817 12:07:01.919761 44 init.cc:62] Found cuda archs: [86,]
[i 0817 12:07:02.058015 44 compile_extern.py:517] mpicc not found, distribution disabled.
Compiling gen_ops_mkl_conv_mkl_matmul_mkl_conv_backward_w_mk___hash484cd2(7/7) used: 2.048s eta: 0.000s
[i 0817 12:07:08.488791 44 compile_extern.py:30] found /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/include/cublas.h
[i 0817 12:07:08.496698 44 compile_extern.py:30] found /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/lib64/libcublas.so
[i 0817 12:07:08.496773 44 compile_extern.py:30] found /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/lib64/libcublasLt.so.11
[i 0817 12:07:11.066808 44 compile_extern.py:30] found /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/include/cudnn.h
[i 0817 12:07:11.081048 44 compile_extern.py:30] found /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/lib64/libcudnn.so.8
[i 0817 12:07:11.081129 44 compile_extern.py:30] found /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/lib64/libcudnn_ops_infer.so.8
[i 0817 12:07:11.093157 44 compile_extern.py:30] found /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/lib64/libcudnn_ops_train.so.8
[i 0817 12:07:11.095360 44 compile_extern.py:30] found /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/lib64/libcudnn_cnn_infer.so.8
[i 0817 12:07:11.193319 44 compile_extern.py:30] found /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/lib64/libcudnn_cnn_train.so.8
Compiling gen_ops_cudnn_test_cudnn_conv_backward_w_cudnn_con___hash306483(16/16) used: 3.239s eta: 0.000s
[i 0817 12:07:15.379142 44 compile_extern.py:30] found /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/include/curand.h
[i 0817 12:07:15.396268 44 compile_extern.py:30] found /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/lib64/libcurand.so
[i 0817 12:07:16.442393 44 compile_extern.py:30] found /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/include/cufft.h
[i 0817 12:07:16.460262 44 compile_extern.py:30] found /home/width/.cache/jittor/jtcuda/cuda11.2_cudnn8_linux/lib64/libcufft.so
[i 0817 12:07:17.731944 44 cuda_flags.cc:32] CUDA enabled.

Compiling Operators(1/1) used: 3.48s eta:    0s
[i 0817 12:07:21.305857 44 cuda_flags.cc:32] CUDA enabled.
[i 0817 12:07:21.422816 44 cuda_flags.cc:32] CUDA enabled.
[i 0817 12:07:21.433455 44 cuda_flags.cc:32] CUDA enabled.
[i 0817 12:07:21.443358 44 cuda_flags.cc:32] CUDA enabled.
[i 0817 12:07:21.453608 44 cuda_flags.cc:32] CUDA enabled.
[i 0817 12:07:21.462794 44 cuda_flags.cc:32] CUDA enabled.
[i 0817 12:07:21.471320 44 cuda_flags.cc:32] CUDA enabled.
[i 0817 12:07:21.481546 44 cuda_flags.cc:32] CUDA enabled.
[i 0817 12:07:21.489812 44 cuda_flags.cc:32] CUDA enabled.
[i 0817 12:07:21.588337 44 cuda_flags.cc:32] CUDA enabled.
Loading config from:  ./projects/ngp/configs/ngp_base.py
load train data
100%|█████████████████████████████████████████████████████████████████████████████████| 200/200 [00:09<00:00, 20.59it/s]
Traceback (most recent call last):
  File "tools/run_net.py", line 54, in <module>
    main()
  File "tools/run_net.py", line 44, in main
    runner = Runner()
  File "/mnt/d/source/py/JNeRF/python/jnerf/runner/runner.py", line 24, in __init__
    self.dataset["train"]   = build_from_cfg(self.cfg.dataset.train, DATASETS)
  File "/mnt/d/source/py/JNeRF/python/jnerf/utils/registry.py", line 33, in build_from_cfg
    module = obj_cls(**args)
  File "/mnt/d/source/py/JNeRF/python/jnerf/dataset/dataset.py", line 111, in __init__
    self.load_data()
  File "/mnt/d/source/py/JNeRF/python/jnerf/dataset/dataset.py", line 219, in load_data
    self.image_data=jt.array(self.image_data)
  File "/home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages/jittor/__init__.py", line 323, in array
    ret = ops.array(data)
RuntimeError: Wrong inputs arguments, Please refer to examples(help(jt.ops.array)).

Types of your inputs are:
 self   = module,
 args   = (list, ),

The function declarations are:
 VarHolder* array__(PyObject* obj)

Failed reason:[f 0817 12:07:34.331928 44 helper_cuda.h:128] CUDA error at /home/width/mambaforge/envs/jnerf38/lib/python3.8/site-packages/jittor/src/mem/allocator/cuda_host_allocator.cc:22  code=2( cudaErrorMemoryAllocation ) cudaMallocHost(&ptr, size)
(jnerf38) width@width:/mnt/d/source/py/JNeRF$
gdhy9064 commented 2 years ago

You can try to use np.array(self.image_data) instead of jt.array(self.image_data), and change

if self.img_alpha and self.image_data.shape[-1]==3:
        self.image_data=jt.concat([self.image_data,jt.ones(self.image_data.shape[:-1]+(1,))],-1).stop_grad()

to

if self.img_alpha and self.image_data.shape[-1]==3:
        self.image_data=np.concatenate([self.image_data,np.ones([*self.image_data.shape[:-1],1])],-1)

as well as

self.image_data = self.image_data.reshape(
        self.n_images, -1, 4).detach()

to

self.image_data = self.image_data.reshape(
        self.n_images, -1, 4)

in JNeRF/python/jnerf/dataset/dataset.py.

XiangFeng66 commented 2 years ago

I tried it, still the same error