Datasets:
Tasks:
Visual Question Answering
Modalities:
Image
Formats:
imagefolder
Languages:
English
Size:
< 1K
License:
Download metadata/data_json.py from Gumpest/AutoV-data: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/datasets/Gumpest/AutoV-data/resolve/main/metadata/data_json.py
- Command line
-
hf download hf://datasets/Gumpest/AutoV-data/metadata/data_json.py
-
curl -L -o data_json.py https://huggingface.co/datasets/Gumpest/AutoV-data/resolve/main/metadata/data_json.py
1.11 kB
| import json | |
| import os | |
| data = json.load(open('llava_v1_5_mix1k_filter.json')) | |
| LAYERS = [15, 20, 22, 23] | |
| collection = [] | |
| for item in data: | |
| new_item = {} | |
| image_path = item['image'] | |
| qs = item['conversations'][0]['value'] | |
| label = item['conversations'][1]['value'] | |
| idx_list =[] | |
| attn_path = [] | |
| loss_list = [] | |
| for idx, l in enumerate(LAYERS): | |
| idx_list.append(idx) | |
| attn_path.append(f'APICLIP_llava_ViT-L-14-336_{l}/1_3_BICUBIC_0/{image_path}') | |
| img = os.path.join(f'/mnt/bn/bes-mllm-shared/zhangyuan.kevin/attnmap/APICLIP_llava_ViT-L-14-336_{l}/1_3_BICUBIC_0/', image_path) | |
| # TODO: 计算loss | |
| # loss = Model(img, qs, label) | |
| loss = 1 | |
| loss_list.append(loss) | |
| new_item['image'] = item['image'] | |
| new_item['conversations'] = item['conversations'] | |
| new_item['id'] = item['id'] | |
| new_item['attn_map_path'] = attn_path | |
| new_item['attn_map_idx'] = idx_list | |
| new_item['llava_loss'] = loss_list | |
| collection.append(new_item) | |
| with open('llava_v1_5_mix1k_reward.json', 'w') as f: | |
| json.dump(collection, f, indent=4) |