commit 1f0e99405b3b86037941850149ebf98910beb0bb Author: float trip Date: Thu Dec 8 04:26:34 2022 +0000 . diff --git a/gpt-j/preprocess_comments.py b/gpt-j/preprocess_comments.py new file mode 100644 index 0000000..656e1c1 --- /dev/null +++ b/gpt-j/preprocess_comments.py @@ -0,0 +1,56 @@ +import numpy as np + + +class Comment: + by_id = {} + + def __init__(self, line): + parts = line.split("\t") + self.comment_id = int(parts[0]) + self.parent_id = int(parts[2]) if parts[2] != "\\N" else None + self.author_id = int(parts[1]) + self.body = parts[3].replace("\\r\\n", "\n").replace("\\n", "\n").strip() + + self.parent = None + self.children = [] + + self.by_id[self.comment_id] = self + + +with open("drama.csv") as f: + comments = [Comment(l) for l in f.readlines()] + +for c in comments: + if c.parent_id: + if c.parent_id in Comment.by_id: + c.parent = Comment.by_id[c.parent_id] + c.parent.children.append(c) + else: + c.parent_id = -1 + + +def render_threads(c): + threads = [] + # Use a more unique separator in the future that doesn't conflict with Markdown. + text = f"--- {c.author_id} ---\n{c.body}\n\n" + + if not c.children: + return [text] + + for child in c.children: + child_threads = render_threads(child) + for t in child_threads: + threads.append(text + t) + + return threads + + +threads = [] +for c in comments: + if c.parent_id is None and c.author_id != 261 and c.children: + threads += [t.strip() for t in render_threads(c)] + +np.random.shuffle(threads) + +with open("train.txt", "w") as f: + f.write("<|endoftext|>".join(threads)) diff --git a/gpt-j/readme.md b/gpt-j/readme.md new file mode 100644 index 0000000..8006d19 --- /dev/null +++ b/gpt-j/readme.md @@ -0,0 +1,3 @@ +* [Fine-tuning guide](https://github.com/kingoflolz/mesh-transformer-jax/blob/master/howto_finetune.md) + * [Updated config instructions for the TPU machine](https://github.com/kingoflolz/mesh-transformer-jax/issues/202#issuecomment-1050887576) +* Fits on a free tier Oracle Cloud machine with 24GB RAM and 16GB of swap. diff --git a/gpt-j/readme.md.tmp b/gpt-j/readme.md.tmp new file mode 100644 index 0000000..8006d19 --- /dev/null +++ b/gpt-j/readme.md.tmp @@ -0,0 +1,3 @@ +* [Fine-tuning guide](https://github.com/kingoflolz/mesh-transformer-jax/blob/master/howto_finetune.md) + * [Updated config instructions for the TPU machine](https://github.com/kingoflolz/mesh-transformer-jax/issues/202#issuecomment-1050887576) +* Fits on a free tier Oracle Cloud machine with 24GB RAM and 16GB of swap. diff --git a/stable-diffusion/marseys/1 - Marsey as a jack-o-lantern.png b/stable-diffusion/marseys/1 - Marsey as a jack-o-lantern.png new file mode 100644 index 0000000..342e6d5 Binary files /dev/null and b/stable-diffusion/marseys/1 - Marsey as a jack-o-lantern.png differ diff --git a/stable-diffusion/marseys/1 - Marsey as a reindeer.png b/stable-diffusion/marseys/1 - Marsey as a reindeer.png new file mode 100644 index 0000000..bbe4edb Binary files /dev/null and b/stable-diffusion/marseys/1 - Marsey as a reindeer.png differ diff --git a/stable-diffusion/marseys/1 - Marsey crying.png b/stable-diffusion/marseys/1 - Marsey crying.png new file mode 100644 index 0000000..955a19e Binary files /dev/null and b/stable-diffusion/marseys/1 - Marsey crying.png differ diff --git a/stable-diffusion/marseys/1 - Marsey dressed as Gandalf.png b/stable-diffusion/marseys/1 - Marsey dressed as Gandalf.png new file mode 100644 index 0000000..92d8e33 Binary files /dev/null and b/stable-diffusion/marseys/1 - Marsey dressed as Gandalf.png differ diff --git a/stable-diffusion/marseys/1 - Marsey dressed as Santa with a bag of presents.png b/stable-diffusion/marseys/1 - Marsey dressed as Santa with a bag of presents.png new file mode 100644 index 0000000..00fd3d3 Binary files /dev/null and b/stable-diffusion/marseys/1 - Marsey dressed as Santa with a bag of presents.png differ diff --git a/stable-diffusion/marseys/1 - Marsey dressed as a cop.png b/stable-diffusion/marseys/1 - Marsey dressed as a cop.png new file mode 100644 index 0000000..aae3891 Binary files /dev/null and b/stable-diffusion/marseys/1 - Marsey dressed as a cop.png differ diff --git a/stable-diffusion/marseys/1 - Marsey dressed one of Santa's elves.png b/stable-diffusion/marseys/1 - Marsey dressed one of Santa's elves.png new file mode 100644 index 0000000..730814b Binary files /dev/null and b/stable-diffusion/marseys/1 - Marsey dressed one of Santa's elves.png differ diff --git a/stable-diffusion/marseys/1 - Marsey pointing and laughing.png b/stable-diffusion/marseys/1 - Marsey pointing and laughing.png new file mode 100644 index 0000000..725378c Binary files /dev/null and b/stable-diffusion/marseys/1 - Marsey pointing and laughing.png differ diff --git a/stable-diffusion/marseys/1 - Marsey smiling.png b/stable-diffusion/marseys/1 - Marsey smiling.png new file mode 100644 index 0000000..e628fc6 Binary files /dev/null and b/stable-diffusion/marseys/1 - Marsey smiling.png differ diff --git a/stable-diffusion/marseys/1 - Marsey walking.png b/stable-diffusion/marseys/1 - Marsey walking.png new file mode 100644 index 0000000..97df00a Binary files /dev/null and b/stable-diffusion/marseys/1 - Marsey walking.png differ diff --git a/stable-diffusion/marseys/1 - Marsey.png b/stable-diffusion/marseys/1 - Marsey.png new file mode 100644 index 0000000..dbe58f3 Binary files /dev/null and b/stable-diffusion/marseys/1 - Marsey.png differ diff --git a/stable-diffusion/marseys/1 - a gingerbread cookie that looks like Marsey.png b/stable-diffusion/marseys/1 - a gingerbread cookie that looks like Marsey.png new file mode 100644 index 0000000..6820ac3 Binary files /dev/null and b/stable-diffusion/marseys/1 - a gingerbread cookie that looks like Marsey.png differ diff --git a/stable-diffusion/marseys/2 - Marsey as a jack-o-lantern.png b/stable-diffusion/marseys/2 - Marsey as a jack-o-lantern.png new file mode 100644 index 0000000..3748367 Binary files /dev/null and b/stable-diffusion/marseys/2 - Marsey as a jack-o-lantern.png differ diff --git a/stable-diffusion/marseys/2 - Marsey dressed as Santa with a bag of presents.png b/stable-diffusion/marseys/2 - Marsey dressed as Santa with a bag of presents.png new file mode 100644 index 0000000..1980774 Binary files /dev/null and b/stable-diffusion/marseys/2 - Marsey dressed as Santa with a bag of presents.png differ diff --git a/stable-diffusion/marseys/2 - Marsey dressed as one of Santa's elves.png b/stable-diffusion/marseys/2 - Marsey dressed as one of Santa's elves.png new file mode 100644 index 0000000..ea462b3 Binary files /dev/null and b/stable-diffusion/marseys/2 - Marsey dressed as one of Santa's elves.png differ diff --git a/stable-diffusion/marseys/2 - Marsey smiling.png b/stable-diffusion/marseys/2 - Marsey smiling.png new file mode 100644 index 0000000..59ca56f Binary files /dev/null and b/stable-diffusion/marseys/2 - Marsey smiling.png differ diff --git a/stable-diffusion/marseys/2 - Marsey walking.png b/stable-diffusion/marseys/2 - Marsey walking.png new file mode 100644 index 0000000..5a9553a Binary files /dev/null and b/stable-diffusion/marseys/2 - Marsey walking.png differ diff --git a/stable-diffusion/marseys/2 - Marsey yawning.png b/stable-diffusion/marseys/2 - Marsey yawning.png new file mode 100644 index 0000000..3aff727 Binary files /dev/null and b/stable-diffusion/marseys/2 - Marsey yawning.png differ diff --git a/stable-diffusion/marseys/2 - a gingerbread cookie that looks like Marsey.png b/stable-diffusion/marseys/2 - a gingerbread cookie that looks like Marsey.png new file mode 100644 index 0000000..4517900 Binary files /dev/null and b/stable-diffusion/marseys/2 - a gingerbread cookie that looks like Marsey.png differ diff --git a/stable-diffusion/marseys/3 - Marsey dressed as Santa with a bag of presents.png b/stable-diffusion/marseys/3 - Marsey dressed as Santa with a bag of presents.png new file mode 100644 index 0000000..3089bd1 Binary files /dev/null and b/stable-diffusion/marseys/3 - Marsey dressed as Santa with a bag of presents.png differ diff --git a/stable-diffusion/marseys/3 - Marsey smiling.png b/stable-diffusion/marseys/3 - Marsey smiling.png new file mode 100644 index 0000000..021ce13 Binary files /dev/null and b/stable-diffusion/marseys/3 - Marsey smiling.png differ diff --git a/stable-diffusion/marseys/3 - Marsey walking.png b/stable-diffusion/marseys/3 - Marsey walking.png new file mode 100644 index 0000000..3d24f2f Binary files /dev/null and b/stable-diffusion/marseys/3 - Marsey walking.png differ diff --git a/stable-diffusion/marseys/4 - Marsey walking.png b/stable-diffusion/marseys/4 - Marsey walking.png new file mode 100644 index 0000000..4971d1b Binary files /dev/null and b/stable-diffusion/marseys/4 - Marsey walking.png differ diff --git a/stable-diffusion/marseys/5 - Marsey viewed from the side.png b/stable-diffusion/marseys/5 - Marsey viewed from the side.png new file mode 100644 index 0000000..f7cb241 Binary files /dev/null and b/stable-diffusion/marseys/5 - Marsey viewed from the side.png differ diff --git a/stable-diffusion/marseys/Chinese Marsey wearing glasses and a rice hat.png b/stable-diffusion/marseys/Chinese Marsey wearing glasses and a rice hat.png new file mode 100644 index 0000000..0824d7d Binary files /dev/null and b/stable-diffusion/marseys/Chinese Marsey wearing glasses and a rice hat.png differ diff --git a/stable-diffusion/marseys/Jesus holding Marsey.png b/stable-diffusion/marseys/Jesus holding Marsey.png new file mode 100644 index 0000000..6f1e5ad Binary files /dev/null and b/stable-diffusion/marseys/Jesus holding Marsey.png differ diff --git a/stable-diffusion/marseys/Kermit the frog in the style of Marsey.png b/stable-diffusion/marseys/Kermit the frog in the style of Marsey.png new file mode 100644 index 0000000..818529c Binary files /dev/null and b/stable-diffusion/marseys/Kermit the frog in the style of Marsey.png differ diff --git a/stable-diffusion/marseys/Marsey as Napolean Bonaparte on a horse.png b/stable-diffusion/marseys/Marsey as Napolean Bonaparte on a horse.png new file mode 100644 index 0000000..eb1440e Binary files /dev/null and b/stable-diffusion/marseys/Marsey as Napolean Bonaparte on a horse.png differ diff --git a/stable-diffusion/marseys/Marsey as a Buddhist monk.png b/stable-diffusion/marseys/Marsey as a Buddhist monk.png new file mode 100644 index 0000000..54a18d5 Binary files /dev/null and b/stable-diffusion/marseys/Marsey as a Buddhist monk.png differ diff --git a/stable-diffusion/marseys/Marsey as a McDonalds employee.png b/stable-diffusion/marseys/Marsey as a McDonalds employee.png new file mode 100644 index 0000000..1bac0e1 Binary files /dev/null and b/stable-diffusion/marseys/Marsey as a McDonalds employee.png differ diff --git a/stable-diffusion/marseys/Marsey as a detective with a magnifying glass.png b/stable-diffusion/marseys/Marsey as a detective with a magnifying glass.png new file mode 100644 index 0000000..f336006 Binary files /dev/null and b/stable-diffusion/marseys/Marsey as a detective with a magnifying glass.png differ diff --git a/stable-diffusion/marseys/Marsey as a doctor with a stethoscope.png b/stable-diffusion/marseys/Marsey as a doctor with a stethoscope.png new file mode 100644 index 0000000..74c7de9 Binary files /dev/null and b/stable-diffusion/marseys/Marsey as a doctor with a stethoscope.png differ diff --git a/stable-diffusion/marseys/Marsey as a frontiersman in a racoon hat and holding a gun.png b/stable-diffusion/marseys/Marsey as a frontiersman in a racoon hat and holding a gun.png new file mode 100644 index 0000000..60092dc Binary files /dev/null and b/stable-diffusion/marseys/Marsey as a frontiersman in a racoon hat and holding a gun.png differ diff --git a/stable-diffusion/marseys/Marsey as a mad scientist.png b/stable-diffusion/marseys/Marsey as a mad scientist.png new file mode 100644 index 0000000..40cdba0 Binary files /dev/null and b/stable-diffusion/marseys/Marsey as a mad scientist.png differ diff --git a/stable-diffusion/marseys/Marsey as a modern soldier, wearing night vision goggles and holding a gun.png b/stable-diffusion/marseys/Marsey as a modern soldier, wearing night vision goggles and holding a gun.png new file mode 100644 index 0000000..ff887fd Binary files /dev/null and b/stable-diffusion/marseys/Marsey as a modern soldier, wearing night vision goggles and holding a gun.png differ diff --git a/stable-diffusion/marseys/Marsey as a snake.png b/stable-diffusion/marseys/Marsey as a snake.png new file mode 100644 index 0000000..2083d11 Binary files /dev/null and b/stable-diffusion/marseys/Marsey as a snake.png differ diff --git a/stable-diffusion/marseys/Marsey as a snowman.png b/stable-diffusion/marseys/Marsey as a snowman.png new file mode 100644 index 0000000..96de1a2 Binary files /dev/null and b/stable-diffusion/marseys/Marsey as a snowman.png differ diff --git a/stable-diffusion/marseys/Marsey as a soldier.png b/stable-diffusion/marseys/Marsey as a soldier.png new file mode 100644 index 0000000..7fc0550 Binary files /dev/null and b/stable-diffusion/marseys/Marsey as a soldier.png differ diff --git a/stable-diffusion/marseys/Marsey as a spider.png b/stable-diffusion/marseys/Marsey as a spider.png new file mode 100644 index 0000000..59e8d84 Binary files /dev/null and b/stable-diffusion/marseys/Marsey as a spider.png differ diff --git a/stable-diffusion/marseys/Marsey as a woman in a dress with long hair.png b/stable-diffusion/marseys/Marsey as a woman in a dress with long hair.png new file mode 100644 index 0000000..8dc8798 Binary files /dev/null and b/stable-diffusion/marseys/Marsey as a woman in a dress with long hair.png differ diff --git a/stable-diffusion/marseys/Marsey as an angel on a cloud.png b/stable-diffusion/marseys/Marsey as an angel on a cloud.png new file mode 100644 index 0000000..d750ba9 Binary files /dev/null and b/stable-diffusion/marseys/Marsey as an angel on a cloud.png differ diff --git a/stable-diffusion/marseys/Marsey as an astronaut in a spacesuit.png b/stable-diffusion/marseys/Marsey as an astronaut in a spacesuit.png new file mode 100644 index 0000000..aeadf21 Binary files /dev/null and b/stable-diffusion/marseys/Marsey as an astronaut in a spacesuit.png differ diff --git a/stable-diffusion/marseys/Marsey as an elephant.png b/stable-diffusion/marseys/Marsey as an elephant.png new file mode 100644 index 0000000..00b1b6b Binary files /dev/null and b/stable-diffusion/marseys/Marsey as an elephant.png differ diff --git a/stable-diffusion/marseys/Marsey as an octopus.png b/stable-diffusion/marseys/Marsey as an octopus.png new file mode 100644 index 0000000..253bff7 Binary files /dev/null and b/stable-diffusion/marseys/Marsey as an octopus.png differ diff --git a/stable-diffusion/marseys/Marsey as the statue of liberty.png b/stable-diffusion/marseys/Marsey as the statue of liberty.png new file mode 100644 index 0000000..1cf8455 Binary files /dev/null and b/stable-diffusion/marseys/Marsey as the statue of liberty.png differ diff --git a/stable-diffusion/marseys/Marsey blowing a kiss.png b/stable-diffusion/marseys/Marsey blowing a kiss.png new file mode 100644 index 0000000..418b495 Binary files /dev/null and b/stable-diffusion/marseys/Marsey blowing a kiss.png differ diff --git a/stable-diffusion/marseys/Marsey blowing a party horn, wearing a Santa hat and sweater.png b/stable-diffusion/marseys/Marsey blowing a party horn, wearing a Santa hat and sweater.png new file mode 100644 index 0000000..be0fa02 Binary files /dev/null and b/stable-diffusion/marseys/Marsey blowing a party horn, wearing a Santa hat and sweater.png differ diff --git a/stable-diffusion/marseys/Marsey blowing on a party horn.png b/stable-diffusion/marseys/Marsey blowing on a party horn.png new file mode 100644 index 0000000..c44fd71 Binary files /dev/null and b/stable-diffusion/marseys/Marsey blowing on a party horn.png differ diff --git a/stable-diffusion/marseys/Marsey blushing.png b/stable-diffusion/marseys/Marsey blushing.png new file mode 100644 index 0000000..f126a1d Binary files /dev/null and b/stable-diffusion/marseys/Marsey blushing.png differ diff --git a/stable-diffusion/marseys/Marsey clapping.png b/stable-diffusion/marseys/Marsey clapping.png new file mode 100644 index 0000000..ea26646 Binary files /dev/null and b/stable-diffusion/marseys/Marsey clapping.png differ diff --git a/stable-diffusion/marseys/Marsey confused.png b/stable-diffusion/marseys/Marsey confused.png new file mode 100644 index 0000000..6b84ad0 Binary files /dev/null and b/stable-diffusion/marseys/Marsey confused.png differ diff --git a/stable-diffusion/marseys/Marsey crying happy tears.png b/stable-diffusion/marseys/Marsey crying happy tears.png new file mode 100644 index 0000000..043f1c2 Binary files /dev/null and b/stable-diffusion/marseys/Marsey crying happy tears.png differ diff --git a/stable-diffusion/marseys/Marsey crying.png b/stable-diffusion/marseys/Marsey crying.png new file mode 100644 index 0000000..c4ed584 Binary files /dev/null and b/stable-diffusion/marseys/Marsey crying.png differ diff --git a/stable-diffusion/marseys/Marsey curled up, terrified and shaking.png b/stable-diffusion/marseys/Marsey curled up, terrified and shaking.png new file mode 100644 index 0000000..49cef71 Binary files /dev/null and b/stable-diffusion/marseys/Marsey curled up, terrified and shaking.png differ diff --git a/stable-diffusion/marseys/Marsey dabbing.png b/stable-diffusion/marseys/Marsey dabbing.png new file mode 100644 index 0000000..7153806 Binary files /dev/null and b/stable-diffusion/marseys/Marsey dabbing.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as Baphomet.png b/stable-diffusion/marseys/Marsey dressed as Baphomet.png new file mode 100644 index 0000000..09388ef Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as Baphomet.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as Ben 10.png b/stable-diffusion/marseys/Marsey dressed as Ben 10.png new file mode 100644 index 0000000..08dd9f6 Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as Ben 10.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as Chucky.png b/stable-diffusion/marseys/Marsey dressed as Chucky.png new file mode 100644 index 0000000..2e78254 Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as Chucky.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as Frankenstein.png b/stable-diffusion/marseys/Marsey dressed as Frankenstein.png new file mode 100644 index 0000000..b44a530 Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as Frankenstein.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as Freddy Kreuger.png b/stable-diffusion/marseys/Marsey dressed as Freddy Kreuger.png new file mode 100644 index 0000000..a847431 Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as Freddy Kreuger.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as Gandalf.png b/stable-diffusion/marseys/Marsey dressed as Gandalf.png new file mode 100644 index 0000000..df46617 Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as Gandalf.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as Jigsaw from the Saw movies.png b/stable-diffusion/marseys/Marsey dressed as Jigsaw from the Saw movies.png new file mode 100644 index 0000000..e20dbf0 Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as Jigsaw from the Saw movies.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as Joseph Stalin.png b/stable-diffusion/marseys/Marsey dressed as Joseph Stalin.png new file mode 100644 index 0000000..8c2ea8c Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as Joseph Stalin.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as Princess Mononoke.png b/stable-diffusion/marseys/Marsey dressed as Princess Mononoke.png new file mode 100644 index 0000000..f10a417 Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as Princess Mononoke.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as Raiden.png b/stable-diffusion/marseys/Marsey dressed as Raiden.png new file mode 100644 index 0000000..6107bb6 Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as Raiden.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as a British Redcoat Soldier.png b/stable-diffusion/marseys/Marsey dressed as a British Redcoat Soldier.png new file mode 100644 index 0000000..acb21ab Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as a British Redcoat Soldier.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as a Thanksgiving turkey.png b/stable-diffusion/marseys/Marsey dressed as a Thanksgiving turkey.png new file mode 100644 index 0000000..0e413e7 Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as a Thanksgiving turkey.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as a circus clown.png b/stable-diffusion/marseys/Marsey dressed as a circus clown.png new file mode 100644 index 0000000..b001adc Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as a circus clown.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as a cop holding a gun.png b/stable-diffusion/marseys/Marsey dressed as a cop holding a gun.png new file mode 100644 index 0000000..f4192d8 Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as a cop holding a gun.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as a cop.png b/stable-diffusion/marseys/Marsey dressed as a cop.png new file mode 100644 index 0000000..7b22cf4 Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as a cop.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as a crying cow.png b/stable-diffusion/marseys/Marsey dressed as a crying cow.png new file mode 100644 index 0000000..7c5d607 Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as a crying cow.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as a mime.png b/stable-diffusion/marseys/Marsey dressed as a mime.png new file mode 100644 index 0000000..830f6e1 Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as a mime.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as a pilgrim.png b/stable-diffusion/marseys/Marsey dressed as a pilgrim.png new file mode 100644 index 0000000..dcd5f97 Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as a pilgrim.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as a pirate.png b/stable-diffusion/marseys/Marsey dressed as a pirate.png new file mode 100644 index 0000000..806f0be Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as a pirate.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as a sailor.png b/stable-diffusion/marseys/Marsey dressed as a sailor.png new file mode 100644 index 0000000..a05b31d Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as a sailor.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as a scarecrow.png b/stable-diffusion/marseys/Marsey dressed as a scarecrow.png new file mode 100644 index 0000000..b3399ca Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as a scarecrow.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as a vampire.png b/stable-diffusion/marseys/Marsey dressed as a vampire.png new file mode 100644 index 0000000..410dc5a Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as a vampire.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as jesus.png b/stable-diffusion/marseys/Marsey dressed as jesus.png new file mode 100644 index 0000000..5d5590f Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as jesus.png differ diff --git a/stable-diffusion/marseys/Marsey dressed as the joker.png b/stable-diffusion/marseys/Marsey dressed as the joker.png new file mode 100644 index 0000000..ecb679e Binary files /dev/null and b/stable-diffusion/marseys/Marsey dressed as the joker.png differ diff --git a/stable-diffusion/marseys/Marsey drinking a glass of water.png b/stable-diffusion/marseys/Marsey drinking a glass of water.png new file mode 100644 index 0000000..917470b Binary files /dev/null and b/stable-diffusion/marseys/Marsey drinking a glass of water.png differ diff --git a/stable-diffusion/marseys/Marsey eating a fish.png b/stable-diffusion/marseys/Marsey eating a fish.png new file mode 100644 index 0000000..01b7554 Binary files /dev/null and b/stable-diffusion/marseys/Marsey eating a fish.png differ diff --git a/stable-diffusion/marseys/Marsey facepalming.png b/stable-diffusion/marseys/Marsey facepalming.png new file mode 100644 index 0000000..78638ff Binary files /dev/null and b/stable-diffusion/marseys/Marsey facepalming.png differ diff --git a/stable-diffusion/marseys/Marsey facing away with a raincloud over her head.png b/stable-diffusion/marseys/Marsey facing away with a raincloud over her head.png new file mode 100644 index 0000000..daa7b7a Binary files /dev/null and b/stable-diffusion/marseys/Marsey facing away with a raincloud over her head.png differ diff --git a/stable-diffusion/marseys/Marsey gasping in shock.png b/stable-diffusion/marseys/Marsey gasping in shock.png new file mode 100644 index 0000000..bdda7c8 Binary files /dev/null and b/stable-diffusion/marseys/Marsey gasping in shock.png differ diff --git a/stable-diffusion/marseys/Marsey giving a thumbs up.png b/stable-diffusion/marseys/Marsey giving a thumbs up.png new file mode 100644 index 0000000..16a2cbc Binary files /dev/null and b/stable-diffusion/marseys/Marsey giving a thumbs up.png differ diff --git a/stable-diffusion/marseys/Marsey giving an award to another Marsey.png b/stable-diffusion/marseys/Marsey giving an award to another Marsey.png new file mode 100644 index 0000000..e429286 Binary files /dev/null and b/stable-diffusion/marseys/Marsey giving an award to another Marsey.png differ diff --git a/stable-diffusion/marseys/Marsey giving the OK sign and holding a glass of milk.png b/stable-diffusion/marseys/Marsey giving the OK sign and holding a glass of milk.png new file mode 100644 index 0000000..2bfaf33 Binary files /dev/null and b/stable-diffusion/marseys/Marsey giving the OK sign and holding a glass of milk.png differ diff --git a/stable-diffusion/marseys/Marsey giving the peace signal.png b/stable-diffusion/marseys/Marsey giving the peace signal.png new file mode 100644 index 0000000..85877dd Binary files /dev/null and b/stable-diffusion/marseys/Marsey giving the peace signal.png differ diff --git a/stable-diffusion/marseys/Marsey holding a beer and grilling prongs.png b/stable-diffusion/marseys/Marsey holding a beer and grilling prongs.png new file mode 100644 index 0000000..c967859 Binary files /dev/null and b/stable-diffusion/marseys/Marsey holding a beer and grilling prongs.png differ diff --git a/stable-diffusion/marseys/Marsey holding a bomb.png b/stable-diffusion/marseys/Marsey holding a bomb.png new file mode 100644 index 0000000..483f693 Binary files /dev/null and b/stable-diffusion/marseys/Marsey holding a bomb.png differ diff --git a/stable-diffusion/marseys/Marsey holding a book.png b/stable-diffusion/marseys/Marsey holding a book.png new file mode 100644 index 0000000..ff21ebe Binary files /dev/null and b/stable-diffusion/marseys/Marsey holding a book.png differ diff --git a/stable-diffusion/marseys/Marsey holding a mallet.png b/stable-diffusion/marseys/Marsey holding a mallet.png new file mode 100644 index 0000000..9388d88 Binary files /dev/null and b/stable-diffusion/marseys/Marsey holding a mallet.png differ diff --git a/stable-diffusion/marseys/Marsey holding a piece of corn.png b/stable-diffusion/marseys/Marsey holding a piece of corn.png new file mode 100644 index 0000000..d135e23 Binary files /dev/null and b/stable-diffusion/marseys/Marsey holding a piece of corn.png differ diff --git a/stable-diffusion/marseys/Marsey holding a pizza and pizza cutter.png b/stable-diffusion/marseys/Marsey holding a pizza and pizza cutter.png new file mode 100644 index 0000000..ec45a5a Binary files /dev/null and b/stable-diffusion/marseys/Marsey holding a pizza and pizza cutter.png differ diff --git a/stable-diffusion/marseys/Marsey holding a sunflower and pointing.png b/stable-diffusion/marseys/Marsey holding a sunflower and pointing.png new file mode 100644 index 0000000..f4f176b Binary files /dev/null and b/stable-diffusion/marseys/Marsey holding a sunflower and pointing.png differ diff --git a/stable-diffusion/marseys/Marsey holding a white flag.png b/stable-diffusion/marseys/Marsey holding a white flag.png new file mode 100644 index 0000000..4a03520 Binary files /dev/null and b/stable-diffusion/marseys/Marsey holding a white flag.png differ diff --git a/stable-diffusion/marseys/Marsey holding a yellow thumbtack.png b/stable-diffusion/marseys/Marsey holding a yellow thumbtack.png new file mode 100644 index 0000000..64553be Binary files /dev/null and b/stable-diffusion/marseys/Marsey holding a yellow thumbtack.png differ diff --git a/stable-diffusion/marseys/Marsey holding an LGBT flag.png b/stable-diffusion/marseys/Marsey holding an LGBT flag.png new file mode 100644 index 0000000..cc67df5 Binary files /dev/null and b/stable-diffusion/marseys/Marsey holding an LGBT flag.png differ diff --git a/stable-diffusion/marseys/Marsey holding an iPod and wearing headphones.png b/stable-diffusion/marseys/Marsey holding an iPod and wearing headphones.png new file mode 100644 index 0000000..5379597 Binary files /dev/null and b/stable-diffusion/marseys/Marsey holding an iPod and wearing headphones.png differ diff --git a/stable-diffusion/marseys/Marsey hugging a capybara.png b/stable-diffusion/marseys/Marsey hugging a capybara.png new file mode 100644 index 0000000..f942fd0 Binary files /dev/null and b/stable-diffusion/marseys/Marsey hugging a capybara.png differ diff --git a/stable-diffusion/marseys/Marsey hugging a carp.png b/stable-diffusion/marseys/Marsey hugging a carp.png new file mode 100644 index 0000000..c3787b9 Binary files /dev/null and b/stable-diffusion/marseys/Marsey hugging a carp.png differ diff --git a/stable-diffusion/marseys/Marsey hugging a heart.png b/stable-diffusion/marseys/Marsey hugging a heart.png new file mode 100644 index 0000000..82dfbcd Binary files /dev/null and b/stable-diffusion/marseys/Marsey hugging a heart.png differ diff --git a/stable-diffusion/marseys/Marsey hugging herself.png b/stable-diffusion/marseys/Marsey hugging herself.png new file mode 100644 index 0000000..8175ed3 Binary files /dev/null and b/stable-diffusion/marseys/Marsey hugging herself.png differ diff --git a/stable-diffusion/marseys/Marsey in a balaclava and holding a gun.png b/stable-diffusion/marseys/Marsey in a balaclava and holding a gun.png new file mode 100644 index 0000000..d2fc198 Binary files /dev/null and b/stable-diffusion/marseys/Marsey in a balaclava and holding a gun.png differ diff --git a/stable-diffusion/marseys/Marsey in a blue jacket, mountaineering boots, goggles, and holding a pick.png b/stable-diffusion/marseys/Marsey in a blue jacket, mountaineering boots, goggles, and holding a pick.png new file mode 100644 index 0000000..907bea6 Binary files /dev/null and b/stable-diffusion/marseys/Marsey in a blue jacket, mountaineering boots, goggles, and holding a pick.png differ diff --git a/stable-diffusion/marseys/Marsey in a cowboy outfit holding a gun.png b/stable-diffusion/marseys/Marsey in a cowboy outfit holding a gun.png new file mode 100644 index 0000000..de4a855 Binary files /dev/null and b/stable-diffusion/marseys/Marsey in a cowboy outfit holding a gun.png differ diff --git a/stable-diffusion/marseys/Marsey in a hat, goatee, and sunglasses.png b/stable-diffusion/marseys/Marsey in a hat, goatee, and sunglasses.png new file mode 100644 index 0000000..1077e24 Binary files /dev/null and b/stable-diffusion/marseys/Marsey in a hat, goatee, and sunglasses.png differ diff --git a/stable-diffusion/marseys/Marsey in a mecha suit.png b/stable-diffusion/marseys/Marsey in a mecha suit.png new file mode 100644 index 0000000..ab63ddf Binary files /dev/null and b/stable-diffusion/marseys/Marsey in a mecha suit.png differ diff --git a/stable-diffusion/marseys/Marsey in an angry pose.png b/stable-diffusion/marseys/Marsey in an angry pose.png new file mode 100644 index 0000000..e429772 Binary files /dev/null and b/stable-diffusion/marseys/Marsey in an angry pose.png differ diff --git a/stable-diffusion/marseys/Marsey in overalls and a straw hat next to a bottle of alcohol.png b/stable-diffusion/marseys/Marsey in overalls and a straw hat next to a bottle of alcohol.png new file mode 100644 index 0000000..f2db2ab Binary files /dev/null and b/stable-diffusion/marseys/Marsey in overalls and a straw hat next to a bottle of alcohol.png differ diff --git a/stable-diffusion/marseys/Marsey laughing.png b/stable-diffusion/marseys/Marsey laughing.png new file mode 100644 index 0000000..0f27327 Binary files /dev/null and b/stable-diffusion/marseys/Marsey laughing.png differ diff --git a/stable-diffusion/marseys/Marsey licking a boot.png b/stable-diffusion/marseys/Marsey licking a boot.png new file mode 100644 index 0000000..8164f79 Binary files /dev/null and b/stable-diffusion/marseys/Marsey licking a boot.png differ diff --git a/stable-diffusion/marseys/Marsey licking a mop.png b/stable-diffusion/marseys/Marsey licking a mop.png new file mode 100644 index 0000000..2f25894 Binary files /dev/null and b/stable-diffusion/marseys/Marsey licking a mop.png differ diff --git a/stable-diffusion/marseys/Marsey licking her lips.png b/stable-diffusion/marseys/Marsey licking her lips.png new file mode 100644 index 0000000..c03d5e5 Binary files /dev/null and b/stable-diffusion/marseys/Marsey licking her lips.png differ diff --git a/stable-diffusion/marseys/Marsey looking at her watch.png b/stable-diffusion/marseys/Marsey looking at her watch.png new file mode 100644 index 0000000..2e7c396 Binary files /dev/null and b/stable-diffusion/marseys/Marsey looking at her watch.png differ diff --git a/stable-diffusion/marseys/Marsey looking into a dresser mirror.png b/stable-diffusion/marseys/Marsey looking into a dresser mirror.png new file mode 100644 index 0000000..8218026 Binary files /dev/null and b/stable-diffusion/marseys/Marsey looking into a dresser mirror.png differ diff --git a/stable-diffusion/marseys/Marsey looking into a mirror and holding rope.png b/stable-diffusion/marseys/Marsey looking into a mirror and holding rope.png new file mode 100644 index 0000000..9c01b2e Binary files /dev/null and b/stable-diffusion/marseys/Marsey looking into a mirror and holding rope.png differ diff --git a/stable-diffusion/marseys/Marsey looking surprised.png b/stable-diffusion/marseys/Marsey looking surprised.png new file mode 100644 index 0000000..7cb9f5d Binary files /dev/null and b/stable-diffusion/marseys/Marsey looking surprised.png differ diff --git a/stable-diffusion/marseys/Marsey lying on the floor and talking on the phone.png b/stable-diffusion/marseys/Marsey lying on the floor and talking on the phone.png new file mode 100644 index 0000000..a79bfc4 Binary files /dev/null and b/stable-diffusion/marseys/Marsey lying on the floor and talking on the phone.png differ diff --git a/stable-diffusion/marseys/Marsey next to a bar chart.png b/stable-diffusion/marseys/Marsey next to a bar chart.png new file mode 100644 index 0000000..061308b Binary files /dev/null and b/stable-diffusion/marseys/Marsey next to a bar chart.png differ diff --git a/stable-diffusion/marseys/Marsey on a queen of hearts playing card.png b/stable-diffusion/marseys/Marsey on a queen of hearts playing card.png new file mode 100644 index 0000000..a225aa3 Binary files /dev/null and b/stable-diffusion/marseys/Marsey on a queen of hearts playing card.png differ diff --git a/stable-diffusion/marseys/Marsey on her back and passed out.png b/stable-diffusion/marseys/Marsey on her back and passed out.png new file mode 100644 index 0000000..1efb1b2 Binary files /dev/null and b/stable-diffusion/marseys/Marsey on her back and passed out.png differ diff --git a/stable-diffusion/marseys/Marsey playing with a fish.png b/stable-diffusion/marseys/Marsey playing with a fish.png new file mode 100644 index 0000000..0bd511e Binary files /dev/null and b/stable-diffusion/marseys/Marsey playing with a fish.png differ diff --git a/stable-diffusion/marseys/Marsey pointing and agreeing.png b/stable-diffusion/marseys/Marsey pointing and agreeing.png new file mode 100644 index 0000000..a9ca6b3 Binary files /dev/null and b/stable-diffusion/marseys/Marsey pointing and agreeing.png differ diff --git a/stable-diffusion/marseys/Marsey pointing and laughing.png b/stable-diffusion/marseys/Marsey pointing and laughing.png new file mode 100644 index 0000000..7c9bf16 Binary files /dev/null and b/stable-diffusion/marseys/Marsey pointing and laughing.png differ diff --git a/stable-diffusion/marseys/Marsey reaching behind herself.png b/stable-diffusion/marseys/Marsey reaching behind herself.png new file mode 100644 index 0000000..18913a6 Binary files /dev/null and b/stable-diffusion/marseys/Marsey reaching behind herself.png differ diff --git a/stable-diffusion/marseys/Marsey refusing and holding her hand up.png b/stable-diffusion/marseys/Marsey refusing and holding her hand up.png new file mode 100644 index 0000000..a902710 Binary files /dev/null and b/stable-diffusion/marseys/Marsey refusing and holding her hand up.png differ diff --git a/stable-diffusion/marseys/Marsey rubbing her chin and thinking.png b/stable-diffusion/marseys/Marsey rubbing her chin and thinking.png new file mode 100644 index 0000000..277e6ba Binary files /dev/null and b/stable-diffusion/marseys/Marsey rubbing her chin and thinking.png differ diff --git a/stable-diffusion/marseys/Marsey shrugging.png b/stable-diffusion/marseys/Marsey shrugging.png new file mode 100644 index 0000000..ea92bc5 Binary files /dev/null and b/stable-diffusion/marseys/Marsey shrugging.png differ diff --git a/stable-diffusion/marseys/Marsey sipping a juice box.png b/stable-diffusion/marseys/Marsey sipping a juice box.png new file mode 100644 index 0000000..6c77fb9 Binary files /dev/null and b/stable-diffusion/marseys/Marsey sipping a juice box.png differ diff --git a/stable-diffusion/marseys/Marsey sitting in a bath with a rubber duck on her head.png b/stable-diffusion/marseys/Marsey sitting in a bath with a rubber duck on her head.png new file mode 100644 index 0000000..43b85f8 Binary files /dev/null and b/stable-diffusion/marseys/Marsey sitting in a bath with a rubber duck on her head.png differ diff --git a/stable-diffusion/marseys/Marsey sitting in a cardboard box.png b/stable-diffusion/marseys/Marsey sitting in a cardboard box.png new file mode 100644 index 0000000..7b9f28f Binary files /dev/null and b/stable-diffusion/marseys/Marsey sitting in a cardboard box.png differ diff --git a/stable-diffusion/marseys/Marsey sitting in a coffee mug.png b/stable-diffusion/marseys/Marsey sitting in a coffee mug.png new file mode 100644 index 0000000..504df74 Binary files /dev/null and b/stable-diffusion/marseys/Marsey sitting in a coffee mug.png differ diff --git a/stable-diffusion/marseys/Marsey sitting in a wheelchair.png b/stable-diffusion/marseys/Marsey sitting in a wheelchair.png new file mode 100644 index 0000000..f116256 Binary files /dev/null and b/stable-diffusion/marseys/Marsey sitting in a wheelchair.png differ diff --git a/stable-diffusion/marseys/Marsey sitting on a black chicken.png b/stable-diffusion/marseys/Marsey sitting on a black chicken.png new file mode 100644 index 0000000..cca617d Binary files /dev/null and b/stable-diffusion/marseys/Marsey sitting on a black chicken.png differ diff --git a/stable-diffusion/marseys/Marsey skiing down a mountain.png b/stable-diffusion/marseys/Marsey skiing down a mountain.png new file mode 100644 index 0000000..50b0811 Binary files /dev/null and b/stable-diffusion/marseys/Marsey skiing down a mountain.png differ diff --git a/stable-diffusion/marseys/Marsey sleeping.png b/stable-diffusion/marseys/Marsey sleeping.png new file mode 100644 index 0000000..3f7d29c Binary files /dev/null and b/stable-diffusion/marseys/Marsey sleeping.png differ diff --git a/stable-diffusion/marseys/Marsey snickering.png b/stable-diffusion/marseys/Marsey snickering.png new file mode 100644 index 0000000..2e90127 Binary files /dev/null and b/stable-diffusion/marseys/Marsey snickering.png differ diff --git a/stable-diffusion/marseys/Marsey squinting.png b/stable-diffusion/marseys/Marsey squinting.png new file mode 100644 index 0000000..08620d8 Binary files /dev/null and b/stable-diffusion/marseys/Marsey squinting.png differ diff --git a/stable-diffusion/marseys/Marsey sticking her tongue out.png b/stable-diffusion/marseys/Marsey sticking her tongue out.png new file mode 100644 index 0000000..c413c42 Binary files /dev/null and b/stable-diffusion/marseys/Marsey sticking her tongue out.png differ diff --git a/stable-diffusion/marseys/Marsey taking a photo with a camera.png b/stable-diffusion/marseys/Marsey taking a photo with a camera.png new file mode 100644 index 0000000..0c9e2a2 Binary files /dev/null and b/stable-diffusion/marseys/Marsey taking a photo with a camera.png differ diff --git a/stable-diffusion/marseys/Marsey taking her medication.png b/stable-diffusion/marseys/Marsey taking her medication.png new file mode 100644 index 0000000..1077634 Binary files /dev/null and b/stable-diffusion/marseys/Marsey taking her medication.png differ diff --git a/stable-diffusion/marseys/Marsey taking notes and wearing glasses.png b/stable-diffusion/marseys/Marsey taking notes and wearing glasses.png new file mode 100644 index 0000000..2ed6dbb Binary files /dev/null and b/stable-diffusion/marseys/Marsey taking notes and wearing glasses.png differ diff --git a/stable-diffusion/marseys/Marsey trying not to puke.png b/stable-diffusion/marseys/Marsey trying not to puke.png new file mode 100644 index 0000000..5263730 Binary files /dev/null and b/stable-diffusion/marseys/Marsey trying not to puke.png differ diff --git a/stable-diffusion/marseys/Marsey viewed from behind.png b/stable-diffusion/marseys/Marsey viewed from behind.png new file mode 100644 index 0000000..9b438de Binary files /dev/null and b/stable-diffusion/marseys/Marsey viewed from behind.png differ diff --git a/stable-diffusion/marseys/Marsey viewed from the back.png b/stable-diffusion/marseys/Marsey viewed from the back.png new file mode 100644 index 0000000..46325dc Binary files /dev/null and b/stable-diffusion/marseys/Marsey viewed from the back.png differ diff --git a/stable-diffusion/marseys/Marsey walking Zombiewolf.png b/stable-diffusion/marseys/Marsey walking Zombiewolf.png new file mode 100644 index 0000000..28885aa Binary files /dev/null and b/stable-diffusion/marseys/Marsey walking Zombiewolf.png differ diff --git a/stable-diffusion/marseys/Marsey walking a dog.png b/stable-diffusion/marseys/Marsey walking a dog.png new file mode 100644 index 0000000..ea64958 Binary files /dev/null and b/stable-diffusion/marseys/Marsey walking a dog.png differ diff --git a/stable-diffusion/marseys/Marsey waving.png b/stable-diffusion/marseys/Marsey waving.png new file mode 100644 index 0000000..59b24f7 Binary files /dev/null and b/stable-diffusion/marseys/Marsey waving.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a Santa hat and holding a Christmas present.png b/stable-diffusion/marseys/Marsey wearing a Santa hat and holding a Christmas present.png new file mode 100644 index 0000000..0fd27c4 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a Santa hat and holding a Christmas present.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a blue outfit next to a bottle.png b/stable-diffusion/marseys/Marsey wearing a blue outfit next to a bottle.png new file mode 100644 index 0000000..f913b51 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a blue outfit next to a bottle.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a cheese hat.png b/stable-diffusion/marseys/Marsey wearing a cheese hat.png new file mode 100644 index 0000000..adb0e14 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a cheese hat.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a dinosaur costume.png b/stable-diffusion/marseys/Marsey wearing a dinosaur costume.png new file mode 100644 index 0000000..a3382d4 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a dinosaur costume.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a fake disguise.png b/stable-diffusion/marseys/Marsey wearing a fake disguise.png new file mode 100644 index 0000000..359db9b Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a fake disguise.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a fedora and holding a sword.png b/stable-diffusion/marseys/Marsey wearing a fedora and holding a sword.png new file mode 100644 index 0000000..66a3f45 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a fedora and holding a sword.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a fedora and suit.png b/stable-diffusion/marseys/Marsey wearing a fedora and suit.png new file mode 100644 index 0000000..d2e30e6 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a fedora and suit.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a hat and holding a baseball bat.png b/stable-diffusion/marseys/Marsey wearing a hat and holding a baseball bat.png new file mode 100644 index 0000000..176aacc Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a hat and holding a baseball bat.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a jacket and sunglasses while smoking.png b/stable-diffusion/marseys/Marsey wearing a jacket and sunglasses while smoking.png new file mode 100644 index 0000000..0c36d08 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a jacket and sunglasses while smoking.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a niqab.png b/stable-diffusion/marseys/Marsey wearing a niqab.png new file mode 100644 index 0000000..a094908 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a niqab.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a scarf and holding a pumpkin spice latte.png b/stable-diffusion/marseys/Marsey wearing a scarf and holding a pumpkin spice latte.png new file mode 100644 index 0000000..32184fd Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a scarf and holding a pumpkin spice latte.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a scarf with a candy cane.png b/stable-diffusion/marseys/Marsey wearing a scarf with a candy cane.png new file mode 100644 index 0000000..6a93976 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a scarf with a candy cane.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a shark outfit.png b/stable-diffusion/marseys/Marsey wearing a shark outfit.png new file mode 100644 index 0000000..10f8569 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a shark outfit.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a sombrero.png b/stable-diffusion/marseys/Marsey wearing a sombrero.png new file mode 100644 index 0000000..e60f319 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a sombrero.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a straightjacket.png b/stable-diffusion/marseys/Marsey wearing a straightjacket.png new file mode 100644 index 0000000..e7089df Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a straightjacket.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a sunhat and sunglasses, holding a drink.png b/stable-diffusion/marseys/Marsey wearing a sunhat and sunglasses, holding a drink.png new file mode 100644 index 0000000..7c44973 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a sunhat and sunglasses, holding a drink.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a towel on her head and facial mask, spa.png b/stable-diffusion/marseys/Marsey wearing a towel on her head and facial mask, spa.png new file mode 100644 index 0000000..f7371e7 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a towel on her head and facial mask, spa.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a turban.png b/stable-diffusion/marseys/Marsey wearing a turban.png new file mode 100644 index 0000000..0dd79ea Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a turban.png differ diff --git a/stable-diffusion/marseys/Marsey wearing a whirly hat.png b/stable-diffusion/marseys/Marsey wearing a whirly hat.png new file mode 100644 index 0000000..fcc2709 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing a whirly hat.png differ diff --git a/stable-diffusion/marseys/Marsey wearing glasses and reading a book.png b/stable-diffusion/marseys/Marsey wearing glasses and reading a book.png new file mode 100644 index 0000000..0731222 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing glasses and reading a book.png differ diff --git a/stable-diffusion/marseys/Marsey wearing headphones and singing into a microphone.png b/stable-diffusion/marseys/Marsey wearing headphones and singing into a microphone.png new file mode 100644 index 0000000..d7c64d7 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing headphones and singing into a microphone.png differ diff --git a/stable-diffusion/marseys/Marsey wearing sunglasses and holding a cane.png b/stable-diffusion/marseys/Marsey wearing sunglasses and holding a cane.png new file mode 100644 index 0000000..e0170d5 Binary files /dev/null and b/stable-diffusion/marseys/Marsey wearing sunglasses and holding a cane.png differ diff --git a/stable-diffusion/marseys/Marsey winking.png b/stable-diffusion/marseys/Marsey winking.png new file mode 100644 index 0000000..3249076 Binary files /dev/null and b/stable-diffusion/marseys/Marsey winking.png differ diff --git a/stable-diffusion/marseys/Marsey with a bow on her head.png b/stable-diffusion/marseys/Marsey with a bow on her head.png new file mode 100644 index 0000000..8fb3b60 Binary files /dev/null and b/stable-diffusion/marseys/Marsey with a bow on her head.png differ diff --git a/stable-diffusion/marseys/Marsey with a disgusted expression.png b/stable-diffusion/marseys/Marsey with a disgusted expression.png new file mode 100644 index 0000000..1116daf Binary files /dev/null and b/stable-diffusion/marseys/Marsey with a disgusted expression.png differ diff --git a/stable-diffusion/marseys/Marsey with a halo over her head.png b/stable-diffusion/marseys/Marsey with a halo over her head.png new file mode 100644 index 0000000..43a8cf8 Binary files /dev/null and b/stable-diffusion/marseys/Marsey with a halo over her head.png differ diff --git a/stable-diffusion/marseys/Marsey with a halo.png b/stable-diffusion/marseys/Marsey with a halo.png new file mode 100644 index 0000000..ad206bb Binary files /dev/null and b/stable-diffusion/marseys/Marsey with a halo.png differ diff --git a/stable-diffusion/marseys/Marsey with a paper bag over her head.png b/stable-diffusion/marseys/Marsey with a paper bag over her head.png new file mode 100644 index 0000000..d1cc79f Binary files /dev/null and b/stable-diffusion/marseys/Marsey with a paper bag over her head.png differ diff --git a/stable-diffusion/marseys/Marsey with a pleading expression.png b/stable-diffusion/marseys/Marsey with a pleading expression.png new file mode 100644 index 0000000..24f431e Binary files /dev/null and b/stable-diffusion/marseys/Marsey with a pleading expression.png differ diff --git a/stable-diffusion/marseys/Marsey with a pot on her head and an apple under her paw.png b/stable-diffusion/marseys/Marsey with a pot on her head and an apple under her paw.png new file mode 100644 index 0000000..3308236 Binary files /dev/null and b/stable-diffusion/marseys/Marsey with a pot on her head and an apple under her paw.png differ diff --git a/stable-diffusion/marseys/Marsey with a reluctant expression.png b/stable-diffusion/marseys/Marsey with a reluctant expression.png new file mode 100644 index 0000000..1bdd2db Binary files /dev/null and b/stable-diffusion/marseys/Marsey with a reluctant expression.png differ diff --git a/stable-diffusion/marseys/Marsey with a sad expression.png b/stable-diffusion/marseys/Marsey with a sad expression.png new file mode 100644 index 0000000..7277db7 Binary files /dev/null and b/stable-diffusion/marseys/Marsey with a sad expression.png differ diff --git a/stable-diffusion/marseys/Marsey with a shirt over her head.png b/stable-diffusion/marseys/Marsey with a shirt over her head.png new file mode 100644 index 0000000..4147cc8 Binary files /dev/null and b/stable-diffusion/marseys/Marsey with a shirt over her head.png differ diff --git a/stable-diffusion/marseys/Marsey with an annoyed expression.png b/stable-diffusion/marseys/Marsey with an annoyed expression.png new file mode 100644 index 0000000..5784f16 Binary files /dev/null and b/stable-diffusion/marseys/Marsey with an annoyed expression.png differ diff --git a/stable-diffusion/marseys/Marsey with an unamused expression.png b/stable-diffusion/marseys/Marsey with an unamused expression.png new file mode 100644 index 0000000..159a47e Binary files /dev/null and b/stable-diffusion/marseys/Marsey with an unamused expression.png differ diff --git a/stable-diffusion/marseys/Marsey with beautiful eyes.png b/stable-diffusion/marseys/Marsey with beautiful eyes.png new file mode 100644 index 0000000..631d175 Binary files /dev/null and b/stable-diffusion/marseys/Marsey with beautiful eyes.png differ diff --git a/stable-diffusion/marseys/Marsey with beaver teeth and a beaver tail.png b/stable-diffusion/marseys/Marsey with beaver teeth and a beaver tail.png new file mode 100644 index 0000000..134af52 Binary files /dev/null and b/stable-diffusion/marseys/Marsey with beaver teeth and a beaver tail.png differ diff --git a/stable-diffusion/marseys/Marsey with hearts around her.png b/stable-diffusion/marseys/Marsey with hearts around her.png new file mode 100644 index 0000000..68bfb16 Binary files /dev/null and b/stable-diffusion/marseys/Marsey with hearts around her.png differ diff --git a/stable-diffusion/marseys/Marsey with red eyes and a bong.png b/stable-diffusion/marseys/Marsey with red eyes and a bong.png new file mode 100644 index 0000000..3e41b18 Binary files /dev/null and b/stable-diffusion/marseys/Marsey with red eyes and a bong.png differ diff --git a/stable-diffusion/marseys/Marsey with stars in her eyes.png b/stable-diffusion/marseys/Marsey with stars in her eyes.png new file mode 100644 index 0000000..c67f923 Binary files /dev/null and b/stable-diffusion/marseys/Marsey with stars in her eyes.png differ diff --git a/stable-diffusion/marseys/Marsey yawning.png b/stable-diffusion/marseys/Marsey yawning.png new file mode 100644 index 0000000..98e7765 Binary files /dev/null and b/stable-diffusion/marseys/Marsey yawning.png differ diff --git a/stable-diffusion/marseys/a Kirby that looks like Marsey.png b/stable-diffusion/marseys/a Kirby that looks like Marsey.png new file mode 100644 index 0000000..e9fbbf7 Binary files /dev/null and b/stable-diffusion/marseys/a Kirby that looks like Marsey.png differ diff --git a/stable-diffusion/marseys/a Marsey chipmunk holding an acorn with hearts in its eyes.png b/stable-diffusion/marseys/a Marsey chipmunk holding an acorn with hearts in its eyes.png new file mode 100644 index 0000000..700eca7 Binary files /dev/null and b/stable-diffusion/marseys/a Marsey chipmunk holding an acorn with hearts in its eyes.png differ diff --git a/stable-diffusion/marseys/a Marsey pointing at another Marsey.png b/stable-diffusion/marseys/a Marsey pointing at another Marsey.png new file mode 100644 index 0000000..36f8333 Binary files /dev/null and b/stable-diffusion/marseys/a Marsey pointing at another Marsey.png differ diff --git a/stable-diffusion/marseys/a Marsey snowman.png b/stable-diffusion/marseys/a Marsey snowman.png new file mode 100644 index 0000000..98477c0 Binary files /dev/null and b/stable-diffusion/marseys/a Marsey snowman.png differ diff --git a/stable-diffusion/marseys/a Marsey tiger.png b/stable-diffusion/marseys/a Marsey tiger.png new file mode 100644 index 0000000..5f0974c Binary files /dev/null and b/stable-diffusion/marseys/a Marsey tiger.png differ diff --git a/stable-diffusion/marseys/a Yeti that looks like Marsey.png b/stable-diffusion/marseys/a Yeti that looks like Marsey.png new file mode 100644 index 0000000..b120c29 Binary files /dev/null and b/stable-diffusion/marseys/a Yeti that looks like Marsey.png differ diff --git a/stable-diffusion/marseys/a bear in the style of Marsey.png b/stable-diffusion/marseys/a bear in the style of Marsey.png new file mode 100644 index 0000000..0e18b3b Binary files /dev/null and b/stable-diffusion/marseys/a bear in the style of Marsey.png differ diff --git a/stable-diffusion/marseys/a black and white television showing Marsey.png b/stable-diffusion/marseys/a black and white television showing Marsey.png new file mode 100644 index 0000000..e50d5ed Binary files /dev/null and b/stable-diffusion/marseys/a black and white television showing Marsey.png differ diff --git a/stable-diffusion/marseys/a chipmunk that looks like Marsey.png b/stable-diffusion/marseys/a chipmunk that looks like Marsey.png new file mode 100644 index 0000000..7f7d19d Binary files /dev/null and b/stable-diffusion/marseys/a chipmunk that looks like Marsey.png differ diff --git a/stable-diffusion/marseys/a duck that looks like Marsey.png b/stable-diffusion/marseys/a duck that looks like Marsey.png new file mode 100644 index 0000000..af6a958 Binary files /dev/null and b/stable-diffusion/marseys/a duck that looks like Marsey.png differ diff --git a/stable-diffusion/marseys/a fluffy sheepdog that looks like Marsey.png b/stable-diffusion/marseys/a fluffy sheepdog that looks like Marsey.png new file mode 100644 index 0000000..af51487 Binary files /dev/null and b/stable-diffusion/marseys/a fluffy sheepdog that looks like Marsey.png differ diff --git a/stable-diffusion/marseys/a horrified Marsey.png b/stable-diffusion/marseys/a horrified Marsey.png new file mode 100644 index 0000000..0ab4e57 Binary files /dev/null and b/stable-diffusion/marseys/a horrified Marsey.png differ diff --git a/stable-diffusion/marseys/a llama in the style of Marsey.png b/stable-diffusion/marseys/a llama in the style of Marsey.png new file mode 100644 index 0000000..f240245 Binary files /dev/null and b/stable-diffusion/marseys/a llama in the style of Marsey.png differ diff --git a/stable-diffusion/marseys/a reindeer Marsey.png b/stable-diffusion/marseys/a reindeer Marsey.png new file mode 100644 index 0000000..0cd6492 Binary files /dev/null and b/stable-diffusion/marseys/a reindeer Marsey.png differ diff --git a/stable-diffusion/marseys/an emo Marsey with purple hair.png b/stable-diffusion/marseys/an emo Marsey with purple hair.png new file mode 100644 index 0000000..d02db31 Binary files /dev/null and b/stable-diffusion/marseys/an emo Marsey with purple hair.png differ diff --git a/stable-diffusion/marseys/an emo Marsey with rainbow hair.png b/stable-diffusion/marseys/an emo Marsey with rainbow hair.png new file mode 100644 index 0000000..f5607d0 Binary files /dev/null and b/stable-diffusion/marseys/an emo Marsey with rainbow hair.png differ diff --git a/stable-diffusion/marseys/an owl that looks like Marsey.png b/stable-diffusion/marseys/an owl that looks like Marsey.png new file mode 100644 index 0000000..ba5b0a2 Binary files /dev/null and b/stable-diffusion/marseys/an owl that looks like Marsey.png differ diff --git a/stable-diffusion/marseys/dirty and poor Marsey.png b/stable-diffusion/marseys/dirty and poor Marsey.png new file mode 100644 index 0000000..e5db641 Binary files /dev/null and b/stable-diffusion/marseys/dirty and poor Marsey.png differ diff --git a/stable-diffusion/marseys/fluffy Marsey.png b/stable-diffusion/marseys/fluffy Marsey.png new file mode 100644 index 0000000..3baa3cc Binary files /dev/null and b/stable-diffusion/marseys/fluffy Marsey.png differ diff --git a/stable-diffusion/marseys/obese Marsey riding a scooter.png b/stable-diffusion/marseys/obese Marsey riding a scooter.png new file mode 100644 index 0000000..76413da Binary files /dev/null and b/stable-diffusion/marseys/obese Marsey riding a scooter.png differ diff --git a/stable-diffusion/marseys/obese Marsey.png b/stable-diffusion/marseys/obese Marsey.png new file mode 100644 index 0000000..d77d45e Binary files /dev/null and b/stable-diffusion/marseys/obese Marsey.png differ diff --git a/stable-diffusion/marseys/purple Marsey holding a playing card.png b/stable-diffusion/marseys/purple Marsey holding a playing card.png new file mode 100644 index 0000000..237315f Binary files /dev/null and b/stable-diffusion/marseys/purple Marsey holding a playing card.png differ diff --git a/stable-diffusion/marseys/sad Marsey.png b/stable-diffusion/marseys/sad Marsey.png new file mode 100644 index 0000000..37e9c87 Binary files /dev/null and b/stable-diffusion/marseys/sad Marsey.png differ diff --git a/stable-diffusion/marseys/sick Marsey wearing a scarf with a thermometer.png b/stable-diffusion/marseys/sick Marsey wearing a scarf with a thermometer.png new file mode 100644 index 0000000..be50346 Binary files /dev/null and b/stable-diffusion/marseys/sick Marsey wearing a scarf with a thermometer.png differ diff --git a/stable-diffusion/marseys/surprised Marsey.png b/stable-diffusion/marseys/surprised Marsey.png new file mode 100644 index 0000000..8edacad Binary files /dev/null and b/stable-diffusion/marseys/surprised Marsey.png differ diff --git a/stable-diffusion/preprocess_training_data.py b/stable-diffusion/preprocess_training_data.py new file mode 100644 index 0000000..f18cf87 --- /dev/null +++ b/stable-diffusion/preprocess_training_data.py @@ -0,0 +1,114 @@ +import random +import os +from glob import glob +from PIL import Image + +TRAINING_SIZE = 768 +MARSEY_SIZE = TRAINING_SIZE * 0.65 # Resize the Marsey to this width/height. + + +# Apply the alpha channel from marseys/?????.png to upscaled/?????_Swin2SR.png +def remask(upscaled_path): + basename = upscaled_path.split("/")[-1] + # Strip the _Swin2SR suffix. + original_basename = basename.split("_Swin2SR")[0] + ".png" + original = Image.open(f"marseys/{original_basename}") + upscaled = Image.open(upscaled_path) + + try: + mask = original.getchannel("A").resize((upscaled.width, upscaled.height)) + upscaled.putalpha(mask) + return (original_basename, upscaled) + except ValueError as e: # Usually means it's animated. + print(e, upscaled_path) + + +# Remasks the images in upscaled/ with alpha masks from marseys/, resizes the result, +# and saves a copy with both a random background color and a white background. +def generate_training_set(): + backgrounds = [ + "#fabfb7", + "#ffda9e", + "#c5c6c8", + "#b2e2f2", + "#b0c2f2", + "#b0f2c2", + "#fdcae1", + "#8f7193", + "#77DD77", + "#836953", + "#89cff0", + "#99c5c4", + "#9adedb", + "#aa9499", + "#aaf0d1", + "#b2fba5", + "#b39eb5", + "#bdb0d0", + "#bee7a5", + "#befd73", + "#c1c6fc", + "#c6a4a4", + "#cb99c9", + "#ff6961", + "#ff694f", + "#ff9899", + "#ffb7ce", + "#ca9bf7", + ] + + if not os.path.exists("training-white"): + os.mkdir("training-white") + + if not os.path.exists("training-colors"): + os.mkdir("training-colors") + + remasked_images = [remask(path) for path in glob("upscaled/*.png")] + remasked_images = [i for i in remasked_images if i is not None] + + for basename, marsey in remasked_images: + max_dim = max(marsey.size) + scale_factor = 1 + + if max_dim > MARSEY_SIZE: + scale_factor = MARSEY_SIZE / max_dim + + marsey = marsey.resize( + ( + round(marsey.size[0] * scale_factor), + round(marsey.size[1] * scale_factor), + ), + resample=Image.Resampling.LANCZOS, + ) + + box = ( + TRAINING_SIZE // 2 - marsey.size[0] // 2, + TRAINING_SIZE // 2 - marsey.size[1] // 2, + ) + + white_bg = Image.new("RGBA", (TRAINING_SIZE, TRAINING_SIZE), "#ffffff") + white_bg.paste(marsey, box, marsey) + white_bg.save(f"training-white/{basename}") + + color_bg = Image.new( + "RGBA", (TRAINING_SIZE, TRAINING_SIZE), random.choice(backgrounds) + ) + color_bg.paste(marsey, box, marsey) + color_bg.save(f"training-colors/{basename}") + + +# Creates a metadata.jsonl in the format of HuggingFace's `datasets` library. +def generate_metadata(training_dir): + for path in glob(f"{training_dir}/*.png"): + # "3 - Marsey walking.png" -> "Marsey walking" + stem = path.split("/")[-1].split(".")[0] + caption = stem.split("- ")[-1] + + with open(f"{training_dir}/metadata.jsonl", "a") as f: + caption = caption.replace("Marsey", "Marsey the cat") + f.write(f'{{"file_name": "{stem}.png", "text": "{caption}"}}\n') + + +generate_training_set() +generate_metadata("training-colors") +generate_metadata("training-white") diff --git a/stable-diffusion/readme.md b/stable-diffusion/readme.md new file mode 100644 index 0000000..4d22b75 --- /dev/null +++ b/stable-diffusion/readme.md @@ -0,0 +1,75 @@ +## Steps + +* Upscale `marseys` with swin2sr ([colab](https://github.com/mv-lab/swin2sr#demos)) and place the output in `upscaled` +* Run `preprocess_training_data.py` to create the training sets and `metadata.jsonl` files. +* Run the training script. +* Modify `upload_to_huggingface.py` and run it. + + +## Environment setup +```sh +sudo apt -y install fonts-dejavu-core ttf-mscorefonts-installer ffmpeg libsm6 libxext6 fonts-roboto build-essential + +wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash Miniconda3-latest-Linux-x86_64.sh + +conda install pytorch torchvision pytorch-cuda=11.6 -c pytorch -c nvidia +conda install xformers -c xformers/label/dev +pip install --upgrade git+https://github.com/huggingface/diffusers.git transformers accelerate scipy datasets +``` + + +## Dreambooth + +Use `train_dreambooth.py`, which has been modified to use the filename as a caption (`metadata.jsonl` isn't used.) + +```sh +export MODEL_NAME="stabilityai/stable-diffusion-2" +export INSTANCE_DIR="./training-colors" +export OUTPUT_DIR="./dreambooth" + + accelerate launch train_dreambooth.py \ + --mixed_precision="fp16" \ + --pretrained_model_name_or_path=$MODEL_NAME \ + --train_text_encoder \ + --instance_data_dir=$INSTANCE_DIR \ + --output_dir=$OUTPUT_DIR \ + --instance_prompt="N/A" \ + --resolution=768 \ + --train_batch_size=4 \ + --gradient_accumulation_steps=1 \ + --learning_rate=2e-6 \ + --lr_scheduler="constant" \ + --lr_warmup_steps=0 \ + --max_train_steps=1000 +``` + + +## Normal fine-tuning + +Use the [training script in diffusers](https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image.py). + + ```sh +export MODEL_NAME="stability-ai/stable-diffusion-2" +export DATASET_NAME="training-colors" + +accelerate launch --mixed_precision="fp16" train_text_to_image.py \ + --pretrained_model_name_or_path=$MODEL_NAME \ + --dataset_name=$DATASET_NAME \ + --use_ema \ + --resolution=768 \ + --center_crop \ + --random_flip \ + --train_batch_size=9 \ + --gradient_accumulation_steps=1 \ + --max_train_steps=10000 \ + --learning_rate=1.5e-06 \ + --max_grad_norm=1 \ + --lr_scheduler="constant" --lr_warmup_steps=0 \ + --output_dir="marsey" + ``` + + +## Notes +* If training on 512x512, change 768 -> 512 on the commands below and in `preprocess_training_data.py` +* Colored backgrounds worked best for direct fine-tuning and white backgrounds worked best for Dreambooth. +* Batch sizes are configured for an A6000 with 48GB VRAM and would need to be lowered if running on a smaller GPU. diff --git a/stable-diffusion/train_dreambooth.py b/stable-diffusion/train_dreambooth.py new file mode 100644 index 0000000..2f7f7b6 --- /dev/null +++ b/stable-diffusion/train_dreambooth.py @@ -0,0 +1,839 @@ +import argparse +import hashlib +import itertools +import math +import os +from pathlib import Path +from typing import Optional + +import torch +import torch.nn.functional as F +import torch.utils.checkpoint +from torch.utils.data import Dataset + +from accelerate import Accelerator +from accelerate.logging import get_logger +from accelerate.utils import set_seed +from diffusers import ( + AutoencoderKL, + DDPMScheduler, + StableDiffusionPipeline, + UNet2DConditionModel, +) +from diffusers.optimization import get_scheduler +from huggingface_hub import HfFolder, Repository, whoami +from PIL import Image +from torchvision import transforms +from tqdm.auto import tqdm +from transformers import CLIPTextModel, CLIPTokenizer + + +logger = get_logger(__name__) + + +def parse_args(input_args=None): + parser = argparse.ArgumentParser(description="Simple example of a training script.") + parser.add_argument( + "--pretrained_model_name_or_path", + type=str, + default=None, + required=True, + help="Path to pretrained model or model identifier from huggingface.co/models.", + ) + parser.add_argument( + "--revision", + type=str, + default=None, + required=False, + help="Revision of pretrained model identifier from huggingface.co/models.", + ) + parser.add_argument( + "--tokenizer_name", + type=str, + default=None, + help="Pretrained tokenizer name or path if not the same as model_name", + ) + parser.add_argument( + "--instance_data_dir", + type=str, + default=None, + required=True, + help="A folder containing the training data of instance images.", + ) + parser.add_argument( + "--class_data_dir", + type=str, + default=None, + required=False, + help="A folder containing the training data of class images.", + ) + parser.add_argument( + "--instance_prompt", + type=str, + default=None, + required=True, + help="The prompt with identifier specifying the instance", + ) + parser.add_argument( + "--class_prompt", + type=str, + default=None, + help="The prompt to specify images in the same class as provided instance images.", + ) + parser.add_argument( + "--with_prior_preservation", + default=False, + action="store_true", + help="Flag to add prior preservation loss.", + ) + parser.add_argument( + "--prior_loss_weight", + type=float, + default=1.0, + help="The weight of prior preservation loss.", + ) + parser.add_argument( + "--num_class_images", + type=int, + default=100, + help=( + "Minimal class images for prior preservation loss. If not have enough images, additional images will be" + " sampled with class_prompt." + ), + ) + parser.add_argument( + "--output_dir", + type=str, + default="text-inversion-model", + help="The output directory where the model predictions and checkpoints will be written.", + ) + parser.add_argument( + "--seed", type=int, default=None, help="A seed for reproducible training." + ) + parser.add_argument( + "--resolution", + type=int, + default=512, + help=( + "The resolution for input images, all the images in the train/validation dataset will be resized to this" + " resolution" + ), + ) + parser.add_argument( + "--center_crop", + action="store_true", + help="Whether to center crop images before resizing to resolution", + ) + parser.add_argument( + "--train_text_encoder", + action="store_true", + help="Whether to train the text encoder", + ) + parser.add_argument( + "--train_batch_size", + type=int, + default=4, + help="Batch size (per device) for the training dataloader.", + ) + parser.add_argument( + "--sample_batch_size", + type=int, + default=4, + help="Batch size (per device) for sampling images.", + ) + parser.add_argument("--num_train_epochs", type=int, default=1) + parser.add_argument( + "--max_train_steps", + type=int, + default=None, + help="Total number of training steps to perform. If provided, overrides num_train_epochs.", + ) + parser.add_argument( + "--save_steps", + type=int, + default=500, + help="Save checkpoint every X updates steps.", + ) + parser.add_argument( + "--gradient_accumulation_steps", + type=int, + default=1, + help="Number of updates steps to accumulate before performing a backward/update pass.", + ) + parser.add_argument( + "--gradient_checkpointing", + action="store_true", + help="Whether or not to use gradient checkpointing to save memory at the expense of slower backward pass.", + ) + parser.add_argument( + "--learning_rate", + type=float, + default=5e-6, + help="Initial learning rate (after the potential warmup period) to use.", + ) + parser.add_argument( + "--scale_lr", + action="store_true", + default=False, + help="Scale the learning rate by the number of GPUs, gradient accumulation steps, and batch size.", + ) + parser.add_argument( + "--lr_scheduler", + type=str, + default="constant", + help=( + 'The scheduler type to use. Choose between ["linear", "cosine", "cosine_with_restarts", "polynomial",' + ' "constant", "constant_with_warmup"]' + ), + ) + parser.add_argument( + "--lr_warmup_steps", + type=int, + default=500, + help="Number of steps for the warmup in the lr scheduler.", + ) + parser.add_argument( + "--use_8bit_adam", + action="store_true", + help="Whether or not to use 8-bit Adam from bitsandbytes.", + ) + parser.add_argument( + "--adam_beta1", + type=float, + default=0.9, + help="The beta1 parameter for the Adam optimizer.", + ) + parser.add_argument( + "--adam_beta2", + type=float, + default=0.999, + help="The beta2 parameter for the Adam optimizer.", + ) + parser.add_argument( + "--adam_weight_decay", type=float, default=1e-2, help="Weight decay to use." + ) + parser.add_argument( + "--adam_epsilon", + type=float, + default=1e-08, + help="Epsilon value for the Adam optimizer", + ) + parser.add_argument( + "--max_grad_norm", default=1.0, type=float, help="Max gradient norm." + ) + parser.add_argument( + "--push_to_hub", + action="store_true", + help="Whether or not to push the model to the Hub.", + ) + parser.add_argument( + "--hub_token", + type=str, + default=None, + help="The token to use to push to the Model Hub.", + ) + parser.add_argument( + "--hub_model_id", + type=str, + default=None, + help="The name of the repository to keep in sync with the local `output_dir`.", + ) + parser.add_argument( + "--logging_dir", + type=str, + default="logs", + help=( + "[TensorBoard](https://www.tensorflow.org/tensorboard) log directory. Will default to" + " *output_dir/runs/**CURRENT_DATETIME_HOSTNAME***." + ), + ) + parser.add_argument( + "--mixed_precision", + type=str, + default=None, + choices=["no", "fp16", "bf16"], + help=( + "Whether to use mixed precision. Choose between fp16 and bf16 (bfloat16). Bf16 requires PyTorch >=" + " 1.10.and an Nvidia Ampere GPU. Default to the value of accelerate config of the current system or the" + " flag passed with the `accelerate.launch` command. Use this argument to override the accelerate config." + ), + ) + parser.add_argument( + "--local_rank", + type=int, + default=-1, + help="For distributed training: local_rank", + ) + + if input_args is not None: + args = parser.parse_args(input_args) + else: + args = parser.parse_args() + + env_local_rank = int(os.environ.get("LOCAL_RANK", -1)) + if env_local_rank != -1 and env_local_rank != args.local_rank: + args.local_rank = env_local_rank + + if args.with_prior_preservation: + if args.class_data_dir is None: + raise ValueError("You must specify a data directory for class images.") + if args.class_prompt is None: + raise ValueError("You must specify prompt for class images.") + else: + if args.class_data_dir is not None: + logger.warning( + "You need not use --class_data_dir without --with_prior_preservation." + ) + if args.class_prompt is not None: + logger.warning( + "You need not use --class_prompt without --with_prior_preservation." + ) + + return args + + +class DreamBoothDataset(Dataset): + """ + A dataset to prepare the instance and class images with the prompts for fine-tuning the model. + It pre-processes the images and the tokenizes prompts. + """ + + def __init__( + self, + instance_data_root, + instance_prompt, + tokenizer, + class_data_root=None, + class_prompt=None, + size=512, + center_crop=False, + ): + self.size = size + self.center_crop = center_crop + self.tokenizer = tokenizer + + self.instance_data_root = Path(instance_data_root) + if not self.instance_data_root.exists(): + raise ValueError("Instance images root doesn't exists.") + + self.instance_images_path = list(Path(instance_data_root).iterdir()) + self.num_instance_images = len(self.instance_images_path) + self.instance_prompt = instance_prompt + self._length = self.num_instance_images + + if class_data_root is not None: + self.class_data_root = Path(class_data_root) + self.class_data_root.mkdir(parents=True, exist_ok=True) + self.class_images_path = list(self.class_data_root.iterdir()) + self.num_class_images = len(self.class_images_path) + self._length = max(self.num_class_images, self.num_instance_images) + self.class_prompt = class_prompt + else: + self.class_data_root = None + + self.image_transforms = transforms.Compose( + [ + transforms.Resize( + size, interpolation=transforms.InterpolationMode.BILINEAR + ), + transforms.CenterCrop(size) + if center_crop + else transforms.RandomCrop(size), + transforms.ToTensor(), + transforms.Normalize([0.5], [0.5]), + ] + ) + + def __len__(self): + return self._length + + def __getitem__(self, index): + example = {} + + img_path = self.instance_images_path[index % self.num_instance_images] + instance_image = Image.open(img_path) + prompt = str(img_path).split("/")[-1].split(".")[0].split("- ")[-1] + prompt = prompt.replace("Marsey", "sks cat") + + if not instance_image.mode == "RGB": + instance_image = instance_image.convert("RGB") + example["instance_images"] = self.image_transforms(instance_image) + example["instance_prompt_ids"] = self.tokenizer( + prompt, + padding="do_not_pad", + truncation=True, + max_length=self.tokenizer.model_max_length, + ).input_ids + + if self.class_data_root: + class_image = Image.open( + self.class_images_path[index % self.num_class_images] + ) + if not class_image.mode == "RGB": + class_image = class_image.convert("RGB") + example["class_images"] = self.image_transforms(class_image) + example["class_prompt_ids"] = self.tokenizer( + self.class_prompt, + padding="do_not_pad", + truncation=True, + max_length=self.tokenizer.model_max_length, + ).input_ids + + return example + + +class PromptDataset(Dataset): + "A simple dataset to prepare the prompts to generate class images on multiple GPUs." + + def __init__(self, prompt, num_samples): + self.prompt = prompt + self.num_samples = num_samples + + def __len__(self): + return self.num_samples + + def __getitem__(self, index): + example = {} + example["prompt"] = self.prompt + example["index"] = index + return example + + +def get_full_repo_name( + model_id: str, organization: Optional[str] = None, token: Optional[str] = None +): + if token is None: + token = HfFolder.get_token() + if organization is None: + username = whoami(token)["name"] + return f"{username}/{model_id}" + else: + return f"{organization}/{model_id}" + + +def main(args): + logging_dir = Path(args.output_dir, args.logging_dir) + + accelerator = Accelerator( + gradient_accumulation_steps=args.gradient_accumulation_steps, + mixed_precision=args.mixed_precision, + log_with="tensorboard", + logging_dir=logging_dir, + ) + + # Currently, it's not possible to do gradient accumulation when training two models with accelerate.accumulate + # This will be enabled soon in accelerate. For now, we don't allow gradient accumulation when training two models. + # TODO (patil-suraj): Remove this check when gradient accumulation with two models is enabled in accelerate. + if ( + args.train_text_encoder + and args.gradient_accumulation_steps > 1 + and accelerator.num_processes > 1 + ): + raise ValueError( + "Gradient accumulation is not supported when training the text encoder in distributed training. " + "Please set gradient_accumulation_steps to 1. This feature will be supported in the future." + ) + + if args.seed is not None: + set_seed(args.seed) + + if args.with_prior_preservation: + class_images_dir = Path(args.class_data_dir) + if not class_images_dir.exists(): + class_images_dir.mkdir(parents=True) + cur_class_images = len(list(class_images_dir.iterdir())) + + if cur_class_images < args.num_class_images: + torch_dtype = ( + torch.float16 if accelerator.device.type == "cuda" else torch.float32 + ) + pipeline = StableDiffusionPipeline.from_pretrained( + args.pretrained_model_name_or_path, + torch_dtype=torch_dtype, + safety_checker=None, + revision=args.revision, + ) + pipeline.set_progress_bar_config(disable=True) + + num_new_images = args.num_class_images - cur_class_images + logger.info(f"Number of class images to sample: {num_new_images}.") + + sample_dataset = PromptDataset(args.class_prompt, num_new_images) + sample_dataloader = torch.utils.data.DataLoader( + sample_dataset, batch_size=args.sample_batch_size + ) + + sample_dataloader = accelerator.prepare(sample_dataloader) + pipeline.to(accelerator.device) + + for example in tqdm( + sample_dataloader, + desc="Generating class images", + disable=not accelerator.is_local_main_process, + ): + images = pipeline(example["prompt"]).images + + for i, image in enumerate(images): + hash_image = hashlib.sha1(image.tobytes()).hexdigest() + image_filename = ( + class_images_dir + / f"{example['index'][i] + cur_class_images}-{hash_image}.jpg" + ) + image.save(image_filename) + + del pipeline + if torch.cuda.is_available(): + torch.cuda.empty_cache() + + # Handle the repository creation + if accelerator.is_main_process: + if args.push_to_hub: + if args.hub_model_id is None: + repo_name = get_full_repo_name( + Path(args.output_dir).name, token=args.hub_token + ) + else: + repo_name = args.hub_model_id + repo = Repository(args.output_dir, clone_from=repo_name) + + with open(os.path.join(args.output_dir, ".gitignore"), "w+") as gitignore: + if "step_*" not in gitignore: + gitignore.write("step_*\n") + if "epoch_*" not in gitignore: + gitignore.write("epoch_*\n") + elif args.output_dir is not None: + os.makedirs(args.output_dir, exist_ok=True) + + # Load the tokenizer + if args.tokenizer_name: + tokenizer = CLIPTokenizer.from_pretrained( + args.tokenizer_name, + revision=args.revision, + ) + elif args.pretrained_model_name_or_path: + tokenizer = CLIPTokenizer.from_pretrained( + args.pretrained_model_name_or_path, + subfolder="tokenizer", + revision=args.revision, + ) + + # Load models and create wrapper for stable diffusion + text_encoder = CLIPTextModel.from_pretrained( + args.pretrained_model_name_or_path, + subfolder="text_encoder", + revision=args.revision, + ) + vae = AutoencoderKL.from_pretrained( + args.pretrained_model_name_or_path, + subfolder="vae", + revision=args.revision, + ) + unet = UNet2DConditionModel.from_pretrained( + args.pretrained_model_name_or_path, + subfolder="unet", + revision=args.revision, + ) + + vae.requires_grad_(False) + if not args.train_text_encoder: + text_encoder.requires_grad_(False) + + if args.gradient_checkpointing: + unet.enable_gradient_checkpointing() + if args.train_text_encoder: + text_encoder.gradient_checkpointing_enable() + + if args.scale_lr: + args.learning_rate = ( + args.learning_rate + * args.gradient_accumulation_steps + * args.train_batch_size + * accelerator.num_processes + ) + + # Use 8-bit Adam for lower memory usage or to fine-tune the model in 16GB GPUs + if args.use_8bit_adam: + try: + import bitsandbytes as bnb + except ImportError: + raise ImportError( + "To use 8-bit Adam, please install the bitsandbytes library: `pip install bitsandbytes`." + ) + + optimizer_class = bnb.optim.AdamW8bit + else: + optimizer_class = torch.optim.AdamW + + params_to_optimize = ( + itertools.chain(unet.parameters(), text_encoder.parameters()) + if args.train_text_encoder + else unet.parameters() + ) + optimizer = optimizer_class( + params_to_optimize, + lr=args.learning_rate, + betas=(args.adam_beta1, args.adam_beta2), + weight_decay=args.adam_weight_decay, + eps=args.adam_epsilon, + ) + + noise_scheduler = DDPMScheduler.from_config( + args.pretrained_model_name_or_path, subfolder="scheduler" + ) + + train_dataset = DreamBoothDataset( + instance_data_root=args.instance_data_dir, + instance_prompt=args.instance_prompt, + class_data_root=args.class_data_dir if args.with_prior_preservation else None, + class_prompt=args.class_prompt, + tokenizer=tokenizer, + size=args.resolution, + center_crop=args.center_crop, + ) + + def collate_fn(examples): + input_ids = [example["instance_prompt_ids"] for example in examples] + pixel_values = [example["instance_images"] for example in examples] + + # Concat class and instance examples for prior preservation. + # We do this to avoid doing two forward passes. + if args.with_prior_preservation: + input_ids += [example["class_prompt_ids"] for example in examples] + pixel_values += [example["class_images"] for example in examples] + + pixel_values = torch.stack(pixel_values) + pixel_values = pixel_values.to(memory_format=torch.contiguous_format).float() + + input_ids = tokenizer.pad( + {"input_ids": input_ids}, + padding="max_length", + max_length=tokenizer.model_max_length, + return_tensors="pt", + ).input_ids + + batch = { + "input_ids": input_ids, + "pixel_values": pixel_values, + } + return batch + + train_dataloader = torch.utils.data.DataLoader( + train_dataset, + batch_size=args.train_batch_size, + shuffle=True, + collate_fn=collate_fn, + num_workers=1, + ) + + # Scheduler and math around the number of training steps. + overrode_max_train_steps = False + num_update_steps_per_epoch = math.ceil( + len(train_dataloader) / args.gradient_accumulation_steps + ) + if args.max_train_steps is None: + args.max_train_steps = args.num_train_epochs * num_update_steps_per_epoch + overrode_max_train_steps = True + + lr_scheduler = get_scheduler( + args.lr_scheduler, + optimizer=optimizer, + num_warmup_steps=args.lr_warmup_steps * args.gradient_accumulation_steps, + num_training_steps=args.max_train_steps * args.gradient_accumulation_steps, + ) + + if args.train_text_encoder: + ( + unet, + text_encoder, + optimizer, + train_dataloader, + lr_scheduler, + ) = accelerator.prepare( + unet, text_encoder, optimizer, train_dataloader, lr_scheduler + ) + else: + unet, optimizer, train_dataloader, lr_scheduler = accelerator.prepare( + unet, optimizer, train_dataloader, lr_scheduler + ) + + weight_dtype = torch.float32 + if accelerator.mixed_precision == "fp16": + weight_dtype = torch.float16 + elif accelerator.mixed_precision == "bf16": + weight_dtype = torch.bfloat16 + + # Move text_encode and vae to gpu. + # For mixed precision training we cast the text_encoder and vae weights to half-precision + # as these models are only used for inference, keeping weights in full precision is not required. + vae.to(accelerator.device, dtype=weight_dtype) + if not args.train_text_encoder: + text_encoder.to(accelerator.device, dtype=weight_dtype) + + # We need to recalculate our total training steps as the size of the training dataloader may have changed. + num_update_steps_per_epoch = math.ceil( + len(train_dataloader) / args.gradient_accumulation_steps + ) + if overrode_max_train_steps: + args.max_train_steps = args.num_train_epochs * num_update_steps_per_epoch + # Afterwards we recalculate our number of training epochs + args.num_train_epochs = math.ceil(args.max_train_steps / num_update_steps_per_epoch) + + # We need to initialize the trackers we use, and also store our configuration. + # The trackers initializes automatically on the main process. + if accelerator.is_main_process: + accelerator.init_trackers("dreambooth", config=vars(args)) + + # Train! + total_batch_size = ( + args.train_batch_size + * accelerator.num_processes + * args.gradient_accumulation_steps + ) + + logger.info("***** Running training *****") + logger.info(f" Num examples = {len(train_dataset)}") + logger.info(f" Num batches each epoch = {len(train_dataloader)}") + logger.info(f" Num Epochs = {args.num_train_epochs}") + logger.info(f" Instantaneous batch size per device = {args.train_batch_size}") + logger.info( + f" Total train batch size (w. parallel, distributed & accumulation) = {total_batch_size}" + ) + logger.info(f" Gradient Accumulation steps = {args.gradient_accumulation_steps}") + logger.info(f" Total optimization steps = {args.max_train_steps}") + # Only show the progress bar once on each machine. + progress_bar = tqdm( + range(args.max_train_steps), disable=not accelerator.is_local_main_process + ) + progress_bar.set_description("Steps") + global_step = 0 + + for epoch in range(args.num_train_epochs): + unet.train() + if args.train_text_encoder: + text_encoder.train() + for step, batch in enumerate(train_dataloader): + with accelerator.accumulate(unet): + # Convert images to latent space + latents = vae.encode( + batch["pixel_values"].to(dtype=weight_dtype) + ).latent_dist.sample() + latents = latents * 0.18215 + + # Sample noise that we'll add to the latents + noise = torch.randn_like(latents) + bsz = latents.shape[0] + # Sample a random timestep for each image + timesteps = torch.randint( + 0, + noise_scheduler.config.num_train_timesteps, + (bsz,), + device=latents.device, + ) + timesteps = timesteps.long() + + # Add noise to the latents according to the noise magnitude at each timestep + # (this is the forward diffusion process) + noisy_latents = noise_scheduler.add_noise(latents, noise, timesteps) + + # Get the text embedding for conditioning + encoder_hidden_states = text_encoder(batch["input_ids"])[0] + + # Predict the noise residual + model_pred = unet( + noisy_latents, timesteps, encoder_hidden_states + ).sample + + # Get the target for loss depending on the prediction type + if noise_scheduler.config.prediction_type == "epsilon": + target = noise + elif noise_scheduler.config.prediction_type == "v_prediction": + target = noise_scheduler.get_velocity(latents, noise, timesteps) + else: + raise ValueError( + f"Unknown prediction type {noise_scheduler.config.prediction_type}" + ) + + if args.with_prior_preservation: + # Chunk the noise and model_pred into two parts and compute the loss on each part separately. + model_pred, model_pred_prior = torch.chunk(model_pred, 2, dim=0) + target, target_prior = torch.chunk(target, 2, dim=0) + + # Compute instance loss + loss = ( + F.mse_loss(model_pred.float(), target.float(), reduction="none") + .mean([1, 2, 3]) + .mean() + ) + + # Compute prior loss + prior_loss = F.mse_loss( + model_pred_prior.float(), target_prior.float(), reduction="mean" + ) + + # Add the prior loss to the instance loss. + loss = loss + args.prior_loss_weight * prior_loss + else: + loss = F.mse_loss( + model_pred.float(), target.float(), reduction="mean" + ) + + accelerator.backward(loss) + if accelerator.sync_gradients: + params_to_clip = ( + itertools.chain(unet.parameters(), text_encoder.parameters()) + if args.train_text_encoder + else unet.parameters() + ) + accelerator.clip_grad_norm_(params_to_clip, args.max_grad_norm) + optimizer.step() + lr_scheduler.step() + optimizer.zero_grad() + + # Checks if the accelerator has performed an optimization step behind the scenes + if accelerator.sync_gradients: + progress_bar.update(1) + global_step += 1 + + if global_step % args.save_steps == 0: + if accelerator.is_main_process: + pipeline = StableDiffusionPipeline.from_pretrained( + args.pretrained_model_name_or_path, + unet=accelerator.unwrap_model(unet), + text_encoder=accelerator.unwrap_model(text_encoder), + revision=args.revision, + ) + save_path = os.path.join( + args.output_dir, f"checkpoint-{global_step}" + ) + pipeline.save_pretrained(save_path) + + logs = {"loss": loss.detach().item(), "lr": lr_scheduler.get_last_lr()[0]} + progress_bar.set_postfix(**logs) + accelerator.log(logs, step=global_step) + + if global_step >= args.max_train_steps: + break + + accelerator.wait_for_everyone() + + # Create the pipeline using using the trained modules and save it. + if accelerator.is_main_process: + pipeline = StableDiffusionPipeline.from_pretrained( + args.pretrained_model_name_or_path, + unet=accelerator.unwrap_model(unet), + text_encoder=accelerator.unwrap_model(text_encoder), + revision=args.revision, + ) + pipeline.save_pretrained(args.output_dir) + + if args.push_to_hub: + repo.push_to_hub( + commit_message="End of training", blocking=False, auto_lfs_prune=True + ) + + accelerator.end_training() + + +if __name__ == "__main__": + args = parse_args() + main(args) diff --git a/stable-diffusion/upload_to_huggingface.py b/stable-diffusion/upload_to_huggingface.py new file mode 100644 index 0000000..a02a3c6 --- /dev/null +++ b/stable-diffusion/upload_to_huggingface.py @@ -0,0 +1,8 @@ +from huggingface_hub import HfApi + +api = HfApi() +api.upload_folder( + folder_path="/home/float/dreambooth/checkpoint-1000", + repo_id="float-trip/marsey-db-sd2", + repo_type="model", +)