kohya-ss / kohya-ss/sd-scripts
Assigning Keep Token per file
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.2k
- Avg merge
- 11m
- Merged PRs (30d)
- 2
Description
Right now Keep Token only works per folder rather than per file. For training which consists of multi-part outfits or multiple concepts, this can be a fairly large limitation due to the varying number of tokens that should be trained per file.
For example, let's say I want to train one character and 5 articles of clothing which make the outfit:
_character, hat, necklace, shirt, shorts, boots_.
Upper body shots will only include _character, hat, necklace, shirt_. Some of them might not even include the necklace and would only have _character, hat, shirt_. Full body shots would use all 6 tokens. That means that there's potentially 6 different folders needed to properly assign keep token values. That's not the biggest issue by itself since 6 folders isn't too many, but the problem becomes larger when wanting to define repeats and can grow exponentially for each new token you want to train.
As an actual example, I'm planning on retraining [this LoRA](https://civitai.com/models/10041/vladilena-milize-86-eighty-six) which consists of 5 trained tokens. I currently have 3 folders for a different number of repeats. Currently I'm settling with keep token = 1 which is for the character herself, but if I wanted to set keep token values to include her outfit I'd need _15 folders_. And that's for one character with one outfit.
I think having the option to assign keep token values per file would be extremely helpful. I'm not sure about the syntax though. I was initially thinking about assigning the value in the name of the file similar to how repeats are done, but since there's an image file associated with the txt, it might be annoying to have to change 2 file names.
Contributor guide
No contributing guide indexed for this repository
Research direction
No files, tests, or entry points are named. Start by locating how folder-level Keep Token and repeats are parsed, then define a per-file syntax that handles the associated image and caption files. Done means per-file Keep Token values work alongside repeats without requiring additional folders, with coverage for the proposed naming or metadata format.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100