-
Notifications
You must be signed in to change notification settings - Fork 734
[Flux] Refactor flux config: Add FluxTokenizerContainer, remove Validation class #2533
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,35 +8,19 @@ | |
|
|
||
|
|
||
| @dataclass(kw_only=True, slots=True) | ||
| class Encoder: | ||
| class FluxEncoderConfig: | ||
| """Configuration for Flux encoders (T5 text encoder, CLIP text encoder, and autoencoder).""" | ||
|
|
||
| t5_encoder: str = "google/t5-v1_1-small" | ||
| """T5 encoder to use, HuggingFace model name. This field could be either a local folder path, | ||
| or a Huggingface repo name.""" | ||
| """HuggingFace model name or local path for the T5 text encoder.""" | ||
| clip_encoder: str = "openai/clip-vit-large-patch14" | ||
| """Clip encoder to use, HuggingFace model name. This field could be either a local folder path, | ||
| or a Huggingface repo name.""" | ||
| """HuggingFace model name or local path for the CLIP text encoder.""" | ||
| autoencoder_path: str = ( | ||
| "torchtitan/experiments/flux/assets/autoencoder/ae.safetensors" | ||
| ) | ||
| """Autoencoder checkpoint path to load. This should be a local path referring to a safetensors file.""" | ||
| max_t5_encoding_len: int = 256 | ||
| """Maximum length of the T5 encoding.""" | ||
|
|
||
| test_mode: bool = False | ||
| """Whether to use integration test mode, which will randomly initialize the encoder and use a dummy tokenizer""" | ||
|
|
||
|
|
||
| # TODO: maybe consolidate with FluxValidator.Config | ||
| @dataclass(kw_only=True, slots=True) | ||
| class Validation: | ||
| enable_classifier_free_guidance: bool = False | ||
| """Whether to use classifier-free guidance during sampling""" | ||
| classifier_free_guidance_scale: float = 5.0 | ||
| """Classifier-free guidance scale when sampling""" | ||
| denoising_steps: int = 50 | ||
| """How many denoising steps to sample when generating an image""" | ||
| eval_freq: int = 100 | ||
| """Frequency of evaluation/sampling during training""" | ||
| random_init: bool = False | ||
| """If True, initialize encoders with random weights instead of loading pretrained weights (for testing only).""" | ||
|
|
||
|
|
||
| @dataclass(kw_only=True, slots=True) | ||
|
|
@@ -51,3 +35,9 @@ class Inference: | |
| """Batch size for inference""" | ||
| img_size: int = 256 | ||
| """Image size for inference""" | ||
| enable_classifier_free_guidance: bool = False | ||
|
||
| """Whether to use classifier-free guidance during sampling""" | ||
| classifier_free_guidance_scale: float = 5.0 | ||
| """Classifier-free guidance scale when sampling""" | ||
| denoising_steps: int = 50 | ||
| """How many denoising steps to sample when generating an image""" | ||
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.
since it's for test only