Adcom

Adcom

Rainbow Candy
Rainbow Candy
Pink Candy
Pink Candy
Green Candy
Green Candy
Blue Candy
Blue Candy
JoyCaptions 4 Lyfe 🤟
91
Followers
47
Following
4.1K
Runs
18
Downloads
53
Likes

Articles

View All
LoRa in SD3.5 | Dataset Creation + Tools

LoRa in SD3.5 | Dataset Creation + Tools

LoRa Dataset Creation in SD3.5This is a walkthrough of my LoRa creation process for SD3.5. I am using a number of external tools which are listed in this article.Part 1: Find a good datasetFor this project I plan on creating a LoRa for a japanese magazine style cover-art for SD 3.5 Large modelThe first step is sourcing reference material for your LoRa. I used kimirano.jp to find a collection of imagesOther sources which find useful are DeviantArtPinterest: https://www.pinterest.com/And Sankaku Complex for the NSFW stuff (they have a phone app: https://apps.apple.com/us/app/sankaku-anime-ai-girlfriend/)These are the ones I selected. I compiled this collage using https://gandr.ioAbove is example of me using gandr.io on some robots. Here is what the output looks like:Note that the backgrounds for these robots have been edited using GIMP. For large datasets , the predominant color will oftentimes be white. Try to offset this whenever possible. Adding a black rim at the edges will teach the LoRa that high contrast = good. Green and Blue are rare colors. You want to use a unique color scheme. It will make the LoRa output image stand out in an AI art gallery.And here are the manga covers:Compiling the training images this way is a good way to showcase to people what "type" of image your LoRa can create.Some points when selecting the LoRa reference material:Use images where only 1 person existsUse different colors for backgroundsAvoid items that feature obscured bodypartsAvoid images with a lot of white , beige or gray in them.Judge the pictures based on color , clarity and composition. If you can't tell what the image is based on the thumbnail , the AI model won't understand it either.Understand the Stable Diffusion community. If you want it , others want it too. For example; the reason why I'm training this LoRa is to give people (and myself) the means to produce cool coverpage images for future models, articles , posts etc.Next , I edit the photos using a photoeditor tool such as GIMP : https://www.gimp.org/downloads/The goal is to remove anything which may confuse the AI model when trying to re-create the images.SD3.5 Large model will happily accept any LoRa content that features nudity. The base SD 3.5 Large model lacks any training for NSFW content, so it will happily gobble up such content to make the 'pieces within itself' fit together nicely.In this case , I've removed all English Text from the cover-art you see above. This is to avoid a concept blend between Kanji letters and English text for the T5 model. We still want to be able to write English text with the LoRa after all.The general rule of thumb from the LoRa community is having between 20-30 images for a character , and at least 30 images if the LoRa embodies something more abstract like a concept or style.In this case I use 24 images. My reasoning here is that the coverart is very "chaotic" so only a few images are required to represent a decent amount of variety. Plus we want to save the LoRa training costs since recreating this very densely packed artstyle will likely require a lot of epochs before it "stabilizes" so-to-speak.Part 2: Selecting a KeywordWhile a keyword can be anything you want it to be; this time I've decided to take the scientific appreach.This noteook can be used to search tokens in SD3.5 : https://huggingface.co/datasets/codeShare/text-to-image-prompts/blob/main/Google%20Colab%20Notebooks/token_vectors_math.ipynbWithin this notebook I made some random searches for tokens similar to "manga</w>" and "japan</w>" , and I stumbled upon the rarely used token "kei</w>" . I decided to include this into the keywordIf you want to see the concept representation of each token , you can try: https://benjamin-bertram.github.io/passive-illustration/index.html#token-libraryYou can also use this notebook to browse text_encodings: https://huggingface.co/datasets/codeShare/fusion-t2i-generator-data/blob/main/Google%20Colab%20Jupyter%20Notebooks/fusion_t2i_CLIP_interrogator.ipynbI used the text_encodings notebook to find the keyword for the robot lora.One of the similiar results according to CLIP model in the text_encoding notebook was "art by Brian Sum", so I googled that and behold "Brian Sum" was actually a guy who draws robots! You can find his creations here: https://www.artstation.com/sum . I did add 4 images of his works into the robot LoRa, bringing up the total from 26 images to 30.//----//For the mangacover art I decided the keyword for the LoRa should be "mangacover kei" . This allows me to hitch a ride on the training data which already exists within the SD3.5 model , saving epoch training time.To check the exact number of tokens used I use this online tokenizer : https://sd-tokenizer.rocker.boo/SD3.5 uses CLIP_L and CLIP_G , and has the same vocab as the previous SD models. The main difference is that it also uses the T5 model, which is an LLM model akin to chatGPT.To verify I run a prompt on a SD3.5 model as 'mangacover kei text "LORA" 'Good enough.Part 3: Writing the promptsWhen training T5 models , I prefer running the training images through JoyCaption Alpha One at 200 token length : https://huggingface.co/spaces/fancyfeast/joy-caption-alpha-oneWe want the prompts to be between 500-800 characters in length in order to keep it within the 256 token context length of the T5 model. To quote stability AI:While this model can handle long prompts, you may observe artifacts on the edge of generations when T5 tokens go over 256. Pay attention to the token limits when using this model in your workflow, and shortern prompts if artifacts becomes too obvious.Also note:The medium model (SD3.5M) has a different training data distribution than the large model (SD3.5 Large), so it may not respond to the same prompt similarly.Source: https://huggingface.co/stabilityai/stable-diffusion-3.5-mediumPart 4: Compiling the DatasetFinally I apply the selected images to Batchcropper : https://batchcropper.com/enI prefer using portrait size 768x1024 or 768x1150 for the dataset.Then I paste the JoyCaption prompts and add my selected keywords to somewhere close to the start of the prompts.The training set is now done! It can be downloaded as a zip file and kept in a Huggingface repository until it is time to train them: https://huggingface.co/datasets/codeShare/lora-training-dataShould you wish to store training data privately you can use https://mega.nz/ . They are a cloud storage website which encrypts their user data and by policy have 0 % knowledge of the content you store online as long as the repository is set to private.Note that due to recent legislation in California, more common hosting websites like Google drive may ban your account if you use their services to host certain type of content. This will include celebrity impersonation. This is something to keep in mind.//----//When you do your training , remember to document, document , document!Users wants to see your dataset , your prompts , your examples (including the bad ones) , the loss graph on the LoRa training , the epoch you choose to release , your methods, your sources. The sharing of information is the lifeblood of an open source community.This is the Loss graph of the Brain Sum LoRaWe see a dip in Loss rate past epoch 14. Thus , it is reasonable to post every epoch past epoch 14 to the LoRa. Then we can do some trial and error on the epochs 14-20 to find which of these has the "best looking" output.//----//LoRas I've made (so far)Brian Sum Lora : https://tensor.art/models/795501520574647074?source_id=njq1pFzjlEOwpPEpaXny-xcuNaytlayt NSFW training LoRa : https://tensor.art/models/793017079562442313?source_id=njq1pFzjlEOwpPEpaXny-xcuTsutomo Nihei LoRa : https://tensor.art/models/791213304967242613?source_id=njq1pFzjlEOwpPEpaXny-xcuTraining Data:Brain Sum Training data (imgur): https://imgur.com/a/blPjv6SI post my training data here , which you can download as a zip file: https://huggingface.co/datasets/codeShare/lora-training-data/tree/main//----//Thank you for reading this article. Hopefully it will be some help. Good luck on the Lora training for the SD3.5 model.
Batchcropper for Lora using T5 model in SD3.5M + extra stuff  | HALLOWEEN2024

Batchcropper for Lora using T5 model in SD3.5M + extra stuff | HALLOWEEN2024

I recently trained my first LoRa and this tool was very useful for organizing the images: https://batchcropper.com/enFor prompting the descriptive text I've been using JoyCaption:Demo: https://huggingface.co/spaces/fancyfeast/joy-caption-pre-alphaNotebook: https://colab.research.google.com/github/camenduru/joy-caption-jupyter/blob/main/joy_caption_jupyter.ipynb//---//The batchcropper tool linked at the top allows you to paste the Joycaption prompts alongside the images to create your own dataset//---//From the SD3.5-M model release we get this information regarding the batch size for the T5 model:Link: https://huggingface.co/stabilityai/stable-diffusion-3-mediumThe T5 is an LLM model. Input can be very different from the CLIP models many are used to prompt with.How can this be used? One thing I've been experimenting with is taking audio segments from various places like the Charcarhadron 40K lore video (good listen to btw) : https://youtube.com/@adeptus-astra?si=zUl7t8wIEromruL2Downloading it as an MP3 either via an online tool or if the video is long (more than 1h , or if you want to download many videos to mp3 at once) using this notebook I've coded: https://huggingface.co/codeShare/JupyterNotebooks/blob/main/YT-playlist-to-mp3.ipynbAnd then passing the MP3 through this online transcriber tool: https://turboscribe.aiAnd voila! Now you have bits and pieces of rather unique prompt snippets which can be used for the T5. I made some spaceships using this technique: See this post for prompt: https://tensor.art/images/790655766681080995?post_id=790655766676886694&source_id=njq1pFzjlEOwpPEpaXny-xcuLoRa which I trained on the SD3.5M model: https://tensor.art/models/790774208985724051?source_id=njq1pFzjlEOwpPEpaXny-xcuI used the training feature on TensorArt. Its the Symbol with barbell called "Training" which can be found by clicking the button on the left side ---> of your TensorArt UICheers, Adcom
Are score_tags neccessary in PDXL/SDXL Pony Models?  |  Halloween2024

Are score_tags neccessary in PDXL/SDXL Pony Models? | Halloween2024

Consensus is that the latest generation of Pony SDXL models no linger require "score_9 score_8 score_7" written in the prompt to "look good".//----//It is possible to visualize our actual input to the SD model for CLIP_L ( a 1x768 tensor) as a 16x16 grid , each with RGB values since 16 x 16 x 3 = 768I'll assume CLIP_G in the SDXL model can be ignored. Its assumed CLIP_G is functionally the same but for 1024 dimension instead of 768.So the here we have the prompt : "score_9 score_8_up score_8_up"Then I can do the same but for the prompt : "score_9 score_8_up score_8_up" + XWhere X is some random extremely sus prompt I fetch from my gallery. Assume it to fill up to the full 77 tokens (I set truncate=True on the tokenizer so it just caps off past the 77 token limit)Examples:etc. etc.Granted , first three tokens in the prompt for the 768 encoding greatly influnces the "theme" of the output.But from above images one can see that the "appearance" of the text encoding can vary a lot.Thus , the "best" way to write a prompt is rarely universal.Here I'm running some random text I write myself to check similarity to our "score prompt" (top result should be 100% , so I might have some rounding error) :score_6 score_7_up score_8_up : 98.03% score 8578 : 85.42% highscore : 82.87% beautiful : 77.09% score boobs score : 73.16% SCORE : 80.1% score score score : 83.87% score 1 score 2 score 3 : 87.64% score : 80.1% score up score : 88.45% score 123 score down : 84.62%So even though the model is trained for "score_6 score_7_up score_8_up"we can be kinda loose in how we want to phrase it , if we want to phrase it.Same principle applies for all LoRA and their activation keywords.Negatives are special. The text we write in the negatives are split by whitespace , and the chunks are encoded individually.Link to Notebook if you want to run your own tests:https://huggingface.co/datasets/codeShare/fusion-t2i-generator-data/blob/main/Google%20Colab%20Jupyter%20Notebooks/fusion_t2i_CLIP_interrogator.ipynbI use this thing to search up prompt words using the CLIP_L model//---//These are the most similiar items to the Pony model "score prompt" within my text corpusItems of zero similarity (perpendicular) negative similarity (vector at opposite direction) to encoding are omitted from these results.Note that this are encodings similiar to the "score prompt" trigger encoding , not analysis of what the Pony Model considers good quality.Prompt phrases among my text corpus most similiar to "score_9 score_8_up score_8_up" according to CLIP (the peak of the graph above): Community: sfa_polyfic - 68.3 % holding blood ephemeral dream - 68.3 % Excell - 68.3 % supacrikeydave - 68.3 % Score | Matthew Caruso - 67.8 % freckles on face and body HeadpatPOV - 67.8 % Kazuno Sarah/Kunikida Hanamaru - 67.8 % iers-kraken lun - 67.8 % blob whichever blanchett - 67.6 % Gideon Royal - 67.6 % Antok/Lotor/Regris (Voltron) - 67.6 % Pauldron - 66.7 % nsfw blush Raven - 66.7 % Episode: s08e09 Enemies Domestic - 66.7 % John Steinbeck/Tanizaki Junichirou (Bungou Stray Dogs) - 66.7 % populism probiotics airspace shifter - 65.4 % Sole Survivor & X6-88 - 65.4 % Corgi BB-8 (Star Wars) - 65.4 % Quatre Raberba Winner/Undisclosed - 65.2 % resembling a miniature fireworks display with a green haze. Precision Shoot - 65.2 % bracelet grey skin - 65.2 % Reborn/Doctor Shamal (Katekyou Hitman Reborn!)/Original Male Character(s) - 65.2 % James/Madison Li - 65.1 % Feral Mumintrollet | Moomintroll - 65.1 % wafc ccu linkin - 65.1 % Christopher Mills - 65.0 % at Overcast - 65.0 % Kairi & Naminé (Kingdom Hearts) - 65.0 % with magical symbols glowing in the air around her. The atmosphere is charged with magic Ghost white short kimono - 65.0 % The ice age is coming - 65.0 % Jonathan Reid & Bigby Wolf - 65.0 % blue doe eyes cortical column - 65.0 % Leshawna/Harold Norbert Cheever Doris McGrady V - 65.0 % foxtv matchups panna - 65.0 % Din Djarin & Migs Mayfeld & Grogu | Baby Yoda - 65.0 % Epilogue jumps ahead - 65.0 % nico sensopi - 64.8 % 秦风 - Character - 64.8 % Caradoc Dearborn - 64.8 % caribbean island processing highly detailed by wlop - 64.8 % Tim Drake's Parents - 64.7 % probiotics hardworkpaysoff onstorm allez - 64.7 % Corpul | Coirpre - 64.7 % Cantar de Flor y Espinas (Web Series) - 64.7 % populist dialog biographical - 64.7 % uf!papyrus/reader - 64.7 % Imrah of Legann & Roald II of Conte - 64.6 % d brown legwear - 64.6 % Urey Rockbell - 64.6 % bass_clef - 64.6 % Royal Links AU - 64.6 % sunlight glinting off metal ghost town - 64.6 % Cross Marian/Undisclosed - 64.6 % ccu monoxide thcentury - 64.5 % Dimitri Alexandre Blaiddyd & Summoner | Eclat | Kiran - 64.5 %
24
2
Halloween2024 | What [from:to:when] is and why it should be added to TAMS2

Halloween2024 | What [from:to:when] is and why it should be added to TAMS2

[ from : to : when ] commands no longer work in the prompt since TAMS1 was removedFeature Example: https://discord.com/channels/1108668896959025214/1108693680321208320/1298436766700797953https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/FeaturesPrompt for the lady is "bartender standing behind bar art by Anna Dittmann artistic Cosplay Photograph"To simulate the effects of [from:to:when] , I will run the prompt as img2img on this abstract noise patternBit crude, but you can see that by having some " noise" in the image initially , output is improvedTime for practical examplePrompt for these are: "[many photography abstractart dark incadescent pink tints dark abstractart with dark lean saturations foggy dark on night grape tones sleek 1girl:dissolve silhouette in this composition barcode Oblivious!Bucky looking at viewer5 steampunk humanoid creature deformed mangled bloody En el fondo hay un espejo. Chas Quilter Swept from the Sea \(1997\) BioSteel Camp :0.1]"...or some variation. Examples:Some additional examples using this techniqueThe model used is the SD 1.5 Indigo Furry model , for those curious In summary ; pre-rendindering the first 10-20% with a colorful and dark pattern can offset many inherent flaws in SD related to color variation and light contrast Note thar this feature does not work on TensorArt yet , as TAMS2 syntax for this command is still borked. Please do me a favour , remind the devs to implement this feature on the discord: https://discord.com/channels/1108668896959025214/1179345714443190302/1298008202675486810Cheers, Adcom

Posts