MMLM_EVAL / process.py
Jinapeng's picture
Add files using upload-large-folder tool
38b2c59 verified
raw
history blame contribute delete
665 Bytes
import pandas as pd
from pathlib import Path
df = pd.read_parquet("CIRR/test-00000-of-00001.parquet")
print (df.iloc[0].qry_text)
print (df.iloc[0].qry_img_path)
print (df.iloc[0].tgt_text)
print (df.iloc[0].tgt_img_path)
"""
for i in range(len(df)):
df.iloc[i].qry_text = df.iloc[i].qry_text[len("Find me an everyday image that matches the given caption:"):].strip()
assert len(df.iloc[i].tgt_text) == len(df.iloc[i].tgt_img_path)
for j in range(len(df.iloc[i].tgt_text)):
df.iloc[i].tgt_text[j] = ""
df.iloc[i].tgt_img_path[j] = str(Path("CIRR") / Path(df.iloc[i].tgt_img_path[j]).name)
"""
df.to_parquet("CIRR/modified.parquet")