Skip to content

Error in execution step -- "TypeError:can only concatenate str (not "int") to str" #10

@simran-khanuja

Description

@simran-khanuja

Hi! Thanks for the great work :)

I was running the NLVR notebook and get the following error for the first two statements. Any idea why?

TypeError                                 Traceback (most recent call last)
Cell In[15], line 1
----> 1 result, prog_state, html_str = interpreter.execute(prog,init_state,inspect=True)

File ~/visprog/engine/utils.py:38, in ProgramInterpreter.execute(self, prog, init_state, inspect)
     36 for prog_step in prog_steps:
     37     if inspect:
---> 38         step_output, step_html = self.execute_step(prog_step,inspect)
     39         html_str += str(step_html) + '<hr>'
     40     else:

File ~/visprog/engine/utils.py:24, in ProgramInterpreter.execute_step(self, prog_step, inspect)
     22 step_name = parse_step(prog_step.prog_str,partial=True)['step_name']
     23 print(step_name)
---> 24 return self.step_interpreters[step_name].execute(prog_step,inspect)

File ~/visprog/engine/step_interpreters.py:103, in EvalInterpreter.execute(self, prog_step, inspect)
    100     step_input = step_input.replace('xor','!=')
    102 step_input = step_input.format(**prog_state)
--> 103 step_output = eval(step_input)
    104 prog_step.state[output_var] = step_output
    105 if inspect:

File <string>:1

TypeError: can only concatenate str (not "int") to str

The program generated is as follows:

ANSWER0=VQA(image=LEFT,question='How many camels are in the image?')
ANSWER1=VQA(image=RIGHT,question='How many camels are in the image?')
ANSWER2=VQA(image=LEFT,question='How many people are in the image?')
ANSWER3=VQA(image=RIGHT,question='How many people are in the image?')
ANSWER4=EVAL(expr='{ANSWER0} + {ANSWER1} > {ANSWER2} + {ANSWER3}')
FINAL_ANSWER=RESULT(var=ANSWER4)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions