Skip to content

Commit 93fba26

Browse files
committed
make
1 parent 9b39abc commit 93fba26

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

examples/dreambooth/convert_to_imagefolder.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
import json
33
import pathlib
44

5+
56
parser = argparse.ArgumentParser()
67
parser.add_argument(
78
"--path",
89
type=str,
910
required=True,
1011
help="Path to folder with image-text pairs.",
1112
)
12-
parser.add_argument(
13-
"--caption_column", type=str, default="prompt", help="Name of caption column."
14-
)
13+
parser.add_argument("--caption_column", type=str, default="prompt", help="Name of caption column.")
1514
args = parser.parse_args()
1615

1716
path = pathlib.Path(args.path)
@@ -22,11 +21,7 @@
2221
captions = list(path.glob("*.txt"))
2322
images = set(all_files) - set(captions)
2423
images = {image.stem: image for image in images}
25-
caption_image = {
26-
caption: images.get(caption.stem)
27-
for caption in captions
28-
if images.get(caption.stem)
29-
}
24+
caption_image = {caption: images.get(caption.stem) for caption in captions if images.get(caption.stem)}
3025

3126
metadata = path.joinpath("metadata.jsonl")
3227

0 commit comments

Comments
 (0)