| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
|
|
| from datasets import load_dataset |
|
|
| ds = load_dataset("lmms-lab/POPE", "default")['test'] |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
| import requests |
|
|
| annotation_urls_jsonl = [ |
| "https://raw.githubusercontent.com/YanNeu/RePOPE/refs/heads/main/annotations/coco_repope_random.json", |
| "https://raw.githubusercontent.com/YanNeu/RePOPE/refs/heads/main/annotations/coco_repope_adversarial.json", |
| "https://raw.githubusercontent.com/YanNeu/RePOPE/refs/heads/main/annotations/coco_repope_popular.json", |
| ] |
|
|
| |
| |
| import os |
| repope_index = {} |
| for url in annotation_urls_jsonl: |
| basename = os.path.splitext(os.path.basename(url))[0] |
| category = basename.split("_")[-1] |
| r = requests.get(url) |
| r.raise_for_status() |
| for line in r.text.splitlines(): |
| if not line.strip(): |
| continue |
| ann = requests.compat.json.loads(line) |
| ann["source_category"] = category |
| qid = str(ann.get("question_id")) |
| repope_index.setdefault(category, {})[qid] = ann |
|
|
| |
| count = changed = removed = 0 |
| new_examples = [] |
| for idx, example in enumerate(ds): |
| qid = str(example.get("question_id")) |
| ann = repope_index.get(example.get("category"), {}).get(qid) |
| if not ann: |
| print(f"⚠️ No annotation for idx={idx} qid={qid} category={example.get('category')}") |
| removed += 1 |
| continue |
| example['pope_old_answer'] = example['answer'] |
| if example['answer'] != ann['label']: |
| example['answer'] = ann['label'] |
| changed += 1 |
| new_examples.append(example) |
| count += 1 |
|
|
| print(f"✅ Matched {count} examples.") |
| print(f"🔄 Changed {changed} answers.") |
| print(f"❌ Removed {removed} with no annotation.") |
| print("inspection complete") |
| |
| |
| |
| from datasets import Dataset, DatasetDict |
| ds = Dataset.from_list(new_examples) |
| dataset = DatasetDict({ "test": ds}) |
| dataset.push_to_hub("SushantGautam/RePOPE") |
|
|