Views
No views yet
Lumina-Next-T2I model uses Next-DiT with a 2B parameters model as well as using Gemma-2B as a text encoder. Compared with Lumina-T2I, it has faster inference speed, richer generation style, and more multilingual support, etc.Next-DiT as the backbone, the text encoder is the Gemma 2B model, and the VAE uses a version of sdxl fine-tuned by stabilityai.Lumina-Next-T2I model to support 2K Resolution image generation..pth weights to .safetensors weights. Please pull the latest code to use demo.py for inference.Lumina-T2I, called Lumina-Next-T2I for faster and lower memory usage image generation model.| Resolution | Next-DiT Parameter | Text Encoder | Prediction | Download URL |
|---|---|---|---|---|
| 1024 | 2B | Gemma-2B | Rectified Flow | hugging face |
nvcc1# The command should work and show the same version number as in our case. (12.1 in our case).
2nvcc --versiongcc is available1# The command should work and show a version of at least 6.0.
2# If not, consult distro-specific tutorials to obtain a newer version or build manually.
3gcc --versiongit clone https://github.com/Alpha-VLLM/Lumina-T2X1conda create -n Lumina_T2X -y
2conda activate Lumina_T2X
3conda install python=3.11 pytorch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 pytorch-cuda=12.1 -c pytorch -c nvidia -ypip install diffusers fairscale accelerate tensorboard transformers gradio torchdiffeq click1cd lumina_next_t2i
2pip install -r requirements.txtflash-attnpip install flash-attn --no-build-isolation[!Warning] While Apex can improve efficiency, it is not a must to make Lumina-T2X work.Note that Lumina-T2X works smoothly with either:
- Apex not installed at all; OR
- Apex successfully installed with CUDA and C++ extensions.
However, it will fail when:
- A Python-only build of Apex is installed.
If the errorNo module named 'fused_layer_norm_cuda'appears, it typically means you are using a Python-only build of Apex. To resolve this, please runpip uninstall apex, and Lumina-T2X should then function correctly.
1pip install ninja
2git clone https://github.com/NVIDIA/apex
3cd apex
4# if pip >= 23.1 (ref: https://pip.pypa.io/en/stable/news/#v23-1) which supports multiple `--config-settings` with the same key...
5pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" ./
6# otherwise
7pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --global-option="--cpp_ext" --global-option="--cuda_ext" ./pip install -e .huggingface-cli download --resume-download Alpha-VLLM/Lumina-Next-T2I --local-dir /path/to/ckptgit clone https://huggingface.co/Alpha-VLLM/Lumina-Next-T2Iconfig/infer/config.yaml for detailed settings. Detailed config structure:/path/to/ckptshould be a directory containingconsolidated*.pthandmodel_args.pth
1- settings:
2
3 model:
4 ckpt: "/path/to/ckpt" # if ckpt is "", you should use `--ckpt` for passing model path when using `lumina` cli.
5 ckpt_lm: "" # if ckpt is "", you should use `--ckpt_lm` for passing model path when using `lumina` cli.
6 token: "" # if LLM is a huggingface gated repo, you should input your access token from huggingface and when token is "", you should `--token` for accessing the model.
7
8 transport:
9 path_type: "Linear" # option: ["Linear", "GVP", "VP"]
10 prediction: "velocity" # option: ["velocity", "score", "noise"]
11 loss_weight: "velocity" # option: [None, "velocity", "likelihood"]
12 sample_eps: 0.1
13 train_eps: 0.2
14
15 ode:
16 atol: 1e-6 # Absolute tolerance
17 rtol: 1e-3 # Relative tolerance
18 reverse: false # option: true or false
19 likelihood: false # option: true or false
20
21 infer:
22 resolution: "1024x1024" # option: ["1024x1024", "512x2048", "2048x512", "(Extrapolation) 1664x1664", "(Extrapolation) 1024x2048", "(Extrapolation) 2048x1024"]
23 num_sampling_steps: 60 # range: 1-1000
24 cfg_scale: 4. # range: 1-20
25 solver: "euler" # option: ["euler", "dopri5", "dopri8"]
26 t_shift: 4 # range: 1-20 (int only)
27 ntk_scaling: true # option: true or false
28 proportional_attn: true # option: true or false
29 seed: 0 # rnage: any numberckpt: lumina-next-t2i checkpoint path from huggingface repo containing consolidated*.pth and model_args.pth.ckpt_lm: LLM checkpoint.token: huggingface access token for accessing gated repo.path_type: the type of path for transport: 'Linear', 'GVP' (Geodesic Vector Pursuit), or 'VP' (Vector Pursuit).prediction: the prediction model for the transport dynamics.loss_weight: the weighting of different components in the loss function, can be 'velocity' for dynamic modeling, 'likelihood' for statistical consistency, or None for no weightingsample_eps: sampling in the transport model.train_eps: training to stabilize the learning process.atol: Absolute tolerance for the ODE solver. (options: ["Linear", "GVP", "VP"])rtol: Relative tolerance for the ODE solver. (option: ["velocity", "score", "noise"])reverse: run the ODE solver in reverse. (option: [None, "velocity", "likelihood"])likelihood: Enable calculation of likelihood during the ODE solving process.resolution: generated image resolution.num_sampling_steps: sampling step for generating image.cfg_scale: classifier-free guide scaling factorsolver: solver for image generation.t_shift: time shift factor.ntk_scaling: ntk rope scaling factor.proportional_attn: Whether to use proportional attention.seed: random initialization seeds.lumina_next infer -c <config_path> <caption_here> <output_dir>1cd lumina_next_t2i
2lumina_next infer -c "config/infer/settings.yaml" "a snowman of ..." "./outputs"1# `/path/to/ckpt` should be a directory containing `consolidated*.pth` and `model_args.pth`
2
3# default
4python -u demo.py --ckpt "/path/to/ckpt"
5
6# the demo by default uses bf16 precision. to switch to fp32:
7python -u demo.py --ckpt "/path/to/ckpt" --precision fp32
8
9# use ema model
10python -u demo.py --ckpt "/path/to/ckpt" --ema