cvlab-columbia / viper

Code for the paper "ViperGPT: Visual Inference via Python Execution for Reasoning"
Other
1.65k stars 115 forks source link

How to debug in viper? #12

Closed aniki-ly closed 1 year ago

aniki-ly commented 1 year ago

Hi, I'm attempting to replicate the quantitative results of ViperGPT on the RefCOCO dataset, but I've run into an issue. Specifically, the code appears to halt after loading the DepthEstimation mode, without issuing any error message. Additionally, attempts to debug the issue using print or pdb methods have proven unsuccessful.

Could you please provide guidance on how to resolve this problem? Any assistance would be greatly appreciated.

surisdi commented 1 year ago

I used PyCharm to debug and I didn't have any problems. You can also try removing the calls to HiddenPrints, for example commenting out the line with HiddenPrints('DepthEstimation'):.

I would also recommend running the code with multiprocessing=False for debugging purposes.

aniki-ly commented 1 year ago

@surisdi Thank you for your response! I have attempted to remove the calls to HiddenPrints and set multiprocessing=False, even though it is already set to False by default. However, I still cannot obtain any error messages from the code, and it stops working after printing "Loading DepthEstimation."

surisdi commented 1 year ago

It looks like HiddenPrints is still being used, as the Loading DepthEstimation is printed there. Can you comment out this line ? (and re-indent the following lines)

aniki-ly commented 1 year ago

@surisdi Thanks for your reply. After comment out HiddenPrints, the output as follows:

>>> from main_simple_lib import * Loading BLIP... 2023-04-10 14:29:11.216309: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX512F FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. This model has some weights that should be kept in higher precision, you need to upgrade accelerate to properly deal with them (pip install --upgrade accelerate). BLIP loaded >>>

surisdi commented 1 year ago

It looks like there wasn't any error (the messages are all warnings). You can try upgrading accelerate to address the last warning. But the code should work regardless. Do you find any error after that?

aniki-ly commented 1 year ago

You're correct that there isn't any error. However, it should load more models, such as CLIP, etc. Additionally, after running "from main_simple_lib import *", my terminal seems to fail at executing any subsequent commands as shown below:

>>> from main_simple_lib import * Loading BLIP... 2023-04-10 15:32:05.337230: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX512F FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. This model has some weights that should be kept in higher precision, you need to upgrade accelerate to properly deal with them (pip install --upgrade accelerate). BLIP loaded >>> load_image('https://wondermamas.com/wp-content/uploads/2020/04/IMG_8950-min-1024x1024.jpg') >>> get_code(query) >>> execute_code(code, im, show_intermediate_steps=False) >>> lbhjdwa >>>

surisdi commented 1 year ago

CLIP should not be loaded by default. The list of models that are used (and loaded) is here in the config.

Can you show the code that you obtain from get_code? Also, are you running this on a Jupyter Notebook?

aniki-ly commented 1 year ago

The get_code(query) function does not return any code and I am currently running it on the Python interactive shell. I have successfully run it on Jupyter Notebook.