-
Couldn't load subscription status.
- Fork 6.5k
[Flux Redux] add prompt & multiple image input #10056
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
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
# Conflicts: # src/diffusers/pipelines/flux/pipeline_flux_prior_redux.py
|
let us know when it is ready for a review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well, thanks! 🤗
Code
import torch
from diffusers import FluxPriorReduxPipeline, FluxPipeline
from diffusers.utils import load_image
device = "cuda"
dtype = torch.bfloat16
repo_redux = "black-forest-labs/FLUX.1-Redux-dev"
repo_base = "black-forest-labs/FLUX.1-dev"
pipe_prior_redux = FluxPriorReduxPipeline.from_pretrained(
repo_redux, torch_dtype=dtype
).to(device)
pipe = FluxPipeline.from_pretrained(
repo_base, text_encoder=None, text_encoder_2=None, torch_dtype=torch.bfloat16
).to(device)
image = load_image(
"https://www.arthistoryproject.com/site/assets/files/19982/frida-kahlo-self-portrait-with-thorn-necklace-and-hummingbird-1940-trivium-art-history.jpg"
)
image2 = load_image(
"https://upload.wikimedia.org/wikipedia/commons/thumb/6/6a/Mona_Lisa.jpg/1354px-Mona_Lisa.jpg"
)
pipe_prior_output = pipe_prior_redux(
[image, image2],
prompt=["self portrait by frida khalo", "mona lisa"],
prompt_embeds_scale=[0.9, 0.75],
pooled_prompt_embeds_scale=[0.6, 1.25],
)
images = pipe(
guidance_scale=2.5,
height=1024,
width=1024,
num_inference_steps=50,
max_sequence_length=512,
generator=torch.Generator("cpu").manual_seed(0),
**pipe_prior_output,
).images[0]
images.save("flux-redux.png")There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! this is really cool - would love to have it on doc somewhere too
| prompt_2=None, | ||
| prompt_embeds=None, | ||
| pooled_prompt_embeds=None, | ||
| prompt=prompt, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's throw out a warning here:
if prompt inputs is passed but do not have text_encoder/tokenizer, in this case the text inputs will be ignored
it is a bit of different from our regular pipelines, normally, if you pass a prompt and do not have a text_encoder, you will get an error says like from encode_prompt; here we will just use zero prompt embeds instead, so let's be make an explicit warning about that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, added one now
| numpy array and pytorch tensor, the expected value range is between `[0, 1]` If it's a tensor or a list | ||
| or tensors, the expected shape should be `(B, C, H, W)` or `(C, H, W)`. If it is a numpy array or a | ||
| list of arrays, the expected shape should be `(B, H, W, C)` or `(H, W, C)` | ||
| prompt (`str` or `List[str]`, *optional*): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make it clear that it is an experimental feature, and if you pass prompt, you will need to load text_encoders explicitly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
THIS NEEDS TO BE IN THE DOCS. @stevhliu any ideas about the location? |
|
Super cool! 🤩 We can add it to the "Specific Pipeline Examples" section and then build out the Flux doc there as discussed here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! I think we can add doc in a separate PR
but need make style
|
@yiyixuxu I'm not sure what's the issue, when I run make fixup it doesnt make any changes / flag any issues 🤔 |
|
@linoytsaban It's the doc-builder check, try |
|
thanks @hlky! |
|
@linoytsaban let's add some docs (#10056 (comment)) and communicate? |
|
效果不太好,并没有达到官方示例的效果 |
|
@Thekey756 do you have an example comparison to the original? |
|
@Thekey756 I think to achieve the original effect you're referring to we need to also take in consideration - #10025 |
* add multiple prompts to flux redux --------- Co-authored-by: hlky <[email protected]>
Can you give an example for your Fast FLUX.1 Redux in the space of huggingface? Thanks! And what is the masking scale? |
|
how should I set prompt_embeds_scale, pooled_prompt_embeds_scale, and guidance_scale in general? @linoytsaban |





Add the following to the flux redux prior pipeline:
inference example:
