metadata
license: unlicense
language:
- en
library_name: diffusers
pipeline_tag: text-generation
tags:
- art
REM sleep priming anime
A Python script that will generates the prompt unconditionally to increase the variation without any LLM bias; by Python's built-in Mersenne Twister (mt19937) PRNG in the random module. Iterated and tested with cagliostrolab/animagine-xl-3.1 spaces. Not all the generated detail in the prompt works, this is due to the model lacking the dataset to understand it. And, not the script is not working. To use it, run the script and copy the printed output.
Examples:
1girl, early, creative, lifting, red-purple bangs haircut, green wolf eyes, earrings, navy blue and tan outfit, crewneck, flare jeans, high-angle shot, colonies on other planets, crepuscular rays
Code
import random
import functools
class REMSleepPrmAnime:
def __init__(self):
# Time
self.year_ranges = {"both": {"newest", "recent", "mid", "early", "oldest"}}
# --- Subject
# Head
self.haircuts = {"both": {"bob", "pixie", "cut", "shaggy", "layers", "mullet", "afro", "fringe", "bangs", "quiff", "undercut", "braids", "knot", "ponytail", "curls", "blunt", "perm", "fade", "crop", "bowl", "curtain", "top", "balayage", "shag", "bang", "waves"},
"male": {"mohawk", "dreadlocks"}}
self.eye_colors = {"both": {"blue", "red", "yellow", "green", "orange", "red-orange", "yellow-orange", "yellow-green", "blue-green"} \
| {"gray", "amber", "hazel", "gold", "silver"},
"female": {"pink", "purple", "red-purple", "blue-purple"}}
self.eye_shapes = {"both": {"normal", "large", "moe", "realistic", "cat", "wolf", "dog", "bird", "no irises", "heterochromia", "glowing", "small", "starburst pupils", "googly", "tearful", "chibi"}, "female": {"shoujo"}}
self.blush = {"female": {"blush"}}
self.eyebrow_shapes = {"both": {"straight", "curved", "angular", "thick", "thin", "high arched", "low arched", "rounded", "uneven"}}
self.lips_shapes = {"both": {"small", "wide", "round"}}
self.nose_shapes = {"both": {"aquiline", "straight", "bulbous", "button", "hooked", "flat", "snub", "roman", "turned up", "pointy"}}
self.earrings = {"both": {"earrings"}}
# Outfit
self.outfit_colors = {"both": {"orange and white", "pale lilac and medium lavender", "hunter green and medium brown", "red and green", "navy blue and mustard yellow", "dark green and tan", "navy and white", "burgundy and gray", "burgundy and light brown", "navy blue and tan", "golden yellow and medium blue", "red and mustard yellow", "yellow and white", "maroon and gray", "black and white", "seal brown and tan", "charcoal gray and white", "blue-green and coral", "sky blue and charcoal gray", "red and light blue", "medium blue and chocolate brown", "medium green and white", "red and taupe", "red and mint green", "slate blue and warm white", "beige and maroon", "yellow and blue", "blue and orange", "pastel blue and yellow-orange", "bright blue and soft gray", "red and gray", "red and cyan", "red and yellow", "cerulean and neon green", "neon green and neon yellow", "navy blue and red", "sherbet orange and cool gray", "olive green and yellow", "yellow and deep sky blue", "dark brown and light blue", "magenta and charcoal", "red and white", "yellow and forest green", "light blue and navy blue", "orange and yellow", "charcoal grey and light blue", "pale coral and tan", "mauve-gray and olive", "yellow-orange and burnt orange", "orange and brown", "navy and light blue", "red and orange", "green and yellow", "gray and black", "green and blue", "teal and navy blue", "magenta and yellow", "yellow and brown", "red and black", "orange and green", "clay red and cerulean", "bright red and army green", "black and gray", "orange and black", "sage green and tan", "blue and turquoise", "beige and brown", "red and earthy browns", "dark green and gray", "blue and cyan", "olive green and navy blue", "olive green and maroon", "yellow and warm gray", "green and earthy browns", "burgundy and light blue", "khaki and pastel yellow", "taupe and white", "sky blue and royal blue", "orange and gray", "olive green and beige", "beige and blue", "burnt orange and hunter green", "blue and red", "navy blue and khaki"},
"female": {"blush pink and white", "pink and red", "pink and orange", "gray and light pink", "dark green and pink", "pink and warm black", "pink and blue", "medium pink and red", "rose pink and periwinkle", "yellow and pink", "purple and pink", "pink and turquoise", "pink and green", "navy blue and pink", "purple and charcoal gray", "turquoise and purple", "purple and yellow", "electric purple and black", "purple and orange", "green and purple", "red and purple"}}
self.tops = {"female": {"t-shirts", "blouses", "tunics", "camisoles", "tank tops", "crewneck", "v-neck", "cardigan", "turtleneck", "pullovers", "henleys", "crop tops", "off-the-shoulder tops", "cold shoulder tops", "peplum tops"}}
self.bottoms = {"both": {"shorts", "chinos", "cargo pants"},
"female": {"skinny jeans", "straight jeans", "bootcut jeans", "flare jeans", "wide-leg jeans", "bermuda shorts", "hotpants", "A-line skirts", "pencil skirts", "maxi skirts", "midi skirts", "mini skirts", "dress pants", "linen pants", "capris"} \
| {"stockings", "tights", "fishnets", "leggings", "yoga pants"}}
self.one_pieces = {"female": {"jumpsuits", "rompers", "swimsuits", "bodysuits"}}
# Personality
self.personality_traits = {"both": {"creative", "determined", "enthusiastic", "friendly", "generous", "humorous", "intelligent", "kind", "loyal", "motivated", "optimistic", "persistent", "resilient", "sincere", "thoughtful", "trustworthy", "versatile", "compassionate", "ambitious", "confident", "honest", "brave", "patient", "reliable", "adventurous", "charismatic", "gracious", "insightful", "perceptive", "resourceful", "selfless", "talented", "witty", "zealous"}}
# Actions
self.actions = {"both": {"walking", "running", "squatting", "crawling", "riding", "speaking", "dancing", "waving", "listening", "reading", "pulling", "carrying", "studying", "bending", "writing", "lifting", "sleeping", "lying down", "pushing", "drinking", "clapping", "playing", "typing", "reaching", "working", "climbing", "jumping", "swimming", "kneeling", "watching", "standing", "eating"}}
# ---
# Camera angles
self.camera_angels = {"both": {"low-angle", "eye level", "high-angle", "hip level", "knee level", "ground level", "shoulder level", "dutch angle", "overhead", "aerial"}}
# Places and eras
self.places = {"both": {"school", "skyscrapers", "neon lights", "crowded streets", "medieval kingdoms", "magical forests", "post-apocalyptic wastelands", "spaceships", "colonies on other planets", "vinland saga", "haunted houses", "cursed islands", "mystical dimensions", "training grounds", "stadiums", "arenas"}}
self.eras = {"both": {"meiji period", "edo period"}}
# Styles
self.resolutions = {"both": {"sharp focus", "8k"}}
self.lightings = {"both": {"rim lighting", "flat lighting", "cinematic lighting", "crepuscular rays"}}
def main(self):
def get_random_x(x, gender=["both"]):
concat = sum([list(x.get(ge, [])) for ge in gender], [])
return concat[random.randint(0, len(concat) - 1)] if len(concat) else ""
rand50 = lambda: random.randint(1, 100) <= 50
rand85 = lambda: random.randint(1, 100) <= 85
gender = "1girl" if rand50() else "1boy"
gender_selection = ["both"] + ["female" if gender == "1girl" else "male"]
get_random_x_by_gender = functools.partial(get_random_x, gender=gender_selection)
commands = (
# You must put trailing comma to convert a parenthesized expression into a tuple
(self.year_ranges,),
(self.personality_traits if rand50() else None,),
(self.actions,),
(self.eye_colors, self.haircuts, "haircut",),
(self.eye_colors, self.eye_shapes, "eyes",),
(self.blush if rand50() else None,),
# (self.eyebrow_shapes, "eyebrows",), # Diffusers are bad at drawing eyebrows
# (self.lips_shapes, "lips",), # Diffusers are bad at drawing lips
# (self.nose_shapes, "nose",), # Diffusers are bad at drawing nose
(self.earrings if rand50() else None,),
(self.outfit_colors, "outfit",),
*(((self.one_pieces,),) if rand50() else ((self.tops,), (self.bottoms,))),
(self.camera_angels, "shot",),
((self.places,) if rand85() else (self.eras,)),
# ("masterpiece",), ("best quality",), ("very aesthetic",), ("absurdres",), # Already prepended
(self.resolutions if rand50() else None,),
(self.lightings if rand50() else None,),
)
output = [gender] + [" ".join(
get_random_x_by_gender(elem) if isinstance(elem, dict) else elem
for elem in cmd
if elem is not None and isinstance(elem, (str, dict))
) for cmd in commands]
return ", ".join(filter(lambda s: s != "", output))
if __name__ == "__main__":
prompt_generator = REMSleepPrmAnime()
[print(prompt_generator.main()) for _ in range(1)]
{
"prompt": "1girl, newest, resourceful, sleeping, pink bowl haircut, yellow eyes, earrings, blue-green and coral outfit, pullovers, hotpants, eye level shot, colonies on other planets, masterpiece, best quality, very aesthetic, absurdres",
"negative_prompt": "nsfw, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract]",
"resolution": "896 x 1152",
"guidance_scale": 7,
"num_inference_steps": 12,
"seed": 1085670190,
"sampler": "Euler a",
"sdxl_style": "(None)",
"add_quality_tags": true,
"quality_tags": "Standard v3.1",
"use_upscaler": null,
"model": "Animagine XL 3.1"
}
{
"prompt": "1girl, recent, lying down, yellow bob haircut, red-orange dog eyes, earrings, red and light blue outfit, crewneck, maxi skirts, shoulder level shot, haunted houses, sharp focus, crepuscular rays, masterpiece, best quality, very aesthetic, absurdres",
"negative_prompt": "nsfw, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract]",
"resolution": "896 x 1152",
"guidance_scale": 7,
"num_inference_steps": 12,
"seed": 1000102344,
"sampler": "Euler a",
"sdxl_style": "(None)",
"add_quality_tags": true,
"quality_tags": "Standard v3.1",
"use_upscaler": null,
"model": "Animagine XL 3.1"
}
{
"prompt": "1girl, recent, honest, lifting, green crop haircut, silver eyes, green and blue outfit, swimsuits, eye level shot, mystical dimensions, crepuscular rays, masterpiece, best quality, very aesthetic, absurdres",
"negative_prompt": "nsfw, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract]",
"resolution": "896 x 1152",
"guidance_scale": 5,
"num_inference_steps": 12,
"seed": 2033092933,
"sampler": "Euler a",
"sdxl_style": "(None)",
"add_quality_tags": true,
"quality_tags": "Standard v3.1",
"use_upscaler": null,
"model": "Animagine XL 3.1"
}