From 3e40515427be0efa9586b562b719a24a269a2622 Mon Sep 17 00:00:00 2001 From: Patrick Esser Date: Sat, 23 Jul 2022 09:29:31 +0000 Subject: [PATCH] write laion examples --- ldm/data/laion.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ldm/data/laion.py b/ldm/data/laion.py index 7c07d38..e3e14a3 100644 --- a/ldm/data/laion.py +++ b/ldm/data/laion.py @@ -347,6 +347,7 @@ def example03(): dataset = (dataset .select(filter_keys) .decode('pil', handler=wds.warn_and_continue)) + n_save = 20 n_total = 0 n_large = 0 n_large_nowm = 0 @@ -356,6 +357,9 @@ def example03(): n_large += 1 if filter_watermark(example): n_large_nowm += 1 + if n_large_nowm < n_save+1: + image = example["jpg"] + image.save(os.path.join("tmp", f"{n_large_nowm-1:06}.png")) if i%500 == 0: print(i)