Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inference colab file not running #4

Open
Szransh opened this issue Sep 27, 2023 · 10 comments
Open

Inference colab file not running #4

Szransh opened this issue Sep 27, 2023 · 10 comments

Comments

@Szransh
Copy link

Szransh commented Sep 27, 2023

Hi, I am running your code. When running the code on the colab notebook that you have shared, The following error comes
upon executing the script

!python demo.py
--input "/content/Picture1.jpg"
--output "/content/outputs"
--config configs/palmira/Palmira.yaml
--opts MODEL.WEIGHTS "/content/Palmira_pb/Palmira_indiscapes.pth"


Using /root/.cache/torch_extensions/py310_cu118 as PyTorch extensions root...
Detected CUDA files, patching ldflags
Emitting ninja build file /root/.cache/torch_extensions/py310_cu118/check_condition_bbox/build.ninja...
Building extension module check_condition_bbox...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/3] c++ -MMD -MF check_condition_lattice.o.d -DTORCH_EXTENSION_NAME=check_condition_bbox -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /usr/local/lib/python3.10/dist-packages/torch/include -isystem /usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/lib/python3.10/dist-packages/torch/include/TH -isystem /usr/local/lib/python3.10/dist-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /usr/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++17 -c /content/Palmira_pb/defgrid/layers/DefGrid/check_condition_lattice_bbox/check_condition_lattice.cpp -o check_condition_lattice.o
FAILED: check_condition_lattice.o
c++ -MMD -MF check_condition_lattice.o.d -DTORCH_EXTENSION_NAME=check_condition_bbox -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /usr/local/lib/python3.10/dist-packages/torch/include -isystem /usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/lib/python3.10/dist-packages/torch/include/TH -isystem /usr/local/lib/python3.10/dist-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /usr/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++17 -c /content/Palmira_pb/defgrid/layers/DefGrid/check_condition_lattice_bbox/check_condition_lattice.cpp -o check_condition_lattice.o
/content/Palmira_pb/defgrid/layers/DefGrid/check_condition_lattice_bbox/check_condition_lattice.cpp:1:10: fatal error: THC/THC.h: No such file or directory
1 | #include <THC/THC.h>
| ^~~~~~~~~~~
compilation terminated.
[2/3] /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=check_condition_bbox -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /usr/local/lib/python3.10/dist-packages/torch/include -isystem /usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/lib/python3.10/dist-packages/torch/include/TH -isystem /usr/local/lib/python3.10/dist-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /usr/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS
-D__CUDA_NO_BFLOAT16_CONVERSIONS
-D__CUDA_NO_HALF2_OPERATORS
--expt-relaxed-constexpr -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 --compiler-options '-fPIC' -std=c++17 -c /content/Palmira_pb/defgrid/layers/DefGrid/check_condition_lattice_bbox/check_condition_lattice_for2.cu -o check_condition_lattice_for2.cuda.o
FAILED: check_condition_lattice_for2.cuda.o
/usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=check_condition_bbox -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /usr/local/lib/python3.10/dist-packages/torch/include -isystem /usr/local/lib/python3.10/dist-packages/torch/include/torch/csrc/api/include -isystem /usr/local/lib/python3.10/dist-packages/torch/include/TH -isystem /usr/local/lib/python3.10/dist-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /usr/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS
-D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 --compiler-options '-fPIC' -std=c++17 -c /content/Palmira_pb/defgrid/layers/DefGrid/check_condition_lattice_bbox/check_condition_lattice_for2.cu -o check_condition_lattice_for2.cuda.o
/content/Palmira_pb/defgrid/layers/DefGrid/check_condition_lattice_bbox/check_condition_lattice_for2.cu:5:10: fatal error: THC/THC.h: No such file or directory
5 | #include <THC/THC.h>
| ^~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 1893, in _run_ninja_build
subprocess.run(
File "/usr/lib/python3.10/subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/content/Palmira_pb/demo.py", line 14, in
from defgrid.config import add_defgrid_maskhead_config
File "/content/Palmira_pb/defgrid/init.py", line 2, in
from .mask_head import DefGridHead
File "/content/Palmira_pb/defgrid/mask_head.py", line 17, in
from defgrid.layers.DefGrid.diff_variance import LatticeVariance
File "/content/Palmira_pb/defgrid/layers/DefGrid/diff_variance.py", line 7, in
from defgrid.layers.DefGrid.check_condition_lattice_bbox.utils import check_condition_f_bbox
File "/content/Palmira_pb/defgrid/layers/DefGrid/check_condition_lattice_bbox/utils.py", line 10, in
check_condition = load(
File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 1284, in load
return _jit_compile(
File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 1509, in _jit_compile
_write_ninja_file_and_build_library(
File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 1624, in _write_ninja_file_and_build_library
_run_ninja_build(
File "/usr/local/lib/python3.10/dist-packages/torch/utils/cpp_extension.py", line 1909, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error building extension 'check_condition_bbox'

@Syzygianinfern0
Copy link
Member

As far as I remember, the codebase is heavily sensitive to CUDA/CUDnn versions. Perhaps Colab has updated their versions and our code does not run anymore on it :(

@Szransh
Copy link
Author

Szransh commented Sep 27, 2023

Can you please help us by suggesting how we should run the same on colab? or providing us with the correct versions of CUDA/CUDnn versions so maybe I can try running it locally.

@Syzygianinfern0
Copy link
Member

Syzygianinfern0 commented Sep 27, 2023

  • The model code might need some updating to make it work with colab so that it supports newer CUDA versions. This might need some digging into each of these functions which say they do not exist anymore and find their new equivalent APIs.
  • You can find the versions with which we ran our experiments here. You can try setting this up locally and you should have it up and running!

@Szransh
Copy link
Author

Szransh commented Sep 27, 2023

Hi, there is an inherent mismatch between the torch and torch vision modules you gave. I could run the script using Pytorch 1.8.0 with torch vision 0.9.0 and Cuda toolkit 11.1 and download the detectron2 version corresponding to the same while utilising the requirements.txt file for other packages. The image is segmented for now.
However, on running the following command
input = cv2.imread("./images/test.jpg") # recieving the input image
input = input[:,:,::-1]
showoutput(input)

I get the error: No such file or directory: './outputs/data.json
please help me with this

@Szransh
Copy link
Author

Szransh commented Sep 27, 2023

No such file is generated. Is there any fix?? I need the json files so that I can have the coordinates of bounding box which I can later use for cropping.

@Syzygianinfern0
Copy link
Member

Where is this showoutput(input)?

@Szransh
Copy link
Author

Szransh commented Sep 27, 2023

It is part of your colab notebook. In your notebook itself the same error is showing as uploaded by you.

@Szransh
Copy link
Author

Szransh commented Sep 28, 2023

Is there any way that I can access the json file containing the co-ordinates for each line because I wanted use that information for further processing.

@Syzygianinfern0
Copy link
Member

I see, thanks for bring this to my attention. I just realized that I am infact not the author of that colab notebook. From the
revision history, it is from my co-authors and other collaborators at the lab.

But from looking at code from colab notebook, the JSON seems to be from performing manual annotations using an annotation tool. I am not totally sure. I suppose you can find GT annotations from the dataset.

There is also an older version of the colab notebook in its revision history which I located and does not have this error: Link.

I shall get back to you on this soon!

@Syzygianinfern0
Copy link
Member

I would recommend you to use Seamformer instead which is a follow-up work from our lab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants