TencentARC/flux-mini

Model

109

stars

29

commits

2

repos using this model

4

linked in READMEs

Nov 29, 2024

updated

text-to-image

README

🔥 Flux-Mini

A 3.2B MMDiT distilled from Flux-dev for efficient text-to-image generation

Static Badge Static Badge Static Badge

Teaser image

Nowadays, text-to-image (T2I) models are growing stronger but larger, which limits their pratical applicability, especially on consumer-level devices. To bridge this gap, we distilled the 12B Flux-dev model into a 3.2B Flux-mini model, and trying to preserve its strong image generation capabilities. Specifically, we prune the original Flux-dev by reducing its depth from 19 + 38 (number of double blocks and single blocks) to 5 + 10. The pruned model is further tuned with denosing and feature alignment objectives on a curated image-text dataset.

🔥🔥 Nonetheless, with limited computing and data resources, the capability of our Flux-mini is still limited in certain domains. To facilitate the development of flux-based models, we open-sourced the codes to distill Flux in this folder. We appeal people interested in this project to collaborate together to build a more applicable and powerful text-to-image model!

⏰ Timeline

[2024.11.26] We are delighted to release the first version of Flux-Mini!

⚡️ Efficiency Comparison

We compared our Flux-Mini with Flux-Dev on a single H20 GPU with BF16 precision, with batch-size=1, deepspeed stage=2, gradient_checkpoint=True. For inference, we adopt num_steps=50. The costs of T5, CLIP and VAE are included. OOM means out-of-memory.

ResolutionTraining StrategyModelTraining Speed (s/img)Training Memory (GB)Inference Speed (s/img)Inference Memory (GB)
512LoRA(r=16)Flux-dev1.1035.9111.1135.11
512LoRA(r=16)Flux-Mini0.3319.063.0718.49
512Fully FinetuneFlux-devOOMOOM11.1135.11
512Fully FinetuneFlux-Mini0.5783.73.0718.49
1024LoRA(r=16)Flux-dev2.9338.0338.2642.24
1024LoRA(r=16)Flux-Mini1.0522.2110.3125.61
1024Fully FinetuneFlux-devOOMOOM38.2642.24
1024Fully FinetuneFlux-Mini1.3083.7110.3125.61

⛅ Limitations

Compared with advanced text-to-image models, our model was trained with limited computing resources and synthetic data with mediocre quality. Thus, the generation capability of our model is still limited in certain categories.

The current model is ok with generating common images such as human/animal faces, landscapes, fantasy and abstract scenes.
Unfortunately, it is still incompetent in many scenarios. Including but not limited to:

  • Fine-grained details, such as human and animal structures
  • Typography
  • Perspective and Geometric Structure
  • Dynamics and Motion
  • Commonsense knowledge, e.g., brand logo
  • Physical Plausibility
  • Cultural Diversity

Since our model is trained with prompts in JourneyDB, we encourage users to apply our model with similar prompt formats (compositions of nouns and adjectives) to achieve the best quality. For example: "profile of sad Socrates, full body, high detail, dramatic scene, Epic dynamic action, wide angle, cinematic, hyper-realistic, concept art, warm muted tones as painted by Bernie Wrightson, Frank Frazetta."

We welcome everyone in the community of collaborate and PR for this model.

💻 Flux-NPU

The widespread development of NPUs has provided extra device options for model training and inference. To facilitate the usage of flux, We provide a codebase that could run the training and inference code of FLUX on NPUs.

Please find out more details in this folder.

⚡️ Efficiency Comparison on NPU.

We compared our Flux-Mini with Flux-Dev on a single Ascend 910B NPU with BF16 precision, with batch-size=1, deepspeed stage=2, gradient_checkpoint=True. For inference, we adopt num_steps=50. The costs of T5, CLIP and VAE are included. OOM means out-of-memory.

ResolutionTraining StrategyModelTraining Speed (s/img)Training Memory (GB)Inference Speed (s/img)Inference Memory (GB)
512LoRA(r=16)Flux-dev1.0738.4511.0058.62
512LoRA(r=16)Flux-Mini0.3720.643.2619.48
512Fully FinetuneFlux-devOOMOOM11.0058.62
512Fully FinetuneFlux-MiniOOMOOM3.2619.48
1024LoRA(r=16)Flux-dev3.0144.69OOMOOM
1024LoRA(r=16)Flux-Mini1.0625.8410.6027.76
1024Fully FinetuneFlux-devOOMOOMOOMOOM
1024Fully FinetuneFlux-MiniOOMOOM10.6027.76

🐾 Disclaimer

Users are granted the freedom to create images using our model and tools, but they are expected to comply with local laws and utilize it responsibly. The developers do not assume any responsibility for potential misuse by users.

👍 Acknowledgements

We thank the authors of the following repos for their excellent contribution!

🔎 License

Our Flux-mini model weights follows the liscence of Flux-Dev non-commercial License.

The other codes follow the Apache-2.0 License.

Contributors

daoyuan98

28 commits

ZyZcuhk

1 commits

TencentARC/flux-mini

Model

109

stars

29

commits

2

repos using this model

4

linked in READMEs

Nov 29, 2024

updated

text-to-image

README

🔥 Flux-Mini

A 3.2B MMDiT distilled from Flux-dev for efficient text-to-image generation

Static Badge Static Badge Static Badge

Teaser image

Nowadays, text-to-image (T2I) models are growing stronger but larger, which limits their pratical applicability, especially on consumer-level devices. To bridge this gap, we distilled the 12B Flux-dev model into a 3.2B Flux-mini model, and trying to preserve its strong image generation capabilities. Specifically, we prune the original Flux-dev by reducing its depth from 19 + 38 (number of double blocks and single blocks) to 5 + 10. The pruned model is further tuned with denosing and feature alignment objectives on a curated image-text dataset.

🔥🔥 Nonetheless, with limited computing and data resources, the capability of our Flux-mini is still limited in certain domains. To facilitate the development of flux-based models, we open-sourced the codes to distill Flux in this folder. We appeal people interested in this project to collaborate together to build a more applicable and powerful text-to-image model!

⏰ Timeline

[2024.11.26] We are delighted to release the first version of Flux-Mini!

⚡️ Efficiency Comparison

We compared our Flux-Mini with Flux-Dev on a single H20 GPU with BF16 precision, with batch-size=1, deepspeed stage=2, gradient_checkpoint=True. For inference, we adopt num_steps=50. The costs of T5, CLIP and VAE are included. OOM means out-of-memory.

ResolutionTraining StrategyModelTraining Speed (s/img)Training Memory (GB)Inference Speed (s/img)Inference Memory (GB)
512LoRA(r=16)Flux-dev1.1035.9111.1135.11
512LoRA(r=16)Flux-Mini0.3319.063.0718.49
512Fully FinetuneFlux-devOOMOOM11.1135.11
512Fully FinetuneFlux-Mini0.5783.73.0718.49
1024LoRA(r=16)Flux-dev2.9338.0338.2642.24
1024LoRA(r=16)Flux-Mini1.0522.2110.3125.61
1024Fully FinetuneFlux-devOOMOOM38.2642.24
1024Fully FinetuneFlux-Mini1.3083.7110.3125.61

⛅ Limitations

Compared with advanced text-to-image models, our model was trained with limited computing resources and synthetic data with mediocre quality. Thus, the generation capability of our model is still limited in certain categories.

The current model is ok with generating common images such as human/animal faces, landscapes, fantasy and abstract scenes.
Unfortunately, it is still incompetent in many scenarios. Including but not limited to:

  • Fine-grained details, such as human and animal structures
  • Typography
  • Perspective and Geometric Structure
  • Dynamics and Motion
  • Commonsense knowledge, e.g., brand logo
  • Physical Plausibility
  • Cultural Diversity

Since our model is trained with prompts in JourneyDB, we encourage users to apply our model with similar prompt formats (compositions of nouns and adjectives) to achieve the best quality. For example: "profile of sad Socrates, full body, high detail, dramatic scene, Epic dynamic action, wide angle, cinematic, hyper-realistic, concept art, warm muted tones as painted by Bernie Wrightson, Frank Frazetta."

We welcome everyone in the community of collaborate and PR for this model.

💻 Flux-NPU

The widespread development of NPUs has provided extra device options for model training and inference. To facilitate the usage of flux, We provide a codebase that could run the training and inference code of FLUX on NPUs.

Please find out more details in this folder.

⚡️ Efficiency Comparison on NPU.

We compared our Flux-Mini with Flux-Dev on a single Ascend 910B NPU with BF16 precision, with batch-size=1, deepspeed stage=2, gradient_checkpoint=True. For inference, we adopt num_steps=50. The costs of T5, CLIP and VAE are included. OOM means out-of-memory.

ResolutionTraining StrategyModelTraining Speed (s/img)Training Memory (GB)Inference Speed (s/img)Inference Memory (GB)
512LoRA(r=16)Flux-dev1.0738.4511.0058.62
512LoRA(r=16)Flux-Mini0.3720.643.2619.48
512Fully FinetuneFlux-devOOMOOM11.0058.62
512Fully FinetuneFlux-MiniOOMOOM3.2619.48
1024LoRA(r=16)Flux-dev3.0144.69OOMOOM
1024LoRA(r=16)Flux-Mini1.0625.8410.6027.76
1024Fully FinetuneFlux-devOOMOOMOOMOOM
1024Fully FinetuneFlux-MiniOOMOOM10.6027.76

🐾 Disclaimer

Users are granted the freedom to create images using our model and tools, but they are expected to comply with local laws and utilize it responsibly. The developers do not assume any responsibility for potential misuse by users.

👍 Acknowledgements

We thank the authors of the following repos for their excellent contribution!

🔎 License

Our Flux-mini model weights follows the liscence of Flux-Dev non-commercial License.

The other codes follow the Apache-2.0 License.

Contributors

daoyuan98

28 commits

ZyZcuhk

1 commits