automatic icon indicating copy to clipboard operation
automatic copied to clipboard

[Feature]: Support for Stable Cascade LoRAs and embeddings

Open Nerogar opened this issue 1 year ago • 7 comments

Feature description

I've now implemented LoRA and embedding training support in OneTrainer (for now only on a separate branch https://github.com/Nerogar/OneTrainer/tree/stable_cascade) . But to actually use them, support in the inference tools is needed. I propose the following format:

LoRA:

Each unet key has a prefix lora_prior_unet_, followed by the base model key in diffusers format, then lora_down.weight, lora_up.weight and alpha Each text encoder key has a prefix lora_prior_te_, followed by the base model key in diffusers format, then lora_down.weight, lora_up.weight and alpha

For the unet, I have only included lora weights for the attention blocks. But the naming scheme would be the same for other blocks.

Embedding:

The file has a single key: clip_g. This is the same format as SDXL embeddings, just without the clip_l key.

Example files

I have attached two example files. The example LoRA is for the 1B variant of stage C. Both are untrained, they are just examples to show the file format. examples.zip

For reference, I have opened the same issue for ComfyUI https://github.com/comfyanonymous/ComfyUI/issues/2831

Version Platform Description

No response

Nerogar avatar Feb 18 '24 20:02 Nerogar

thanks for the heads-up, definitely worth adding. cc @AI-Casanova

vladmandic avatar Feb 18 '24 22:02 vladmandic

@Nerogar The standardized key names are much appreciated, as are the untrained samples.

@vladmandic I will have to familiarize myself with your implementation of Stable Cascade, and then we can discuss ways and means.

AI-Casanova avatar Feb 19 '24 00:02 AI-Casanova

@Nerogar The standardized key names are much appreciated, as are the untrained samples.

@vladmandic I will have to familiarize myself with your implementation of Stable Cascade, and then we can discuss ways and means.

rights now its experimental at best and uses diffusers side branch, best to wait few days until diffusers work stabilizes. few days are not going to make big difference.

vladmandic avatar Feb 19 '24 01:02 vladmandic

I've updated the example files to reflect the new format. unet attention keys are not saved in diffusers format anymore.

Nerogar avatar Feb 20 '24 20:02 Nerogar

Sorry for all this back and forth, but the comfy dev found another issue with my lora keys. I updated the example file again. The only thing that changes is the key name for the out projection of unet attention blocks

Nerogar avatar Feb 23 '24 19:02 Nerogar

No worries. And since you've cross-posted the issue, don't need to update here for each item.

vladmandic avatar Feb 23 '24 19:02 vladmandic

Has there been any progress on SC LoRA support, or is it not in scope?

tscott65 avatar Jun 18 '24 10:06 tscott65

sc lora support via peft methods is added for a while now. there is no current plans to add it via native methods.

vladmandic avatar Oct 30 '24 14:10 vladmandic