The viewer is disabled because this dataset repo requires arbitrary Python code execution. Please consider removing the loading script and relying on automated data support (you can use convert_to_parquet from the datasets library). If this is not possible, please open a discussion for direct help.

CleanFID:

FID: 18.9796, KID: 0.0145976

Then another measurement (torchmetrics FID and CleanFID simultaneously):

torchmetrics FID: 19.3133
CleanFID FID: 19.1283, KID: 0.0147355

Read from the webdataset (after saving it somewhere on your disk) like this:

from webdataset import WebDataset
from typing import TypedDict, Iterable
from PIL import Image
from PIL.PngImagePlugin import PngImageFile
from io import BytesIO
from os import makedirs

Example = TypedDict('Example', {
  '__key__': str,
  '__url__': str,
  'img.png': bytes,
})

dataset = WebDataset('./openai-guided-diffusion-256-classcond-unguided-samples-50k/{00000..00004}.tar')

out_root = 'out'
makedirs(out_root, exist_ok=True)

it: Iterable[Example] = iter(dataset)
for ix, item in enumerate(it):
  with BytesIO(item['img.png']) as stream:
    img: PngImageFile = Image.open(stream)
    img.load()
  img.save(f'{out_root}/{ix}.png')

Or from the HF dataset like this:

from datasets import load_dataset
from datasets.dataset_dict import DatasetDict
from datasets.arrow_dataset import Dataset
from PIL.PngImagePlugin import PngImageFile
from typing import TypedDict, Iterable
from os import makedirs

class Item(TypedDict):
  index: int
  tar: str
  tar_path: str
  img: PngImageFile

dataset: DatasetDict = load_dataset('Birchlabs/openai-guided-diffusion-256-classcond-unguided-samples-50k')
train: Dataset = dataset['train']

out_root = 'out'
makedirs(out_root, exist_ok=True)

it: Iterable[Item] = iter(train)
for item in it:
  item['img'].save(f'{out_root}/{item["index"]}.png')
Downloads last month
51