Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support FLUX LoRA models in kohya format with lora_te1 layers (i.e. CLIP LoRA layers) #6967

Merged
merged 7 commits into from
Sep 30, 2024

Conversation

RyanJDick
Copy link
Collaborator

@RyanJDick RyanJDick commented Sep 27, 2024

Summary

This PR add support for FLUX LoRA models in kohya format with lora_te1 layers (i.e. CLIP LoRA layers). Previously, only transformer LoRA layers were supported.

Example LoRA model in this format: https://huggingface.co/cocktailpeanut/optimus

Example

Prompt: optimus is playing tennis in a tennis court
Seed: 0

Without LoRA:
image

With LoRA:
image

QA Instructions

I tested the following:

  • The optimus LoRA (with CLIP layers) can be applied.
  • FLUX LoRAs without CLIP layers still work
  • Loading the optimus LoRA, but applying it to the transformer only produces a different result. I.e. verified that patching the CLIP layers is doing something. Ironically, the results seem better without applying the CLIP layers. The CLIP layers seem to pull in more background concepts. Regardless, it works.
  • The optimus LoRA can be applied via the Linear UI, and the output matches results from manually constructing the workflow graph.
  • FLUX LoRAs without CLIP layers still work via the Linear UI.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)

@github-actions github-actions bot added python PRs that change python files invocations PRs that change invocations backend PRs that change backend files frontend PRs that change frontend files python-tests PRs that change python tests labels Sep 27, 2024
@RyanJDick RyanJDick marked this pull request as ready for review September 27, 2024 15:10
@RyanJDick RyanJDick merged commit ea0dc09 into main Sep 30, 2024
14 checks passed
@RyanJDick RyanJDick deleted the ryan/flux-lora-kohya-te branch September 30, 2024 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend PRs that change backend files frontend PRs that change frontend files invocations PRs that change invocations python PRs that change python files python-tests PRs that change python tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants