RLHF-V / RLAIF-V

RLAIF-V: Aligning MLLMs through Open-Source AI Feedback for Super GPT-4V Trustworthiness
200 stars 6 forks source link

UnboundLocalError: local variable 'df' referenced before assignment #14

Closed Xuchen-Li closed 1 month ago

Xuchen-Li commented 1 month ago

Hello, thanks for your wonderful work. I find lines 306 - 315 in rlaif-v/muffin/eval/muffin_inference_logp.py may cause an error: UnboundLocalError: local variable 'df' referenced before assignment.

if torch.distributed.get_rank() == 0:
        step = 5000
        for idx, start in enumerate(range(0, len(out_data), step)):
            temp_data = out_data[start: min(start+step, len(out_data))]
            df = pd.DataFrame(temp_data)
            df.to_parquet(os.path.join(cache_file, f'RLAIF-V-Dataset-withlogp_{idx:03}-{len(temp_data)}.parquet'))

    torch.distributed.barrier()

    return df
RobitsG commented 1 month ago

delete "return df", which is not necessary.

Xuchen-Li commented 1 month ago

thanks!