mertyg / vision-language-models-are-bows

Experiments and data for the paper "When and why vision-language models behave like bags-of-words, and what to do about it?" Oral @ ICLR 2023
MIT License
222 stars 14 forks source link

why concat df to all_df? #5

Closed lezhang7 closed 1 year ago

lezhang7 commented 1 year ago

I don't understand why need to concat df to all_df

if os.path.exists(output_file):
        all_df = pd.read_csv(output_file, index_col=0)
        all_df = pd.concat([all_df, df])
        all_df.to_csv(output_file)
    else:
        all_df=df
        all_df.to_csv(output_file)
vinid commented 1 year ago

It's to incrementally save the results. If a csv already exists, we don't want to delete it, we just want to save the additional result

In this way we can run the script multiple times without overwriting past runs every time