candle_transformers/models/flux/
mod.rs

1//! Flux  Model
2//!
3//! Flux is a 12B rectified flow transformer capable of generating images from text descriptions.
4//!
5//! - 🤗 [Hugging Face Model](https://huggingface.co/black-forest-labs/FLUX.1-schnell)
6//! - 💻 [GitHub Repository](https://github.com/black-forest-labs/flux)
7//! - 📝 [Blog Post](https://blackforestlabs.ai/announcing-black-forest-labs/)
8//!
9//! # Usage
10//!
11//! ```bash
12//! cargo run --features cuda \
13//!     --example flux -r -- \
14//!     --height 1024 --width 1024 \
15//!     --prompt "a rusty robot walking on a beach holding a small torch, \
16//!               the robot has the word \"rust\" written on it, high quality, 4k"
17//! ```
18//!
19//! <div align=center>
20//!   <img src="https://github.com/huggingface/candle/raw/main/candle-examples/examples/flux/assets/flux-robot.jpg" alt="" width=320>
21//! </div>
22//!
23
24use candle::{Result, Tensor};
25
26pub trait WithForward {
27    #[allow(clippy::too_many_arguments)]
28    fn forward(
29        &self,
30        img: &Tensor,
31        img_ids: &Tensor,
32        txt: &Tensor,
33        txt_ids: &Tensor,
34        timesteps: &Tensor,
35        y: &Tensor,
36        guidance: Option<&Tensor>,
37    ) -> Result<Tensor>;
38}
39
40pub mod autoencoder;
41pub mod model;
42pub mod quantized_model;
43pub mod sampling;