dummy-controlnet-100000-samples / prepare_dummy_dataset.py
sayakpaul's picture
sayakpaul HF staff
Create prepare_dummy_dataset.py
b405b6c
raw
history blame
723 Bytes
from datasets import Dataset, Features
from datasets import Image as ImageFeature
from datasets import Value
import numpy as np
TOTAL_SAMPLES = 100000
def gen_examples():
for _ in range(TOTAL_SAMPLES):
yield {
"image": np.random.randint(low=0, high=255, size=(512, 512, 3)),
"condtioning_image": np.random.randint(low=0, high=255, size=(512, 512, 3)),
"caption": "Killswitch engage",
}
ds = Dataset.from_generator(
gen_examples,
features=Features(
image=ImageFeature(),
condtioning_image=ImageFeature(),
caption=Value("string"),
),
num_proc=8
)
ds_name = f"dummy-controlnet-{TOTAL_SAMPLES}-samples"
ds.push_to_hub(ds_name)