YangLing0818/RPG-DiffusionMaster

Error occurs for parsing gpt4's response

Genie-Kim opened this issue · 4 comments

Thanks for sharing your great work.

However, when I run RPG.py, I get an error like below.

NameError: name 'final_split_ratio' is not defined

I've tried changing the regex in mllm.py's get_params_dict function, but gpt4's response is giving me a response that doesn't match it, so I frequently get parsing errors.
like this :

### Final Output

**Overall split ratio:**
1;1;1

This is also the case with the regional prompt.

If anyone has solved this, please help😭

Similar Error I got,

Traceback (most recent call last): File "/run/determined/workdir/home/RPG-DiffusionMaster/test.py", line 51, in <module> images = pipe( File "/opt/conda/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context return func(*args, **kwargs) File "/run/determined/workdir/home/RPG-DiffusionMaster/RegionalDiffusion_base.py", line 901, in __call__ matrixdealer(self,self.split_ratio,self.base_ratio) File "/run/determined/workdir/home/RPG-DiffusionMaster/matrix.py", line 248, in matrixdealer baseratio = baseratio2

UnboundLocalError: local variable 'baseratio2' referenced before assignment

I have also encountered similar problems, whether using llama or gpt4.

I am also observing similar problems. Sometimes the GPT4 output has:

#### c. Overall Ratio:
We need to combine the heights and widths in the specified format.
- Row0_height,Row0_region0_width,Row0_region1_width;Row1_height,Row1_region2_width,Row1_region3_width
- Final split ratio: 0.5,0.5,0.5;0.5,0.5,0.5

And split_ratio_match = re.search(r"Final split ratio: ([\d.,;]+)", response) in mllm.get_params_dict(output_text) can find the split ratio.

Other times the GPT4 output just has:

 ### Final Output 
 - **Final Split Ratio:** 0.5,0.5,0.5;0.5,0.5,0.5

And split_ratio_match = re.search(r"Final split ratio: ([\d.,;]+)", response) in mllm.get_params_dict(output_text) doesn't find anything, even though we see the data is there.

I'm not understanding why the same prompt returns inconsistent output text. This is using the example prompt: ' A handsome young man with blonde curly hair and black suit with a black twintail girl in red cheongsam in the bar.'

For whatever reason I encounter fewer of these parsing errors using the gpt-4o-mini or older gpt-4 models.