vit-gpt2 / tests /test_coco_dataset_script.py
ydshieh
creat tests dir
9b4bdf2
raw
history blame
451 Bytes
import csv
import json
import os
import datasets
import pandas as pd
import numpy as np
ds = datasets.load_dataset('./coco_dataset_script.py', data_dir='/home/33611/caption/')
ds = ds['train']
def transform(example):
example['pixel_values'] = np.load(example['pixels_file'])
return example
# ds = ds.map(transform)
n = 0
for x in ds:
n += 1
assert os.path.isfile(x['image_file'])
if n == 10:
print(x)
break