-
Notifications
You must be signed in to change notification settings - Fork 64
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
release 0.5.0 – comprehensive ModelConfig refactor to support compatible HuggingFace dev/schnell models #103
base: main
Are you sure you want to change the base?
Conversation
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.
Feels pretty good to me, I will make sure my image gen local tests pass.
Users who asked for #102 please help test!
@@ -254,7 +254,7 @@ Or, with the correct python environment active, create and run a separate script | |||
from mflux import Flux1, Config | |||
|
|||
# Load the model | |||
flux = Flux1.from_alias( |
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.
I leave from_alias
usable so there's no breakage, it's in the test cases
DEFAULT_TRAIN_STEPS = 1000 | ||
|
||
class ModelConfig(Enum): | ||
FLUX1_DEV = ("black-forest-labs/FLUX.1-dev", "dev", 1000, 512) | ||
FLUX1_SCHNELL = ("black-forest-labs/FLUX.1-schnell", "schnell", 1000, 256) | ||
KNOWN_SEQUENCE_LENGTH_BY_BASE_MODEL = {"dev": 512, "schnell": 256} |
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.
defining the magic numbers
if self.model_name.startswith("black-forest-labs/FLUX.1-"): | ||
return self.model_name[len("black-forest-labs/FLUX.1-") :].lower() |
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.
other values to come with #101 will be canny-dev
, depth-dev
and redux-dev
- the intention is to have the aliases support first party BFL models according to their naming convention
src/mflux/config/model_config.py
Outdated
FLUX1_DEV = DefaultModelConfigs["dev"] | ||
FLUX1_SCHNELL = DefaultModelConfigs["schnell"] |
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.
backward compatibility is maintained in the test suite
model_name="black-forest-labs/FLUX.1-schnell", | ||
num_train_steps=DEFAULT_TRAIN_STEPS, | ||
max_sequence_length=KNOWN_SEQUENCE_LENGTH_BY_BASE_MODEL["schnell"], | ||
supports_guidance=False, |
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.
but shuttle-3-diffusion claims to support guidance even though it's based on schnell: https://huggingface.co/shuttleai/shuttle-3-diffusion
Shuttle 3 Diffusion uses Flux.1 Schnell as its base.
and their docs allow guidance
…arg names and type hints
@anthonywu Hi, sorry for my delayed response! I've been busy with the final things for the Dreambooth training feature so I have not had the time to look at you PR yet but will do that first thing when I have a PR up for that. Your results here look really good with the different models and nice that you could achieve this with a relatively small code change! Dreabooth is pretty near completion and will be a big update (~2000 added lines now when I checked, but mostly new files in a speparate package, so hopefully not that many conflicts) . There are still more things I would like to improve, but I think it is good enough for a v1 release of this kind of feature. I was thinking of including that in the 0.5 release as well, but let's discuss that once I have a PR up for that feature, hopefully in a few days :) |
@filipstrand Feel free to merge when you're satisfied with this PR and make edits as needed. I am traveling in the weeks ahead and have limited ability to make significant edits. |
Alright, sounds good! |
change
--base-model
arg when neededgoals
demo: shuttle-3
https://huggingface.co/shuttleai/shuttle-3-diffusion
now, running as schnell, actually looks... better??
performance
demo: Freepik
https://huggingface.co/Freepik/flux.1-lite-8B-alpha
mflux-generate --base-model dev --steps 22 --model Freepik/flux.1-lite-8B-alpha --prompt "A cat holding a sign that says hello world"