cvlab-columbia / viper

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

codex() returns None #45

Closed Vigelos closed 5 months ago

Vigelos commented 5 months ago

Hi, I am really confused about this error.

After I finished all the installation, I started to run main_batch.py on NExTQA dataset, and my config file is:

path_pretrained_models: './pretrained_models'       # Path to the pretrained models
execute_code: False                                 # Execute the code after generating it. Only applies to main_batch

dataset:                                            # Dataset configuration
    dataset_name: 'NExTQA'                       # Dataset name
    data_path: '/content/gdrive/MyDrive'                               # Dataset path
    split: 'test'                                       # Dataset split. If '', it assumes there is only one split
    max_samples:                                    # Maximum number of samples to load
    batch_size: 20                                  # Batch size
    start_sample:                                  # Start sample index. Only used if max_samples is not None

load_models:                                        # Which pretrained models to load
    maskrcnn: False
    clip: False
    glip: True
    owlvit: False
    tcl: False
    gpt3_qa: True
    gpt3_general: True
    depth: True
    blip: True
    saliency: False
    xvlm: True
    codex: True
    codellama: False

detect_thresholds:                                  # Thresholds for the models that perform detection
    glip: 0.5
    maskrcnn: 0.8
    owlvit: 0.1
ratio_box_area_to_image_area: 0.0                   # Any detected patch under this size will not be returned
crop_larger_margin: True                            # Increase size of crop by 10% to include more context

verify_property:                                    # Parameters for verify_property
    model: xvlm                                     # Model to use for verify_property
    thresh_clip: 0.6
    thresh_tcl: 0.25
    thresh_xvlm: 0.6

best_match_model: xvlm                              # Which model to use for best_[image, text]_match

gpt3:                                               # GPT-3 configuration
    n_votes: 1                                      # Number of tries to use for GPT-3. Use with temperature > 0
    qa_prompt: ./prompts/gpt3/gpt3_qa.txt
    guess_prompt: ./prompts/gpt3/gpt3_process_guess.txt
    temperature: 0.                                 # Temperature for GPT-3. Almost deterministic if 0
    model: text-davinci-003                         # See openai.Model.list() for available models

codex:
    temperature: 0.                                 # Temperature for Codex. (Almost) deterministic if 0
    best_of: 1                                      # Number of tries to choose from. Use when temperature > 0
    max_tokens: 512                                 # Maximum number of tokens to generate for Codex
    prompt: ./prompts/chatapi.prompt                # Codex prompt file, which defines the API. (doesn't support video for now due to token limits)
    model: gpt-3.5-turbo                            # Codex model to use. [code-davinci-002, gpt-3.5-turbo, gpt-4]. See openai.Model.list() for available models

# Saving and loading parameters
save: True                                          # Save the results to a file
save_new_results: True                              # If False, overwrite the results file
results_dir: ./results/                             # Directory to save the results
use_cache: True                                     # Use cache for the models that support it (now, GPT-3)
clear_cache: False                                  # Clear stored cache
use_cached_codex: False                             # Use previously-computed Codex results
cached_codex_path: ''                               # Path to the csv results file from which to load Codex results
log_every: 20                                       # Log accuracy every n batches
wandb: False                                        # Use Weights and Biases

blip_half_precision: True                           # Use 8bit (Faster but slightly less accurate) for BLIP if True
blip_v2_model_type: blip2-flan-t5-xxl               # Which model to use for BLIP-2

use_fixed_code: False                               # Use a fixed code for all samples (do not generate with Codex)
fixed_code_file: ./prompts/fixed_code/blip2.prompt  # Path to the fixed code file

but I got None from codex() in each iteration,

if not config.use_cached_codex:
     codes = codex(prompt=batch['query'], base_prompt=base_prompt, input_type=input_type,
     extra_context=batch['extra_context'])
(codes here is None)

I have no idea how to fix or debug this error. Is there any suggestions to locate or resolve this error. Thanks a lot.

tianzhaohaha commented 4 months ago

hi, have you finish your bug? I met the same problem...

Jungle728 commented 3 months ago

I meet the same problem. Have you ever fixed problem? Or give me some suggestion to solve.