sayakpaul HF staff commited on
Commit
b405b6c
1 Parent(s): 896a2d6

Create prepare_dummy_dataset.py

Browse files
Files changed (1) hide show
  1. prepare_dummy_dataset.py +27 -0
prepare_dummy_dataset.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datasets import Dataset, Features
2
+ from datasets import Image as ImageFeature
3
+ from datasets import Value
4
+ import numpy as np
5
+
6
+ TOTAL_SAMPLES = 100000
7
+
8
+ def gen_examples():
9
+ for _ in range(TOTAL_SAMPLES):
10
+ yield {
11
+ "image": np.random.randint(low=0, high=255, size=(512, 512, 3)),
12
+ "condtioning_image": np.random.randint(low=0, high=255, size=(512, 512, 3)),
13
+ "caption": "Killswitch engage",
14
+ }
15
+
16
+ ds = Dataset.from_generator(
17
+ gen_examples,
18
+ features=Features(
19
+ image=ImageFeature(),
20
+ condtioning_image=ImageFeature(),
21
+ caption=Value("string"),
22
+ ),
23
+ num_proc=8
24
+ )
25
+
26
+ ds_name = f"dummy-controlnet-{TOTAL_SAMPLES}-samples"
27
+ ds.push_to_hub(ds_name)