SimpleTuner icon indicating copy to clipboard operation
SimpleTuner copied to clipboard

KeyError [resolution] halts config.py (in prompt library part)

Open drscotthawley opened this issue 4 months ago • 0 comments

Hi, new user here. I wanted to train a model for some very small (128x128) images. I specified 128 as the resolution, but the configure script eventually terminates with KeyError: 128.

Here's a copy of the log. Running on Linux, Ubuntu 22.04, Python 3.11

$ python configure.py
Welcome to SimpleTuner!
This script will guide you through setting up your config.json file.

Enter the directory where you want to store your outputs (default: output/models): 
What type of model are you training? (Options: [lora], full) (default: lora): 
Would you like to train a LyCORIS model? ([y]/n) (default: y): 
Let's configure your LyCORIS model!

Select a LyCORIS algorithm:

1. LoRA - Efficient, balanced fine-tuning. Good for general tasks. (algo=lora)
2. LoHa - Advanced, strong dampening. Ideal for multi-concept fine-tuning. (algo=loha)
3. LoKr - Kronecker product-based. Use for complex transformations. (algo=lokr)
4. Full Fine-Tuning - Traditional full model tuning. (algo=full)
5. IA^3 - Efficient, tiny files, best for styles. (algo=ia3)
6. DyLoRA - Dynamic updates, efficient with large dims. (algo=dylora)
7. Diag-OFT - Fast convergence with orthogonal fine-tuning. (algo=diag-oft)
8. BOFT - Advanced version of Diag-OFT with more flexibility. (algo=boft)
9. GLoRA - Generalized LoRA. (algo=glora)

Which LyCORIS algorithm would you like to use? (Enter the number corresponding to the algorithm) (default: 3): 

Configuring LOKR algorithm...

Set the effect multiplier. Adjust for stronger or subtler effects. (default: 1.0) (default: 1.0): 
Set the linear dimension. Higher values mean more capacity but use more resources. (default: 10000) (default: 10000): 3000
Set the alpha scaling factor. Controls the impact on the model. (default: 1) (default: 1): 
Set the factor for compression/expansion. (default: 16) (default: 16): 

Next, configure the modules to target with this algorithm.
Which modules should the LOKR algorithm be applied to? (default: Attention, FeedForward) (default: Attention, FeedForward): 
Set factor for Attention. (default: 16) (default: 16): 
Set factor for FeedForward. (default: 8) (default: 8): 

LyCORIS configuration complete:  {'algo': 'lokr', 'multiplier': 1.0, 'linear_dim': 3000, 'linear_alpha': 1, 'factor': 16, 'apply_preset': {'target_module': ['Attention', 'FeedForward'], 'module_algo_map': {'Attention': {'factor': 16}, 'FeedForward': {'factor': 8}}}}
We'll try and login to Hugging Face Hub..
Should we schedule the end of training by epochs, or steps? (default: steps): 
Set the maximum number of steps (default: 10000): 
Set the checkpointing interval (in steps) (default: 500): 
How many checkpoints do you want to keep? LoRA are small, and you can keep more than a full finetune. (default: 5): 
Connected to Hugging Face Hub as: drscotthawley
Do you want to push your model to Hugging Face Hub when it is completed uploading? (y/n) (default: y): n
Would you like to report training statistics to Weights & Biases? ([y]/n) (default: y): 
Would you like to report training statistics to TensorBoard? (y/[n]) (default: n): 
Would you like to use SageAttention for image validation generation? (y/[n]) (default: n): 
Enter the name of your Weights & Biases project (default: lora-training): 
Enter the name of your Weights & Biases runs. This can use shell commands, which can be used to dynamically set the run name. (default: simpletuner-lora): 
Which model family are you training? (flux/sdxl/kolors/sd3/legacy/ltxvideo/wan) (default: flux): sd3
Enter the model name from Hugging Face Hub (default: stabilityai/stable-diffusion-3.5-large): stabilityai
/
stable-diffusion-3.5-medium For some reason, we can not load that model. Can you check your Hugging Face login and try again?
Enter the model name from Hugging Face Hub (default: stabilityai/stable-diffusion-3.5-large): For some reason, we can not load that model. Can you check your Hugging Face login and try again?
Enter the model name from Hugging Face Hub (default: stabilityai/stable-diffusion-3.5-large): stabilityai/stable-diffusion-3.5-medium
For some reason, we can not load that model. Can you check your Hugging Face login and try again?
Enter the model name from Hugging Face Hub (default: stabilityai/stable-diffusion-3.5-large): stabilityai/stable-diffusion-3.5-medium
Set the training batch size. Larger values will require larger datasets, more VRAM, and slow things down. (default: 1): 
Would you like to configure a gradient checkpointing interval? A value larger than 1 will increase VRAM usage but speed up training by skipping checkpoint creation every Nth layer, and a zero will disable this feature.: 
Set the caption dropout rate, or use 0.0 to disable it. Dropout might be a good idea to disable for Flux training, but experimentation is warranted. (default: 0.05): 
How do you want to measure dataset resolutions? 'pixel' will size images with the shorter edge, 'area' will measure in megapixels, and is great for aspect-bucketing. 'pixel_area' is a combination of these two ideas, which lets you set your area using pixels instead of megapixels. (default: pixel_area): 
What would you like the default resolution of your datasets to be? The default for is pixel_area is 1024 pixels. (default: 1024): 128
Set the seed for validation (default: 42): 
How many steps in between validation outputs? (default: 500): 
Set the validation resolution. Format could be a single resolution, or comma-separated. (default: 1024x1024): 128x128
Set the guidance scale for validation (default: 5.0): 
Set the guidance re-scale for validation - this is called dynamic thresholding and is used mostly for zero-terminal SNR models. (default: 0.0): 
Set the number of inference steps for validation (default: 20): 
Set the validation prompt (default: A photo-realistic image of a cat): midi piano roll image
Would you like to enable TF32 mode? ([y]/n) (default: y): 
Set mixed precision mode (Options: bf16, no (fp32)) (default: bf16): 
Choose an optimizer (Options: adamw_bf16/ao-adamw8bit/ao-adamw4bit/ao-adamfp8/ao-adamwfp8/adamw_schedulefree/adamw_schedulefree+aggressive/adamw_schedulefree+no_kahan/optimi-stableadamw/optimi-adamw/optimi-lion/optimi-radam/optimi-ranger/optimi-adan/optimi-adam/optimi-sgd/soap/bnb-adagrad/bnb-adagrad8bit/bnb-adam/bnb-adam8bit/bnb-adamw/bnb-adamw8bit/bnb-adamw-paged/bnb-adamw8bit-paged/bnb-lion/bnb-lion8bit/bnb-lion-paged/bnb-lion8bit-paged/bnb-ademamix/bnb-ademamix8bit/bnb-ademamix-paged/bnb-ademamix8bit-paged/prodigy) (default: adamw_bf16): 
Set the learning rate scheduler. Options: polynomial/constant (default: polynomial): 
Set the learning rate (default: 1e-4): 
Set the number of warmup steps before the learning rate reaches its peak. This is set to 10 percent of the total runtime by default, or 100 steps, whichever is higher. (default: 100): 
Would you like to enable model quantization? NOTE: Currently, a bug prevents multi-GPU training with LoRA. ([y]/n) (default: y): 
Choose quantization type. (Options: no_change/int8-quanto/int4-quanto/int2-quanto/int8-torchao/nf4-bnb/fp8-quanto/fp8uz-quanto/fp8-torchao) (default: int8-quanto): 
Would you like to compress the disk cache? (y/n) (default: y): 
Would you like to use torch compile during validations? (y/n) (default: n): 
Does this look correct? (y/n) (default: y): y

Configuration file created successfully!
Would you like to generate a very rudimentary subject-centric prompt library for your dataset? This will download a small 1B Llama 3.2 model. If a user prompt library exists, it will be overwritten. (y/n) (default: y): 
Enter a trigger word (or a few words) that you would like Llama 3.2 1B to expand. (default: Character Name): midi piano roll image
How many prompts would you like to generate? (default: 8): 
(warning) Failed to generate prompt library: You are trying to access a gated repo.
Make sure to have access to it at https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct.
403 Client Error. (Request ID: Root=1-683742c0-54964bea65bbc96d6729960c;a1ba165b-0346-4c3d-8627-32324de90b72)

Cannot access gated repo for url https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct/resolve/main/config.json.
Access to model meta-llama/Llama-3.2-1B-Instruct is restricted and you are not in the authorized list. Visit https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct to ask for access.
Would you like to configure your dataloader? (y/n) (default: y): 
Enter the name of your dataset. This will be used to generate the cache directory. It should be simple, and not contain spaces or special characters. (default: my-dataset): 
Enter the path to your dataset. This should be a directory containing images and text files for their caption. For reliability, use an absolute (full) path, beginning with a '/' (default: /datasets/my-dataset): /data/POP909_images_simple
How should the dataloader handle captions?
-> 'filename' will use the names of your image files as the caption
-> 'textfile' requires a image.txt file to go next to your image.png file
-> 'instanceprompt' will just use one trigger phrase for all images

(Options: filename, textfile, instanceprompt) (default: textfile): instanceconcept
Invalid caption strategy: instanceconcept
How many times do you want to repeat each image in the dataset? A value of zero means the dataset will only be seen once; a value of one will cause the dataset to be sampled twice. (default: 10): 
Which resolutions do you want to train? A comma-separated list of values or a single item can be given to train on multiple base resolutions. (default: 1024): 128
Where will your VAE and text encoder caches be written to? Subdirectories will be created inside for you automatically. (default: cache/): 
Do you have very-large images in the dataset (eg. much larger than 1024x1024)? (y/n) (default: n): 
Traceback (most recent call last):
  File "/home/shawley/github/SimpleTuner/configure.py", line 980, in <module>
    configure_env()
  File "/home/shawley/github/SimpleTuner/configure.py", line 959, in configure_env
    uncropped_dataset = create_dataset_config(
                        ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shawley/github/SimpleTuner/configure.py", line 927, in create_dataset_config
    dataset.update(resolution_configs[resolution])
                   ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 128

drscotthawley avatar May 28 '25 17:05 drscotthawley