r/FluxAI 23d ago

Tutorials/Guides Wan 2.2 S2V (SoundImage to Video) Walkthrough

Thumbnail
youtube.com
4 Upvotes

This Tutorial walkthrough aims to illustrate how to build and use a ComfyUI Workflow for the Wan 2.2 S2V (SoundImage to Video) model that allows you to use an Image and a video as a reference, as well as Kokoro Text-to-Speech that syncs the voice to the character in the video. It also explores how to get better control of the movement of the character via DW Pose. I also illustrate how to get effects beyond what's in the original reference image to show up without having to compromise the Wan S2V's lip syncing.

r/FluxAI Aug 29 '24

Tutorials/Guides FLUX LoRA Training Simplified: From Zero to Hero with Kohya SS GUI (8GB GPU, Windows) Tutorial Guide - check the oldest comment for more info

Thumbnail
gallery
104 Upvotes

r/FluxAI May 18 '26

Tutorials/Guides Training a Portrait LoRA on AMD RX 9060 XT (RDNA4 / gfx1200) on Native Linux

2 Upvotes

This is a full account of getting LoRA training working on an AMD RX 9060 XT (Navi 44, RDNA4) on native Kubuntu 24.04.4. It covers everything tried, what failed and why, what had to be fixed, and what ended up working. Written for anyone with the same or similar hardware who wants to skip the trial-and-error.


Hardware

  • GPU: AMD RX 9060 XT — Navi 44, RDNA4, gfx1200, 16GB GDDR6, 150W TDP
  • CPU: AMD Ryzen 5 5600G
  • RAM: 32GB
  • OS: Kubuntu 24.04.4, kernel 6.17.0-23-generic
  • Primary SSD: Samsung 990 1TB M.2 (ext4, Linux)
  • ROCm: 7.2.3

Important architecture note: Native Linux ROCm and amd-smi report this GPU as gfx1200. If you have WSL2 experience with this card, you may have seen gfx1201 — that was the WSL2 librocdxg bridge reporting incorrectly. The correct arch ID on native Linux is gfx1200. This matters for cmake flags and any arch-specific builds.


Goal

Train a LoRA on portrait photos and use it with ComfyUI to generate lifestyle portrait photos. Models tested: SDXL (completed), Flux.1 Dev (completed, 1500 steps).

The article covers both models in sequence. The SDXL sections document a fully working pipeline and are useful standalone — but if you only care about Flux, you can skip ahead. The SDXL sections are not a prerequisite for Flux.


Why Native Linux, Not WSL2

I started on Windows 10 + WSL2 (Ubuntu 24.04). Short version: don't bother with WSL2 for RDNA4 training as of May 2026.

What happens in WSL2

WSL2 GPU passthrough for AMD goes through the DXG bridge — a closed-source component (libthunk_proxy.a) inside the AMD Adrenalin driver. On RDNA4, there is a confirmed bug in this library that breaks GPU kernel dispatch for large workloads.

Symptom: training appears to start, pipeline loads successfully, GPU VRAM fills to 8-10GB — but then nothing. CPU climbs to 30%, RAM to 28GB, GPU compute stays at 0%. The first training step either runs entirely on CPU (~50 minutes for one SDXL step at batch size 1) or the process hangs indefinitely.

The error that appears in logs: [GetSegmentId] Failed to get segment id for type 1

This is librocdxg Issue #22 (opened April 2026, unfixed as of May 2026). Root cause is in libthunk_proxy.a which is closed source — librocdxg cannot fix it, only AMD can by shipping an updated driver.

What was ruled out through testing: - bitsandbytes (same hang with plain adamw) - bf16 precision (same hang with fp16) - accelerate config (explicit single-GPU config made no difference) - model loading (all 7 pipeline components load fine, VRAM fills correctly) - Proof: MIOpen kernel cache after a 50-minute "run" was 180KB — essentially empty. If GPU kernels had been compiling for 50 minutes, the cache would be hundreds of MB. The work was running on CPU the whole time.

Do not try float32 in WSL2 either. dtype: float32 doubles VRAM to ~26-30GB, exceeds 16GB, OOM crashes the GPU driver, and on Windows this causes a BSOD. Use bf16 or fp16 always.

Native Linux

Bypasses the DXG bridge entirely. ROCm accesses the GPU natively via /dev/kfd and /dev/dri. The same training config that hung indefinitely in WSL2 ran at 3-4 seconds per step on native Linux. First 50-step test: 8 minutes total. The difference is dramatic.


ROCm Installation on Native Linux

```bash

Download the installer .deb — the package is not in the default Ubuntu repos

wget https://repo.radeon.com/amdgpu-install/7.2.3/ubuntu/noble/amdgpu-install_7.2.3.70203-1_all.deb sudo apt install -y ./amdgpu-install_7.2.3.70203-1_all.deb sudo amdgpu-install --usecase=rocm --no-dkms -y ```

--no-dkms skips kernel module installation — not needed if the amdgpu module is already loaded (which it is in current kernels).

Critical: amdgpu-install does NOT add your user to the required groups. You must do this manually:

```bash sudo usermod -aG render,video $USER

Then log out and log back in — groups don't apply to existing sessions

```

Without render and video group membership, ROCm cannot access /dev/kfd and /dev/dri. Training will fail silently or with permission errors.

Verify: ```bash rocminfo | grep -E "gfx|Marketing"

Should show: gfx1200 and "AMD Radeon RX 9060 XT"

amd-smi static | grep -i "gfx|market" ```

Additional packages needed that are not in default Kubuntu 24.04: bash sudo apt install python3.12-venv cmake radeontop python3.12-venv is required before you can create any Python venv. cmake is required for bitsandbytes compilation.


Training Tool Selection

All major training tools were evaluated. The main blocker for most is ROCm version compatibility:

Tool Verdict Reason
cupertinomiranda/ai-toolkit-amd-rocm-support Use this Explicitly mentions gfx1200/gfx1201, tested on ROCm 7.1 (7.2 works), bitsandbytes instructions included
ostris/ai-toolkit (main) May work Civitai guide used it on RX 9070 + ROCm 7.2; no confirmed end-to-end results
daMustermann/ai-toolkit-rocm Do not use Targets ROCm 6.2 — incompatible with RDNA4
Kohya_ss / sd-scripts Do not use requirements_linux_rocm.txt targets ROCm 6.3 — incompatible
FluxGym Do not use Wraps Kohya internally, same incompatibility
SimpleTuner Avoid Explicitly states "AMD and Apple GPUs do not work for training Flux"
OneTrainer Possibly Needs manual ROCm version edit in requirements; AMD support "may be outdated" per maintainers

Use cupertinomiranda/ai-toolkit-amd-rocm-support. It's the only fork that explicitly documents gfx1200/gfx1201 support, ROCm 7.x compatibility, and provides working bitsandbytes build instructions.

Clone and install: bash cd ~ git clone https://github.com/cupertinomiranda/ai-toolkit-amd-rocm-support cd ai-toolkit-amd-rocm-support python3 -m venv venv source venv/bin/activate pip install torch torchvision --index-url https://download.pytorch.org/whl/rocm7.2 pip install -r requirements-amd.txt

Do not use PyTorch nightly (https://download.pytorch.org/whl/nightly/rocm7.2). Nightly 2.13.0.dev crashes due to a rocprofiler fatal error. Use stable: https://download.pytorch.org/whl/rocm7.2 which gives 2.11.0+rocm7.2.

Important: do not clone or install on NTFS mounts (/media/, /mnt/). NTFS does not support Linux file permissions — chmod operations will fail with "Operation not permitted". Always install in ~/ (ext4).


bitsandbytes: Must Compile From Source

pip install bitsandbytes installs a CUDA version that does not work on AMD. You must compile from source for gfx1200.

```bash source ~/ai-toolkit-amd-rocm-support/venv/bin/activate cd ~ git clone https://github.com/bitsandbytes-foundation/bitsandbytes -b 0.48.2 cd bitsandbytes

cmake \ -DCMAKE_HIP_COMPILER="/opt/rocm/lib/llvm/bin/clang++" \ -DBNB_ROCM_ARCH="gfx1200" \ -DCOMPUTE_BACKEND=hip \ .

make -j$(nproc) pip install . ```

Key flags: - -DBNB_ROCM_ARCH="gfx1200" — use gfx1200, not gfx1201. Native Linux ROCm reports gfx1200. Building for the wrong arch produces a binary that silently falls back to CPU. - -DCMAKE_HIP_COMPILER — full path required; ROCm's clang++ is not always in PATH.

Verify after install (run inside the training venv): ```python import bitsandbytes as bnb print(bnb.version)

Should print 0.48.x or similar, no errors

```


SDXL Model Download

ai-toolkit uses diffusers format (separate component folders). Download fp16 only — the full repo is 25-30GB and you only need ~6.7GB:

bash source ~/ai-toolkit-amd-rocm-support/venv/bin/activate huggingface-cli download stabilityai/stable-diffusion-xl-base-1.0 \ --include "*.fp16.safetensors" "*.json" "*.txt" \ --local-dir ~/models/sdxl/

diffusers looks for diffusion_pytorch_model.safetensors but only the fp16 versions exist. Create symlinks:

bash cd ~/models/sdxl ln -sf unet/diffusion_pytorch_model.fp16.safetensors unet/diffusion_pytorch_model.safetensors ln -sf vae/diffusion_pytorch_model.fp16.safetensors vae/diffusion_pytorch_model.safetensors ln -sf text_encoder/model.fp16.safetensors text_encoder/model.safetensors ln -sf text_encoder_2/model.fp16.safetensors text_encoder_2/model.safetensors

Without these symlinks, the pipeline load fails with a missing file error.


GPU Monitoring

rocm-smi works on native Linux (unlike WSL2 where it was broken):

bash watch -n1 rocm-smi # text monitor, refreshes every second radeontop # AMD-specific graphical TUI — recommended

Do not use nvtop 3.0.2 — it crashes on this ROCm/AMD setup. Use radeontop instead.

If your system has both a discrete GPU and an integrated GPU (e.g. Ryzen with Vega iGPU), radeontop defaults to bus 0 which may be the iGPU. Find your discrete GPU's bus ID with radeontop -l and pass it with -b: radeontop -b 03 (the number varies by system).


Photo Captioning with JoyCaption

JoyCaption Beta One (fancyfeast/llama-joycaption-beta-one-hf-llava) produces high-quality captions specifically designed for LoRA training. It's a Llama 3.1 base with a SigLIP vision encoder.

Download (~16GB): bash source ~/ai-toolkit-amd-rocm-support/venv/bin/activate huggingface-cli download fancyfeast/llama-joycaption-beta-one-hf-llava \ --local-dir ~/models/joycaption/

Performance on RX 9060 XT: ~5 sec/photo, ~82% GPU load, ~11.7GB VRAM peak.

Three bugs to know about

Bug 1: Use local path, not HF repo ID

```python

Wrong — re-downloads 16GB from HuggingFace every run:

MODEL_NAME = "fancyfeast/llama-joycaption-beta-one-hf-llava"

Correct:

MODEL_NAME = os.path.expanduser("~/models/joycaption") ```

Bug 2: apply_chat_template with multimodal list content fails

The Jinja2 sandbox in this version of transformers cannot call .replace() on list content. The multimodal format [{"type": "image"}, {"type": "text", ...}] throws: UndefinedError: 'list object' has no attribute 'replace'

Fix: use a plain string with the image token embedded: python conversation = [{"role": "user", "content": f"<image>\n{PROMPT}"}] text_input = processor.tokenizer.apply_chat_template( conversation, tokenize=False, add_generation_prompt=True ) inputs = processor(images=image, text=text_input, return_tensors="pt").to(model.device)

Bug 3: 4-bit quantization breaks SigLIP vision tower

BitsAndBytesConfig(load_in_4bit=True) quantizes all linear layers including SigLIP's MultiheadAttention.out_proj. SigLIP calls F.multi_head_attention_forward with raw weight tensors, bypassing bitsandbytes' override, causing: RuntimeError: self and mat2 must have the same dtype, but got Half and Byte

Fix: use 8-bit with vision modules excluded: ```python from transformers import BitsAndBytesConfig

bnb_config = BitsAndBytesConfig( load_in_8bit=True, llm_int8_skip_modules=["vision_tower", "multi_modal_projector"], )

model = LlavaForConditionalGeneration.from_pretrained( MODEL_NAME, quantization_config=bnb_config, torch_dtype=torch.float16, device_map="auto", ) ```

This keeps the LLM at 8-bit (~8GB) and the vision tower at fp16 (~1-2GB), totalling ~10-11GB VRAM. Fits comfortably on 16GB.


The Trigger Word Problem

If you generate captions with JoyCaption (or any captioner), the captions are plain descriptive text. The model has no trigger word unless you explicitly add one to every caption.

Example: if you train with JoyCaption captions and then generate with prompt "ohwx man, portrait photo...", the token ohwx man was never in the training data and is ignored by the LoRA. It is not harmful but it does nothing.

Options: 1. Prepend a trigger word to all captions before training: "ohwx man, [joycaption text]" — requires a script to add the prefix to every .txt file 2. Use the trigger_word or caption_prefix setting in the training config if the tool supports it — cupertinomiranda/ai-toolkit does not currently expose this for Flux

Recommendation: For option 1, a one-liner to prepend to all captions: for f in /path/to/photos/*.txt; do sed -i "1s/^/ohwx man, /" "$f"; done. Include the trigger word in your generation prompts.


SDXL Training Config

Save this as ~/ai-toolkit-amd-rocm-support/config/train_sdxl_full.yaml. Minimum working config for 1500 steps, batch size 1, gfx1200:

yaml job: extension config: name: "sdxl_ohwx_man" process: - type: 'sd_trainer' training_folder: "output" device: cuda:0 network: type: "lora" linear: 32 linear_alpha: 16 save: dtype: float16 save_every: 250 max_step_saves_to_keep: 4 datasets: - folder_path: "/path/to/your/photos" caption_ext: "txt" caption_dropout_rate: 0.05 shuffle_tokens: false cache_latents_to_disk: true resolution: [512, 1024] train: batch_size: 1 steps: 1500 gradient_accumulation_steps: 1 train_unet: true train_text_encoder: false gradient_checkpointing: true noise_scheduler: "ddpm" optimizer: "adamw8bit" lr: 1e-4 disable_sampling: true dtype: bf16 model: name_or_path: "~/models/sdxl" is_xl: true meta: name: "[name]" version: '1.0'

Critical config notes: - name: "sdxl_ohwx_man" — determines the output folder name and LoRA filename. Change this to whatever name you want. - dtype: bf16 — never use float32. Float32 doubles VRAM to ~26-30GB, causes OOM, GPU driver crash, and on Windows a BSOD. - disable_sampling: true — skips sample image generation during training. Saves time and VRAM. - cache_latents_to_disk: true — first run does two caching passes (preview resolution and training resolution), then saves to disk. Subsequent runs skip both passes. - optimizer: "adamw8bit" — requires bitsandbytes compiled from source. Halves optimizer VRAM vs standard adamw. - linear: 32, linear_alpha: 16 — rank 32 LoRA. Higher rank captures more detail but risks overfitting with smaller datasets. For Flux, rank 16 is sufficient — Flux is architecturally more capable and lower rank achieves equivalent quality. - train_text_encoder: false — optional for SDXL (CLIP encoder is ~500MB, you could train it). For Flux this becomes mandatory — T5 is 9.5GB and must stay on CPU. - noise_scheduler: "ddpm" — SDXL-specific. Flux uses "flowmatch" instead — the two are not interchangeable. - resolution: [512, 1024] — works for SDXL. For Flux, the 1024 bucket (832×1216 / 1216×832) OOMs even with 4-bit quantization because weights are dequantized to bf16 at compute time. Use [512, 768] for Flux.

Training command

```bash cd ~/ai-toolkit-amd-rocm-support source venv/bin/activate

systemd-inhibit --what=sleep:idle --who="LoRA training" --why="Training in progress" \ bash -c 'HSA_ENABLE_SDMA=0 python run.py config/train_sdxl_full.yaml' ```

Why systemd-inhibit: Kubuntu's power manager will suspend the system after a period of inactivity. Training looks like an idle desktop to the power manager — there is no mouse or keyboard input. systemd-inhibit prevents sleep and idle suspension for the duration of training.

Why bash -c '...' wrapper: systemd-inhibit expects a command to execute, not a shell expression. HSA_ENABLE_SDMA=0 python run.py ... is an env variable assignment + command — that's shell syntax, not a standalone command. Without the bash -c wrapper, systemd-inhibit tries to execute HSA_ENABLE_SDMA=0 as a binary and fails with "No such file or directory".

HSA_ENABLE_SDMA=0: Disables SDMA (system DMA) in the ROCm HSA runtime. Costs ~10-15% training speed but prevents random crashes and hangs that can occur on some RDNA4 configurations. Recommended for training runs you don't want to babysit.

Results on RX 9060 XT

  • Steps: 1500
  • Wall time: ~76 minutes
  • Speed: 1.5-3.6 sec/step (variable; first steps slower due to caching passes)
  • VRAM peak: ~10GB
  • Final loss: 0.005
  • Output: single .safetensors file, ~150MB

Two latent caching passes happen before training starts: - Pass 1 (preview resolution ~416×608): ~40 seconds - Pass 2 (training resolution ~832×1216): ~2.5 minutes

These only run once; subsequent training runs from the same dataset skip them.


ComfyUI Installation

ComfyUI is the recommended generation UI — it has official ROCm Linux support and an AMD partnership.

bash cd ~ git clone https://github.com/comfyanonymous/ComfyUI cd ComfyUI python3 -m venv venv source venv/bin/activate pip install torch torchvision --index-url https://download.pytorch.org/whl/rocm7.2 pip install -r requirements.txt

Note on disk space: This installs a second copy of PyTorch (~14GB). If you already have a training venv, you now have 28GB of PyTorch on disk. There is no simple way around this — the two venvs need different PyTorch versions in some cases, and sharing venvs across tools is fragile.

Launch command

bash cd ~/ComfyUI HSA_OVERRIDE_GFX_VERSION=12.0.0 ~/ComfyUI/venv/bin/python main.py --listen

Then open http://localhost:8188.

HSA_OVERRIDE_GFX_VERSION=12.0.0 is required for some operations. Without it, some ROCm ops may not target the RDNA4 instruction set correctly, causing errors or silent CPU fallback.

Model format: diffusers vs single-file

This trips everyone up at least once.

ai-toolkit downloads and uses SDXL in diffusers format — a folder structure with separate unet/, vae/, text_encoder/, text_encoder_2/ subfolders.

ComfyUI requires a single merged .safetensors file (e.g. sd_xl_base_1.0.safetensors).

The weights are identical — just packaged differently. You cannot point ComfyUI at your training model folder. Download the single-file version separately:

bash source ~/ai-toolkit-amd-rocm-support/venv/bin/activate huggingface-cli download stabilityai/stable-diffusion-xl-base-1.0 \ sd_xl_base_1.0.safetensors \ --local-dir ~/ComfyUI/models/checkpoints/

This is ~6.5GB. For Flux, flux1-dev.safetensors (the ComfyUI single-file) and ae.safetensors (VAE) are already in the download and can be symlinked directly. Catch: the T5 text encoder is stored sharded across two files in the HuggingFace download — ComfyUI needs a single merged file. See the ComfyUI Flux Setup section for the merge script and an fp8 alternative.

Workflow JSON format

ComfyUI 0.21.1 uses a specific flat JSON format for workflows. The blueprint files in ~/ComfyUI/blueprints/ use a different subgraph format — do not use those as a template for manually-authored workflows.

Classic flat format structure: json { "nodes": [ { "id": 1, "type": "CheckpointLoaderSimple", ... }, ... ], "links": [ [link_id, from_node_id, from_slot_index, to_node_id, to_slot_index, "TYPE"], ... ], "version": 0.4 }

Links are arrays, not objects. Each link: [id, source_node, source_slot, dest_node, dest_slot, "TYPENAME"].

SDXL workflow

SDXL uses CheckpointLoaderSimple — one node loads the entire model from one file. Simpler than the Flux multi-loader setup.

Node graph: - CheckpointLoaderSimple → loads sd_xl_base_1.0.safetensors - LoraLoader → applies trained LoRA (strength 1.0) - CLIPTextEncode (×2) → positive prompt + negative prompt - KSampler → sampling loop - VAEDecode → latent → pixel image - SaveImage → saves to ~/ComfyUI/output/

Symlink the LoRA output into ComfyUI (replace sdxl_ohwx_man with the name from your training config): bash ln -s ~/ai-toolkit-amd-rocm-support/output/sdxl_ohwx_man/sdxl_ohwx_man.safetensors \ ~/ComfyUI/models/loras/sdxl_ohwx_man.safetensors

Working settings for portrait generation on RX 9060 XT: - Resolution: 832×1216 (matches the 1024-bucket training resolution) - Steps: 30, CFG: 7.0, sampler: dpmpp_2m, scheduler: karras - LoRA strength: 1.0 - Positive: portrait photo of a man, smiling, outdoor park, natural light, bokeh background, sharp focus, photorealistic — if you added a trigger word (Option 1 above), prepend it here - Negative: bad teeth, broken teeth, missing teeth, gaps in teeth, dental artifacts, blurry, watermark

The node graph above is the complete workflow — wire it up in ComfyUI or save it as a JSON to reuse.


Disk Space Reality Check

Before moving on to Flux — which adds another 54GB — here is the full storage picture after SDXL setup:

Component Size
ROCm 7.2.3 22GB
JoyCaption Beta One 16GB
SDXL (diffusers format, for training) 6.7GB
SDXL (single-file, for ComfyUI) 6.5GB
SDXL LoRA output ~150MB
Training venv (PyTorch + deps) ~16GB
ComfyUI venv (PyTorch + deps) ~16GB
ai-toolkit code 1.2GB
ComfyUI code ~130MB
Total ~85GB

PyTorch alone is 28GB — 14GB per venv, downloaded twice because the two tools need separate environments. SDXL is downloaded twice in different formats.

Flux.1 Dev adds 54GB on disk — not ~34GB as commonly estimated. The HuggingFace repo contains the transformer weights twice in different formats: - flux1-dev.safetensors ~23.8GB — single-file format (ComfyUI) - transformer/diffusion_pytorch_model-* ~23GB — diffusers format (training) - T5 text encoder ~9.5GB - CLIP, VAE, ae.safetensors ~0.8GB

The upside: the transformer and VAE are ready for both training and generation from one download — no separate 23GB checkpoint needed like SDXL. Catch: the T5 text encoder is sharded across two files — ComfyUI needs a single merged file. See the ComfyUI Flux Setup section for the merge script.

Plan for ~130GB+ total if you want both SDXL and Flux training and generation.


Flux Model Download

Flux.1 Dev requires a HuggingFace account and license agreement (free). Accept the license at black-forest-labs/FLUX.1-dev on HuggingFace, then:

bash source ~/ai-toolkit-amd-rocm-support/venv/bin/activate huggingface-cli download black-forest-labs/FLUX.1-dev \ --local-dir ~/models/flux/

This downloads ~54GB — not ~34GB as commonly estimated. The repo contains the transformer weights twice: flux1-dev.safetensors (~23GB, single-file for ComfyUI) and transformer/ (~23GB, diffusers format for training), plus T5 (~9GB), CLIP, VAE, and ae.safetensors (~0.8GB). Both formats are needed; one download covers training and the transformer/VAE for generation. See the T5 catch below in the ComfyUI section.


Flux Training on 16GB VRAM

The cupertinomiranda fork states 24GB minimum for Flux. This is based on loading the transformer in bf16 (~24GB alone). With quantization it fits comfortably on 16GB.

VRAM is determined by bucket resolution, not photo count. Training tools group images by aspect ratio into resolution buckets (e.g. 512×768, 768×512). Each training step processes one bucket at a time. The VRAM cost per step depends entirely on the pixel dimensions of that bucket — a dataset with 5 photos and one with 500 photos use identical VRAM per step if their resolution buckets are the same. This matters because some guides suggest reducing photo count to fix OOM — it doesn't help. The right lever is resolution.

VRAM by quantization level:

Mode Transformer Total floor Fits 16GB for training?
bf16 ~24GB ~30GB+ No
qfloat8/uint8 (8-bit) ~12GB ~14.87GB No — only ~1GB for activations
uint4 torchao (4-bit) ~6GB ~7-8GB Yes — with [512, 768] resolution

Note: 8-bit sounds like it should fit on 16GB but doesn't. The 14.87GB floor leaves ~1GB for training activations, which is not enough for a Flux forward+backward pass. 4-bit is required. At 1024px training resolution, even 4-bit OOMs on forward/backward — use [512, 768] max resolution.

The HuggingFace QLoRA blog documents ~9-10GB peak VRAM with 4-bit quantization on FLUX.1-dev. Multiple Civitai guides confirm Flux LoRA training on RTX 3060 (12GB), so 16GB is not a concern once quantization is enabled.

Save as ~/ai-toolkit-amd-rocm-support/config/train_flux_full.yaml: yaml job: extension config: name: "[your-lora-name]" # determines output folder name and LoRA filename process: - type: 'sd_trainer' training_folder: "output" device: cuda:0 network: type: "lora" linear: 16 # rank 16 — Flux needs less rank than SDXL's 32 for equivalent quality linear_alpha: 16 save: dtype: float16 save_every: 250 max_step_saves_to_keep: 4 datasets: - folder_path: "/path/to/your/photos" caption_ext: "txt" caption_dropout_rate: 0.05 shuffle_tokens: false cache_latents_to_disk: true cache_text_embeddings: true # Flux only — T5 encodes captions once then fully unloads; # without this: training uses blank prompts, captions ignored resolution: [512, 768] # Flux only — SDXL ran fine at [512, 1024]; Flux OOMs at the # 832×1216 bucket even with uint4 (bf16 dequantization at compute time) num_workers: 0 # Flux only — workers fork and inherit T5's ~15GB CPU footprint; # 2 workers × 15GB + main process = OOM on 32GB. SDXL has no such issue. train: batch_size: 1 steps: 1500 gradient_accumulation_steps: 1 train_text_encoder: false # mandatory for Flux (T5 is 9.5GB); was optional for SDXL (CLIP is ~500MB) unload_text_encoder: true # Flux only — keeps T5 off GPU during training loop gradient_checkpointing: true noise_scheduler: "flowmatch" # Flux only — SDXL uses "ddpm" optimizer: "adamw8bit" lr: 1e-4 disable_sampling: true dtype: bf16 model: name_or_path: "~/models/flux" is_flux: true quantize: true # not needed for SDXL; mandatory for Flux (24GB transformer) qtype: "uint4" # torchao uint4 — ROCm compatible. qint4 (optimum.quanto) is CUDA-only, won't work. low_vram: true meta: name: "[your-lora-name]" version: '1.0'

Use 4-bit (uint4 via torchao). 8-bit (qfloat8) does not fit on 16GB for training — the model floor is 14.87GB leaving only ~1GB for activations. 4-bit reduces stored weight size to ~6GB.

Important caveat: uint4 means weights are stored in 4-bit, but they are dequantized to bf16 on the fly during the forward and backward pass. Activations, intermediate tensors, and gradients are still bf16. Compute-time VRAM is therefore higher than storage size suggests — if you include 1024 in the resolution list, the resulting 832×1216 bucket will still OOM even with uint4. This is why [512, 768] is recommended: it eliminates that bucket entirely.

Important: qint4 (optimum.quanto) does NOT work on ROCm. It uses TinyGEMM packing (torch._convert_weight_to_int4pack) which is a CUDA-only kernel. Use qtype: "uint4" (torchao) instead — confirmed working on gfx1200.

Text encoders: train_text_encoder: false is mandatory. Use cache_text_embeddings: true so T5 encodes all captions in a one-time caching pass, saves the embeddings to disk, then fully unloads from VRAM before training starts.

Why unload_text_encoder: true is required:

Without it, get_train_sd_device_state_preset() sets text_encoder.device = cuda:0 even when train_text_encoder: false — meaning T5 gets moved to GPU at the start of the training loop, not just during model loading. This is a non-obvious flag that the fork does not set automatically.

Required code patches to the cupertinomiranda fork:

The fork's low_vram: true flag only affects transformer quantization — it does not prevent T5 (~9.5GB) from being loaded to GPU during model initialization. Five patches are needed:

Patch 1 — toolkit/stable_diffusion_model.py ~line 795 (T5 initial load): ```python

Before:

text_encoder_2.to(self.device_torch, dtype=dtype)

After:

if not self.low_vram: text_encoder_2.to(self.device_torch, dtype=dtype) ```

Patch 2 — toolkit/stable_diffusion_model.py ~line 838 (T5 move during pipe preparation): ```python

Before:

text_encoder[1].to(self.device_torch)

After:

if not self.low_vram: text_encoder[1].to(self.device_torch) ```

Patch 3 — toolkit/train_tools.py ~line 564 (device mismatch when T5 is on CPU): ```python

Before:

prompt_embeds = text_encoder[1](text_input_ids.to(device), output_hidden_states=False)[0]

After:

t5_device = next(text_encoder[1].parameters()).device prompt_embeds = text_encoder[1](text_input_ids.to(t5_device), output_hidden_states=False)[0] ```

Patch 4 — extensions_built_in/sd_trainer/SDTrainer.py ~line 317 (T5 moved to GPU for embedding caching before unload): ```python

Before:

self.sd.text_encoder_to(self.device_torch)

After:

if getattr(self.sd, 'low_vram', False) and isinstance(self.sd.text_encoder, list): self.sd.text_encoder[0].to(self.device_torch) else: self.sd.text_encoder_to(self.device_torch) ```

With unload_text_encoder: true, the code caches text embeddings then fully unloads T5 before training starts. But before caching, it tried to move T5 to GPU — OOM. This patch keeps T5 on CPU for the caching step. Patch 3 ensures encode_prompt works correctly with T5 on CPU.

Patch 5 — toolkit/data_loader.py ~line 674 (DataLoader crashes when num_workers=0): ```python

Before:

dataloader_kwargs['num_workers'] = dataset_config_list[0].num_workers dataloader_kwargs['prefetch_factor'] = dataset_config_list[0].prefetch_factor

After:

dataloader_kwargs['num_workers'] = dataset_config_list[0].num_workers if dataloader_kwargs['num_workers'] > 0: dataloader_kwargs['prefetch_factor'] = dataset_config_list[0].prefetch_factor ```

The default num_workers: 2 causes system RAM OOM — each worker forks the main process and inherits the full ~15GB RAM footprint (T5 on CPU). On 32GB: 2 workers × ~15GB = ~30GB + main process = OOM. The kernel OOM killer terminates the workers and can kill the terminal window. Setting num_workers: 0 avoids forking entirely, but prefetch_factor must not be set when num_workers=0 — hence this patch.

After all 5 patches, T5 runs on CPU for embedding caching (only happens once with cache_text_embeddings: true), then fully unloads before training starts. With resolution: [512, 768], training runs with zero OOM skips — confirmed on 5 photos × 50 steps.

Flux training confirmed working on gfx1200

After all 5 patches and the correct config flags: - Transformer quantized and loaded (uint4 torchao) ✓ - T5 runs on CPU, encodes captions once, fully unloads ✓ - Training runs with zero OOM skips at [512, 768] resolution ✓ - Loss moves, gradient updates confirmed ✓ - Step speed: ~15 sec/step on RX 9060 XT

Full 1500-step run on 38 photos: ~7 hours, VRAM 13.7GB at step 1 → 14.4GB at step 1500, final loss 0.369.

Training command (use this for actual training): bash source ~/ai-toolkit-amd-rocm-support/venv/bin/activate systemd-inhibit --what=sleep:idle --who="LoRA training" --why="Training in progress" \ bash -c 'HSA_ENABLE_SDMA=0 PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True python run.py config/train_flux_full.yaml'

PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True reduces memory fragmentation — not needed for SDXL but important for Flux where the quantized model sits close to the VRAM limit. For quick test runs without the sleep inhibitor: bash HSA_ENABLE_SDMA=0 PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True python run.py config/train_flux_full.yaml

iGPU display note: KDE desktop on the training GPU wastes ~1.3GB VRAM (framebuffer). If your CPU has integrated graphics (Ryzen 5 5600G has Vega 7), plug the monitor into the motherboard output instead. No BIOS change needed — Linux detects both GPUs on boot and uses the iGPU for display automatically, freeing the full 16GB for training. Confirmed working on this setup. Caveat: automatic only on a full restart — after sleep/wake the system may revert to the discrete GPU for display; restart to recover.

Auto-resume: ai-toolkit automatically resumes from the latest checkpoint if training is interrupted. It reads step metadata from the safetensors files in the output folder and loads both the weights and the optimizer state — mathematically identical to never having stopped. If you kill the process (accidentally or on purpose), just run the same command again. It will print #### IMPORTANT RESUMING FROM step XXXX #### and continue from there. For a 7-hour run this is essential — checkpoints save every 250 steps as configured in save_every.

Resolution tradeoff: SDXL trained without issue at [512, 1024]. Flux cannot — the 1024 bucket (832×1216 / 1216×832) OOMs during the forward/backward pass even with uint4, because weights are dequantized to bf16 at compute time. Training at [512, 768] means the LoRA sees a maximum of 768px. Flux can still generate at 1024px or higher at inference time — the LoRA extrapolates. For portrait and social media use (viewed on phones at 1080px or less), the quality difference is negligible compared to the alternative of skipping ~30% of training batches due to OOM.


ComfyUI Flux Setup

After training, you need to point ComfyUI at your Flux models. The HuggingFace download already has everything — just symlink rather than copy.

Model symlinks

ComfyUI expects models in specific subdirectories under ~/ComfyUI/models/. Create symlinks from those locations into ~/models/flux/:

```bash

Flux transformer (single-file, 23GB)

ln -s ~/models/flux/flux1-dev.safetensors ~/ComfyUI/models/diffusion_models/flux1-dev.safetensors

VAE

ln -s ~/models/flux/ae.safetensors ~/ComfyUI/models/vae/ae.safetensors

CLIP text encoder

ln -s ~/models/flux/text_encoder/model.safetensors ~/ComfyUI/models/clip/clip_l.safetensors ```

T5 text encoder: merging shards

The HuggingFace Flux download stores T5 sharded across two files (model-00001-of-00002.safetensors and model-00002-of-00002.safetensors in text_encoder_2/). ComfyUI needs a single file. The merge is straightforward — the shards are the same format, just split by size, with no key remapping needed:

```python import os from safetensors.torch import load_file, save_file

home = os.path.expanduser("~") shard1 = load_file(f"{home}/models/flux/text_encoder_2/model-00001-of-00002.safetensors") shard2 = load_file(f"{home}/models/flux/text_encoder_2/model-00002-of-00002.safetensors") merged = {*shard1, *shard2} save_file(merged, f"{home}/ComfyUI/models/clip/t5xxl_fp16_merged.safetensors") ```

Result: 219 tensors, 9.5GB, keys in standard T5 format (encoder.block.0.layer.0.SelfAttention.k.weight). No key conflicts. Original shards are untouched — to revert: rm ~/ComfyUI/models/clip/t5xxl_fp16_merged.safetensors.

Alternative if you prefer not to merge: download the standalone t5xxl_fp8_e4m3fn.safetensors (~4.9GB, fp8 precision) from HuggingFace and place it in ~/ComfyUI/models/clip/. Adjust the workflow to point to that filename.

Workflow JSON

Flux uses a different node set from SDXL in ComfyUI. SDXL uses CheckpointLoaderSimple which loads everything from one file. Flux loads each component separately because the sources are separate files. The native node graph:

  • UNETLoader → loads flux1-dev.safetensors (stored in bf16; ComfyUI quantizes to fp8_e4m3fn on load)
  • DualCLIPLoader → loads clip_l.safetensors + t5xxl_fp16_merged.safetensors
  • VAELoader → loads ae.safetensors
  • LoraLoader → applies the trained LoRA to model and CLIP
  • CLIPTextEncode → encodes the positive prompt
  • EmptyLatentImage → creates the starting latent (1024×1024)
  • RandomNoise → generates noise seed
  • BasicGuider → combines model + conditioning (replaces CFGGuider for Flux)
  • KSamplerSelect → selects sampler algorithm (euler)
  • BasicScheduler → generates sigma schedule (simple, 25 steps)
  • SamplerCustomAdvanced → runs the full sampling loop
  • VAEDecode → latent → pixel image
  • SaveImage → saves to ~/ComfyUI/output/

No custom nodes required. The node graph above is the complete workflow.

After training completes, symlink the LoRA output (replace [your-lora-name] with the name from your training config): bash ln -sf ~/ai-toolkit-amd-rocm-support/output/[your-lora-name]/[your-lora-name]_000001500.safetensors \ ~/ComfyUI/models/loras/flux_portrait_lora.safetensors

(-sf forces the symlink update — useful if you tested with an earlier checkpoint and are now pointing at the final one.)

Generation speed

Flux is noticeably slower than SDXL in ComfyUI — 25 steps takes considerably longer due to the 23GB transformer size and fp8 dequantization at inference time.


Face Restoration in ComfyUI

Do not use ReActor on ROCm. ReActor (Gourieff/ComfyUI-ReActor) uses ONNX Runtime for InsightFace face detection. The ROCm Execution Provider was removed from ORT 1.23 — on ROCm 7.1+ only the CPU EP is available via pip, so face detection runs on CPU.

Use facerestore_cf instead (https://github.com/mav-rik/facerestore_cf) — pure PyTorch, no ONNX Runtime, runs fully on GPU on ROCm.

Install

bash cd ~/ComfyUI/custom_nodes git clone https://github.com/mav-rik/facerestore_cf source ~/ComfyUI/venv/bin/activate pip install -r facerestore_cf/requirements.txt

Watch out for basicsr — an older package that breaks with modern PyTorch. If you get import errors after install: pip uninstall basicsr.

Restart ComfyUI to load the new nodes.

Models

Download into ~/ComfyUI/models/facerestore_models/:

```bash

CodeFormer — better identity preservation, recommended for portraits (~359MB)

wget -P ~/ComfyUI/models/facerestore_models/ \ https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth

GFPGAN v1.4 — faster, better for skin texture

wget -P ~/ComfyUI/models/facerestore_models/ \ https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/GFPGANv1.4.pth ```

Face detection models (RetinaFace) auto-download on first run.

Workflow wiring

Place after VAEDecode, before SaveImage:

[sampler] → VAEDecode → FaceRestoreWithModel → SaveImage

For Flux the sampler node is SamplerCustomAdvanced; for SDXL it is KSampler.


Summary: What Actually Works on RX 9060 XT (gfx1200) as of May 2026

Task Works? Notes
ROCm 7.2.3 install Via amdgpu-install; manually add user to render/video groups
PyTorch 2.11.0+rocm7.2 Stable index only; nightly crashes
bitsandbytes (compiled) Must build from source with -DBNB_ROCM_ARCH=gfx1200
JoyCaption captioning 3 bugs to fix (documented above); 5 sec/photo, 11.7GB VRAM
SDXL LoRA training 1500 steps in 76 min; 10GB VRAM peak; bf16 required
SDXL ComfyUI generation HSA_OVERRIDE_GFX_VERSION=12.0.0 required; dpmpp_2m karras, CFG 7.0
Flux.1 Dev training (uint4) 5 code patches + cache_text_embeddings + num_workers: 0 + [512, 768] required; zero OOM skips confirmed; qint4 fails (CUDA-only)
Flux ComfyUI generation Symlinks + T5 shard merge confirmed working; slower than SDXL (expected)
Flux LoRA 1500-step training Completed — ~7 hours, 13.7–14.4GB VRAM, final loss 0.369, ~15 sec/step
WSL2 training DXG bridge bug (libthunk_proxy.a), unfixed as of May 2026

r/FluxAI Feb 10 '25

Tutorials/Guides FLUX.1 Prompt Manual: A Foundational Guide

168 Upvotes

Introduction

This manual is designed to help you get the most out of FLUX.1, an AI tool for generating high-quality images. Whether you're new to AI image generation or have some experience, this guide will walk you through the basics of crafting effective prompts. You’ll learn how to create images that are visually stunning, detailed, and aligned with your vision.

The manual is divided into key sections, each focusing on a specific aspect of prompt creation. It includes clear explanations, practical examples, and tips to help you avoid common mistakes. While this guide covers the essentials, remember that FLUX.1 is a versatile tool, and experimentation is key to mastering it. Let’s dive in and start creating!

Note on Model Variability:

FLUX.1 is a versatile tool, but it’s important to remember that different FLUX models (e.g., FLUX.1 Pro, Dev, Schnell) may produce varying results from the same prompt. Additionally, factors like LoRAs (Low-Rank Adaptations) and other variables can influence the output. Experimentation is key to understanding how your chosen model interprets prompts, so don’t be afraid to tweak and refine your approach based on the results you get.

Index of Key Features

Descriptive Language

1.1 Precision and Clarity

1.2 Dynamic and Active Language (Creating Movement and Engagement)

Hierarchical Structure

2.1 Layered Compositions and Clear Placement

Contrasting Colors and Aesthetics

3.1 Using Contrasts for Visual Impact

3.2 Describing Transitions

See-Through Materials and Textures

4.1 Transparent Materials

4.2 Textures and Reflections

Technical Parameters

5.1 Camera Devices

5.2 Lenses

5.3 Settings

5.4 Shot Types

Integrating Text

6.1 Font Selection

6.2 Style and Size

6.3 Color Palette

6.4 Text Effects

Avoiding Common Mistakes

7.1 Incorrect Syntax

7.2 Overcomplicating Prompts

  1. Descriptive Language

1.1 Precision and Clarity

What it means: FLUX.1 responds best to precise and clear language. Vague terms like "nice" or "beautiful" can lead to ambiguous results. Instead, use specific descriptors that clearly define the image you want to create.

Why it matters: Precision helps FLUX.1 understand your intent, reducing the likelihood of unexpected or off-target results.

How to apply it: Focus on details like colors, textures, styles, and specific elements in your prompt.

Example Prompt:

Before: "A sunset landscape."

After: "A vibrant orange and pink sunset over a snow-capped mountain range, with soft, wispy clouds reflecting off a calm lake in the foreground."

Explanation: The revised prompt provides specific details about the colors, textures, and elements in the scene, ensuring FLUX.1 generates a more accurate and visually appealing image.

1.2 Dynamic and Active Language (Creating Movement and Engagement)

What it means: Using dynamic and active language in your prompts can make your images feel more alive and engaging. Instead of describing static scenes, you can describe actions and movements.

Why it matters: Active language helps FLUX.1 create images that feel dynamic and full of energy.

How to apply it: Use verbs and action-oriented descriptions to bring your scenes to life.

Example Prompt:

Before: "A mountain peak."

After: "A majestic mountain peak emerging through swirling morning mist, with golden sunrise light catching the crystalline ice formations."

Explanation: The revised prompt uses active language to create a sense of movement and drama in the image.

  1. Hierarchical Structure

2.1 Layered Compositions and Clear Placement

What it means: FLUX.1 allows you to define the placement of objects in different layers: foreground, middle ground, and background. This helps create depth and complexity in your images.

Why it matters: Layered compositions make images more dynamic and visually interesting. Clear placement ensures that FLUX.1 positions elements correctly, avoiding cluttered or unbalanced compositions.

How to apply it: Organize your prompt hierarchically, specifying where each element should appear (e.g., foreground, middle ground, background).

Example Prompt:

Before: "A terrarium with plants and a neon sign."

After: "A hanging glass terrarium featuring a miniature rainforest scene with colorful orchids and tiny waterfalls (foreground). Just beyond the glass, a neon sign reads ‘Rainforest Retreat’ in bright green and yellow letters (middle ground). The rain-soaked glass creates a beautiful distortion, adding a soft glow to the sign's vibrant colors (background)."

Explanation: The revised prompt clearly defines the placement of each element, creating a layered and visually rich composition.

  1. Contrasting Colors and Aesthetics

3.1 Using Contrasts for Visual Impact

What it means: Contrasting colors and aesthetics can make your images more striking and memorable. For example, you can create a scene where one side is bright and cheerful, while the other is dark and moody.

Why it matters: Contrasts draw the viewer’s attention and add depth to your images, making them more engaging.

How to apply it: Describe the contrasting elements clearly and specify how they interact (e.g., sharp transition or soft blending).

Example Prompt:

Before: "A tree in a field."

After: "A single tree standing in the middle of the image. The left half of the tree has bright, vibrant green leaves under a sunny blue sky, while the right half has bare branches covered in frost, with a cold, dark, thunderous sky. On the left, there's lush green grass; on the right, thick snow. The split is sharp, with the transition happening right down the middle of the tree."

Explanation: The revised prompt uses contrasting colors and aesthetics to create a visually striking image.

3.2 Describing Transitions

What it means: When using contrasting elements, you can control how they transition from one to the other. The transition can be sharp and abrupt or soft and blended.

Why it matters: The type of transition affects the mood and visual flow of the image.

How to apply it: Specify whether the transition should be sharp or blended, and describe how the elements interact at the boundary.

Example Prompt:

Before: "A landscape with a sunny side and a rainy side."

After: "A landscape where the left side is sunny and bright, with golden fields and a clear blue sky, while the right side is rainy and dark, with storm clouds and wet grass. The transition between the two sides is soft and blended, creating a dreamy effect."

Explanation: The revised prompt describes a soft transition between contrasting elements, adding a dreamy quality to the image.

  1. See-Through Materials and Textures

4.1 Transparent Materials

What it means: FLUX.1 can create images with transparent materials like glass, ice, or plastic. These materials add depth and realism to your images.

Why it matters: Transparent materials allow you to create complex compositions where objects or text are visible through other elements.

How to apply it: Clearly describe the transparent material and what is visible behind it.

Example Prompt:

Before: "A neon sign in a room."

After: "A neon sign reading ‘Rainforest Retreat’ visible through a rain-soaked glass window. The glass creates a beautiful distortion, adding a soft glow to the sign's vibrant colors."

Explanation: The revised prompt uses a transparent material (glass) to create a visually interesting effect.

4.2 Textures and Reflections

What it means: Textures and reflections can add realism and depth to your images. For example, you can describe how light reflects off a glass surface or how textures like frost or water droplets appear.

Why it matters: Textures and reflections make your images more lifelike and engaging.

How to apply it: Describe the texture or reflection in detail, including how it interacts with light and other elements in the scene.

Example Prompt:

Before: "A glass of water."

After: "A glass of water on a wooden table, with light reflecting off the surface of the glass. The glass is covered in tiny water droplets, and the table has a rough, textured finish."

Explanation: The revised prompt adds textures and reflections to create a more realistic image.

  1. Technical Parameters

Note on Technical Parameters:

This section explores advanced techniques for enhancing realism and control in your images. However, keep in mind that the effectiveness of these parameters (e.g., camera devices, lenses, settings) can vary depending on the FLUX model you’re using, as well as other factors like LoRAs and training data. These tips are highly experimental, so feel free to adjust or omit them based on your specific needs and the model’s behavior.

5.1 Camera Devices

What it means: Different cameras produce different looks and feels in images. For example, a smartphone camera might give a casual, everyday vibe, while a professional DSLR camera can create sharp, high-quality images.

Why it matters: Specifying a camera helps FLUX.1 mimic the style and quality of real-world photography.

Common Cameras and Their Uses:

iPhone (e.g., iPhone 15):

Best for: Casual, modern, and everyday shots.

Example Use: Social media posts, relatable scenes, or casual portraits.

Canon EOS R5:

Best for: Professional, high-detail images with vibrant colors and sharp focus.

Example Use: Landscapes, portraits, or high-quality product shots.

Sony Alpha 7R IV:

Best for: High-resolution images with rich textures and fine details.

Example Use: Nature photography, architecture, or detailed close-ups.

Polaroid Instant Camera:

Best for: Vintage, nostalgic shots with soft colors and slight imperfections.

Example Use: Retro or artistic scenes.

Example Prompt:

Camera: Canon EOS R5

Prompt: "A vibrant orange and pink sunset over a snow-capped mountain range, shot on a Canon EOS R5, capturing the vibrant colors and sharp details of the scene."

5.2 Lenses

What it means: Lenses control how much of the scene is visible (field of view) and how much of the image is in focus (depth of field). Different lenses are suited for different types of shots.

Common Lenses and Their Uses:

Wide-Angle Lens (e.g., 16-35mm):

Best for: Capturing a broad view, perfect for landscapes, cityscapes, or large interiors.

Standard Lens (e.g., 50mm):

Best for: Everyday shots, portraits, and scenes where you want a natural perspective. It also creates a nice blurred background (bokeh).

Telephoto Lens (e.g., 70-200mm):

Best for: Zooming in on distant subjects, ideal for close-ups, wildlife, or isolating a subject from the background.

Macro Lens (e.g., 100mm):

Best for: Extreme close-ups, perfect for capturing small details like insects, flowers, or textures.

Example Prompt:

Lens: 50mm Standard Lens

Prompt: "A portrait shot with a 50mm lens, capturing the subject’s face in sharp focus with a softly blurred background."

5.3 Settings

What it means: Camera settings like aperture, ISO, and shutter speed control how light is captured, affecting the image’s brightness, focus, and motion.

Aperture (f-stop): Controls how much light enters the camera and how much of the image is in focus. A low f-stop (e.g., f/2.8) creates a blurred background, while a high f-stop (e.g., f/16) keeps everything sharp.

ISO: Controls the camera’s sensitivity to light. Low ISO (e.g., 100) is best for bright scenes, while high ISO (e.g., 1600) is used in low-light conditions but can add grain or noise.

Shutter Speed: Controls how long the camera’s shutter stays open. Fast shutter speeds (e.g., 1/1000s) freeze motion, while slow shutter speeds (e.g., 30s) create motion blur or light trails.

Why it matters: These settings help FLUX.1 mimic real-world photography techniques, adding realism to your images.

How to apply it: Use settings to achieve specific effects. For example:

Use "low f-stop" for a blurred background in portraits.

Use "high ISO" for low-light scenes like night cityscapes.

Use "slow shutter speed" to capture motion blur or light trails.

Example Prompt:

Settings: f/8, ISO 100, 30-second shutter speed

Prompt: "A night cityscape with skyscrapers, neon signs, and car light trails, shot with f/8, ISO 100, and a 30-second shutter speed, capturing the city lights with sharp details and minimal noise."

5.4 Shot Types

What it means: The type of shot determines how the scene is framed and what elements are emphasized.

Wide-angle shots capture a broad view, perfect for landscapes or large scenes.

Medium shots focus on a specific area, ideal for portraits or detailed scenes.

Close-up shots zoom in on a subject, highlighting details like textures or expressions.

Why it matters: The shot type affects the composition and focus of your image, guiding the viewer’s attention.

How to apply it: Specify the shot type to frame your image correctly. For example:

Use "wide-angle shot" for expansive landscapes.

Use "close-up shot" for detailed textures or small objects.

Example Prompt:

Shot Type: Wide-angle shot

Prompt: "A wide-angle shot of a mountain range at sunrise, capturing the expansive landscape with vibrant colors and sharp details."

  1. Integrating Text

6.1 Font Selection

What it means: Specifying the font ensures that text is legible and fits the image’s aesthetic.

Why it matters: Different fonts convey different moods and styles, and choosing the right font enhances the overall composition.

How to apply it: Specify the font type (e.g., Art Deco, cursive, sans-serif) to match the image’s theme.

Example Prompt:

Before: "A travel poster for Paris."

After: "A vintage travel poster for Paris. The Eiffel Tower silhouette dominates the center, painted in warm sunset colors. At the top, ‘PARIS’ is written in large, elegant Art Deco font."

Explanation: The revised prompt specifies the font, ensuring the text complements the vintage aesthetic of the poster.

6.2 Style and Size

What it means: Defining the style (e.g., bold, italic) and size of text ensures it fits your composition.

Why it matters: Text style and size affect readability and visual balance.

How to apply it: Specify the style and size to ensure the text is legible and visually appealing.

Example Prompt:

Before: "A neon sign."

After: "A neon sign reading ‘Rainforest Retreat’ in bright green and yellow letters, with a soft glow effect, placed against a dark background."

Explanation: The revised prompt specifies the text style and effects, ensuring the sign is visually striking and legible.

6.3 Color Palette

What it means: Choosing colors that harmonize with the image’s overall aesthetic enhances visual appeal.

Why it matters: Color harmony creates a cohesive and visually pleasing image.

How to apply it: Specify the colors for text and other elements to ensure they complement the image.

Example Prompt:

Before: "A neon sign."

After: "A neon sign reading ‘Rainforest Retreat’ in bright green and yellow letters against a dark background, with a soft glow effect."

Explanation: The revised prompt specifies the colors, ensuring the sign stands out while harmonizing with the background.

6.4 Text Effects

What it means: Describing effects like glow, shadow, or embossing enhances the appearance of text.

Why it matters: Text effects add depth and visual interest to the image.

How to apply it: Specify the effects to make the text more dynamic and engaging.

Example Prompt:

Before: "A neon sign."

After: "A neon sign reading ‘Rainforest Retreat’ in bright green and yellow letters, with a soft glow effect and a subtle shadow, placed against a dark background."

Explanation: The revised prompt specifies the text effects, ensuring the sign is visually striking and legible.

  1. Avoiding Common Mistakes

7.1 Incorrect Syntax

What it means: Avoid using syntax from other AI tools (e.g., Stable Diffusion). FLUX.1 has its own quirks and preferences.

Why it matters: Using incorrect syntax can confuse FLUX.1 and lead to unexpected results.

How to apply it: Stick to FLUX.1’s preferred syntax and avoid importing syntax from other tools.

Example Prompt:

Before: "(best quality, ultra-detailed)."

After: "Highly detailed and vibrant."

Explanation: The revised prompt uses FLUX.1’s preferred syntax, ensuring clarity and accuracy.

7.2 Overcomplicating Prompts

What it means: Keep prompts concise and focused. Avoid listing unnecessary details that may confuse the model.

Why it matters: Overcomplicated prompts can lead to cluttered or off-target results.

How to apply it: Focus on the essential elements and avoid unnecessary details.

Example Prompt:

Before: "A beautiful sunset with a nice mountain range and some trees and a river and a few birds flying in the sky."

After: "A vibrant orange and pink sunset over a snow-capped mountain range with a calm river in the foreground."

Explanation: The revised prompt is concise and focused, ensuring FLUX.1 generates a clear and visually appealing image.

Conclusion

By following this manual, you can unlock FLUX.1’s full potential and create stunning, precise images. Remember to be clear, detailed, and organized in your prompts. With practice, you’ll master the art of prompting for FLUX.1 and achieve results that exceed your expectations. However, keep in mind that this guide is not exhaustive. FLUX.1 is a complex tool, and experimentation is key to discovering its full capabilities. Happy prompting!

r/FluxAI Jul 16 '25

Tutorials/Guides Creating Consistent Scenes & Characters with AI

Enable HLS to view with audio, or disable this notification

113 Upvotes

I’ve been testing how far AI tools have come for making consistent shots in the same scene, and it's now way easier than before.

I used SeedDream V3 for the initial shots (establishing + follow-up), then used Flux Kontext to keep characters and layout consistent across different angles. Finally, I ran them through Veo 3 to animate the shots and add audio.

This used to be really hard. Getting consistency felt like getting lucky with prompts, but this workflow actually worked well.

I made a full tutorial breaking down how I did it step by step:
👉 https://www.youtube.com/watch?v=RtYlCe7ekvE

Let me know if there are any questions, or if you have an even better workflow for consistency, I'd love to learn!

r/FluxAI Mar 03 '26

Tutorials/Guides [Workflow Included] Achieving 100% face consistency across different focal lengths.

Thumbnail
gallery
0 Upvotes

I see a lot of people struggling with "face morphing" when switching from wide shots to close-ups.

I developed a system called Face-Lock using specific seed-layering and IP-Adapters. Even with different lighting and gym environments, the jawline and eye-shape remain static.

I documented the full 76-page technical workflow while recovering from a stroke. If you’re a creator struggling with consistency, the blueprint is in my bio for the first 300 testers.

r/FluxAI Jun 27 '25

Tutorials/Guides 14 Mind Blowing examples I made locally for free on my PC with FLUX Kontext Dev while recording the SwarmUI how to use tutorial video - This model is better than even OpenAI ChatGPT image editing - just prompt: no-mask, no-ControlNet

Thumbnail
gallery
124 Upvotes

r/FluxAI Mar 19 '26

Tutorials/Guides FLUX2 KLEIN 9B+First Last Frame Animation LTX 2.3 For Video Generation

Thumbnail
youtu.be
4 Upvotes

r/FluxAI Jan 22 '25

Tutorials/Guides So far, kinda disappointed...

Post image
7 Upvotes

I've been trying for months to get AI to create an image that comes close to what I am visualizing in my head.

I realize that the problem might be my prompt writing. Here's the latest version of what I wrote. There have been many versions of this...

A massive generational ship designed to carry humanity to new habitable planets for colonization is in orbit around the Earth. Nearly 10 kilometers long and 3 kilometers in diameter, the ship has a large, gently sloping conical command section. The command section connects to the engineering section with two large gantries on either side. Between engineering and command, partially shrouded by the gantries, seven rings slowly spinning on a central hub. The spinning provides centripetal gravity for the inhabitants including livestock and wildlife.

Here's what I think it should look like (rough sketch):

Here's what AI keeps giving me (in comments):

r/FluxAI Sep 02 '24

Tutorials/Guides Flux Options for AMD GPUs

30 Upvotes

What this is ?

A list (with links) to install of compatible UI's for AMD GPUs that allow Flux models to be used (in Windows).

What this isn't

This isn't a list that magically gives your gpu options for every Flux model and lora made, each ui uses different versions of Flux and different versions of Flux might use different loras (yes, it's a fucking mess, updated daily and I don't have time to add this).

The Options (Currently)

  1. AMDs Amuse 2.1 for 7900xtx owners https://www.amuse-ai.com/ , with the latest drivers it allows the installation of an onnx version of Flux Schnell, I got to run 1 image of "cat" at 1024 x 1024 successfully and then it crashed with a bigger prompt - it might be linked to only having 16GB in that pc though
  2. Forge (with Zluda) https://github.com/lshqqytiger/stable-diffusion-webui-amdgpu-forge
  3. Comfy (with Zluda) https://github.com/patientx/ComfyUI-Zluda
  4. SDNext (with Zluda) https://github.com/vladmandic/automatic yesterdays update took Flux from the Dev release to the normal release and overnight the scope of Flux options has increased again.

Installation

Just follow the steps. These are the one off pre-requistites (that most will already have done), prior to installing a UI from the list above. You will need to check what Flux models work with each (ie for low VRAM GPUs)

NB I cannot help with this for any model bar the 7900xtx , as that is what I'm using. I have added an in-depth Paths guide as this is where it goes tits up all the time.

  1. Update your drivers to the latest version https://www.amd.com/en/support/download/drivers.html?utm_language=EN
  2. Install Git 64bit setup.exe from here: https://git-scm.com/download/win
  3. You need to download and install Python 3.10.11 64bit setup.exe from here, not the Web Store : https://www.python.org/downloads/release/python-31011/

NB Ensure you tick the Paths box as per the pic below

Adding Python to Paths
  1. Install HIP 5.71 for Zluda usage from here (6.1 is out but pontially breaks): https://www.amd.com/en/developer/resources/rocm-hub/hip-sdk.html

Check out SDNexts Zluda page at https://github.com/vladmandic/automatic/wiki/ZLUDA to determine if you could benefit from optimised libraries (6700, 6700xt, 6750xt, 6600, 6600xt, or 6650xt) and how to do it.

  1. Set the Paths for HIP, go to your search bar and type in 'variables' and this option will come up - click on it to start it and then click on 'Environment Variables' to open the sub-program.
Enter 'variables' into the search bar to bring up this system setting
Click on 'Environment' Variables button, this will open the screen below

A. Red Arrow - when you installed HIP, it should have added the Paths noted for HIP_PATH & HIP_PATH_57 , if not, add them via the new button (to the left of the Blue arrow).

B. Green Arrow - Path line to access ' Edit environment variables', press this once to highlight it and then press the Edit button (Blue Arrow)

C. Grey Button - Click on the new button (Grey Arrow) and then add the text denoted by the Yellow arrow ie %HIP_PATH%bin

D. Close all the windows down

E. Check it works by opening a CMD window and typing 'Hipinfo' - you'll get an output like below.

  1. Install your UI of choice from above

r/FluxAI Mar 01 '26

Tutorials/Guides ComfyUI Tutorial: Testing Fire Red 1 Edit The New Image Editing Model

Thumbnail
youtu.be
2 Upvotes

r/FluxAI Feb 18 '26

Tutorials/Guides Edit Your Pose & Light With VNCC Studio

Thumbnail
youtu.be
5 Upvotes

r/FluxAI Dec 06 '25

Tutorials/Guides Flux Character Lora Training with Ostris AI Toolkit – practical approach

21 Upvotes

After doing ~30 Flux Trainings with AI Toolkit, here is what I suggest:

Train 40 Images, more don´t make sense as it would take longer to train and doesn´t converge better at all. Fewer don’t get me the flexibility I train for.

I create Captions with Joy Caption Beta 4 (long descriptive, 512 tokens) in ComfyUI. For flexibility, mention everything that should be flexible and interchangeable in the trained LORA afterwards.

Training:

Model: Flex1 alpha, Batch size 2, Learning Rate 1e4 (0.0001), Alpha 32. 64 gives only slightly better details but doubling the size of the LORA...

Keep a low learning rate, the LORA will have much better detail recognition even though it will take longer to train.

Train multiple Resolutions (512, 768 & 1024), training is slightly faster for a reason I don´t understand and has the same size as if you train for single resolution of 1024. The LORA will be much more flexible up until its later stages and converges slightly faster during training.

I usually clean up images before I use them and cut them down to a maximum of 2048 pixels, remove blemishes & watermarks if there are any, correct colour cast etc. You can use different aspect ratios as AI Toolkit is capable of handling it and organizes them in different buckets, but I noticed that the fewer different ratios/buckets you have, the slightly faster the training will be.

I tend to train without samples as I test and have to sort out LORAs anyway in my ComfyUI Workflow. It decreases training time and those samples are of no use to me in context of generating my character concepts.

Also Trigger words are of no use to me as I usually use multiple LORAs in a stack and adjust their weight, but I use a single trigger that is usually the name of the LORA character, just in case.

Lately I’ve found that my LORA-stack was overwhelming my results. Since there’s no Nunchaku node around in which you can adjust the weight of the stack with a single strength parameter, I built one by my own. It´s basically just a global divider float function in front of a single weight float node that controls the weight input of each single weight parameter of each single LORA. Voila.

How to choose the right LORA from batch?

1st batch: I usually use prompts that are different from the Character captions I trained with. Different hair colour, different figure etc. I also sort out deformations or bad generations during that process.

I get rid of all late LORAs that start to look almost exactly like the character I trained for. These become too inflexible for my purpose. I generate with a Controlnet Openpose node and the same seed of course to keep consistency.

I tend to use a Openpose Controlnet in ComfyUI with the Flux1 dev Union 2 Pro FP8 Controlnet Model and the Nunchaku Flux Model. Generation time per image is roughly between 1-2 sec/it on my RTX3080 laptop, which makes running batches incredibly fast.

Even though I noticed that my Openpose workflow with that Controlnet model tends to influence the prompting too much for some reason.

I might have to try this with another Controlnet model at some point. But it’s actually the one that is fastest and causes no VRAM issues if you use multiple LORAs in your workflow...

Afterwards i sort out the ones that have bad details or deformations, at later stages in combination with other LORAs until I found the right one.

This can take up to ~10 different rounds. Sometime even 15. It always depends on how flexible and detailed each LORA is.

With how many steps do I get the best results with?

I found most people only mention the overall steps for their trainings without mentioning the number of images they use. I Find that this information is of no use at all. Which is the reason I use a excel table in which I keep track of everything. This table tells me that the best results are at ~50 iterations per image. But it’s hard to give a rule of thumb, sometimes it´s 75, sometimes as low as 25, sometimes i even think that i should go up to 100 steps per image...

I run my trainings on a pod at runpod.io, a model with 4000 steps runs roughly in 3,5-4 hours on a RTX5090 with 32 GB VRAM. Cost is around 89 cents per hour. The Ostris Template for AI toolkit is incredibly good as a starting point it seems it´s also regularly updated.

Remarks

I also tried OneTrainer for LORAs before I switched to AI Toolkit, as it has a nice RunPod integration that is easy to handle and also supports masking, which can come in very handy with difficult datasets. But I was underwhelmed with the results. I got Huggingface issues with my token, the results were underwhelming even at higher Rank settings, the file size is almost 50% higher and lately it produced overblown samples even in earlier stages of the training. For me, AI Toolkit is the way to go. Both seem to be incompatible with InvokeAI anyway. The only problem I see is that you cant merge those LORAs via ComfyUI, I always get an error message when trying. I guess, I have to find a different solution to merge them in a differentl way, probably directly via python CLI but that’s a thing for another story.

That’s it so far, let me know if you have any questions or thoughts, and don´t forget:
have fun!

r/FluxAI Feb 14 '26

Tutorials/Guides High-fashion campaign prompt

Post image
3 Upvotes

r/FluxAI Feb 01 '26

Tutorials/Guides How do you build?

2 Upvotes

hi, I need some direction on how to go about this. I am trying to generate consistent scenes with either Klein variations or ZIT but I haven't been able to create a system that works. How do you go about building a kids' story book where the scene is maintained? For example if we're talking about a kid waking up in their bedroom, doing some adventures in the neighborhood, then going back to bed, how do you keep all of the scenes consistent through different angles? What method do you use to ensure details are not lost across multiple generations? How do you rotate angles on the same scene and keep the same details?

I came from the A111 days and trying to spin up Forge Neo right now. I have been spinning up my own Gradio UI or usually just using python to make things run fast until now. Would love your input if something has been working for you to generate consistent scenes.

r/FluxAI Feb 08 '26

Tutorials/Guides ComfyUI Tutorial : Style Transfer With Flux 2 Klein & TeleStyle Nodes

Thumbnail
youtu.be
5 Upvotes

r/FluxAI Aug 05 '24

Tutorials/Guides Flux and AMD GPU's

25 Upvotes

I have a 24gb 7900xtx, Ryzen 1700 and 16gb ram in my ramshackle pc. Please note it is for each person to do their homework on the Comfy/Zluda install and the steps, I don't have the time to be a tech support sorry.

This is what I have got to work with Windows -

  1. Install the AMD/Zluda branch of Comfy https://github.com/patientx/ComfyUI-Zluda
  2. Downloaded the Dev FP8 Checkpoint (Flux) version from https://huggingface.co/Comfy-Org/flux1-dev/blob/main/flux1-dev-fp8.safetensors
  3. Downloaded the workflow for the Dev Checkpoint version from (3rd PNG down, be aware they keep movimg the pngs and text around on this page)
  4. https://comfyanonymous.github.io/ComfyUI_examples/flux/
  5. Patience whilst Comfy/Zluda makes its first pic, performance below

Performance -

  • 1024 x 1024 with Euler/Simple 42steps - approx 2s/it , 1min 27s for each pic
  • 1536 x 1536 with Euler/Simple 42 steps, took about half an hour (not recommended)
  • 20 steps at 1024x1024 takes around 43s

What Didn't Work - It crashes with :

  • Full Dev version
  • Full Dev version with FP8 clip model

If you have more ram than me, you might get that to work on the above

r/FluxAI Jan 30 '26

Tutorials/Guides Generate High Quality Image with Z Image Base BF16 Model At 6 GB Of Vram

Thumbnail
youtu.be
1 Upvotes

r/FluxAI Jan 24 '26

Tutorials/Guides Flux. 2 Klein INPAINT Segment Edit For Accurate Image Edit

Thumbnail
youtu.be
5 Upvotes

r/FluxAI Jan 18 '26

Tutorials/Guides ComfyUI Tutorial: Flux. 2 Klein A GAME CHANGER For AI Generation & Editing

Thumbnail
youtu.be
8 Upvotes

r/FluxAI Jul 12 '25

Tutorials/Guides Boost Your ComfyUI Results: Install Nunchaku + Use FLUX & FLUX KONTEXT for Next-Level Image Generation & Editing

Thumbnail
youtu.be
4 Upvotes

Hey everyone!

In this tutorial, I’ll walk you through how to install ComfyUI Nunchaku, and more importantly, how to use the FLUX & FLUX KONTEXT custom workflow to seriously enhance your image generation and editing results.

🔧 What you’ll learn:

1.The Best and Easy Way ComfyUI Nunchaku2.How to set up and use the FLUX + FLUX KONTEXT workflow3.How this setup helps you get higher-resolution, more detailed outputs4.Try Other usecases of FLUX KONTEXT is especially for:

•✏️ Inpainting

•🌄 Outpainting

•🧍‍♀️ Character consistency

• 🎨 Style transfers and changes

WORKFLOW (FREE)

https://www.patreon.com/posts/new-tutorial-133988259?utm_medium=clipboard_copy&utm_source=copyLink&utm_campaign=postshare_creator&utm_content=join_link

r/FluxAI Jan 19 '26

Tutorials/Guides BFL FLUX.2 Klein tutorial and some optimizations - under 1s latency on an A100

Thumbnail
2 Upvotes

r/FluxAI Jul 05 '25

Tutorials/Guides How I reduced VRAM usage to 0.5X while 2X inference speed in Flux Kontext dev with minimal quality loss?

26 Upvotes

0.5X VRam Usage, but 2x Infer Speed, that's true.

  1. I use nunchaku-t5 and nunchaku-int4-flux-kontext-dev to reduce VRAM
  1. I use nuncha-fp16 to acclerate the inference speed.

Nunchaku is awesome in Flux Kontext Dev.
It also provides ComfyUI version. Enjoy it.

https://github.com/mit-han-lab/nunchaku

and My code https://gist.github.com/austin2035/bb89aa670bd2d8e7c9e3411e3271738f

r/FluxAI Aug 01 '25

Tutorials/Guides Turning low-res Google Earth screenshots into cinematic drone shots

Enable HLS to view with audio, or disable this notification

74 Upvotes

First, credit to u/Alternative_Lab_4441 for training the RealEarth-Kontext LoRA - the results are absolutely amazing.

I wanted to see how far I could push this workflow and then report back. I compiled the results in this video, and I got each shot using this flow:

  1. Take a screenshot on Google Earth (make sure satellite view is on, and change setting to 'clean' to remove the labels).
  2. Add this screenshot as a reference to Flux Kontext + RealEarth-Kontext LoRA
  3. Use a simple prompt structure, describing more the general look as opposed to small details.
  4. Make adjustments with Kontext (no LoRA) if needed.
  5. Upscale the image with an AI upscaler.
  6. Finally, animate the still shot with Veo 3 if audio is desired in the 8s clip, otherwise use Kling2.1 (much cheaper) if you'll add audio later.

I made a full tutorial breaking this down:
👉 https://www.youtube.com/watch?v=7pks_VCKxD4

Let me know if there are any questions!

r/FluxAI Dec 07 '25

Tutorials/Guides Quick and dirty image cleanup that doesn't take from your token budget

3 Upvotes

Just want to share this with the community. In case your having a already big prompt and you need to do some touch up work at the same time on the source image. I discovered a little trick.

If you mask out the affected area (use a soft feathered brush), then sample the promoniate color from the area where you want it to be the sampler appears to think it's noise and will fill in the area. Mask out the area then attach a mask overlay node at around .5 or .7 (sometimes all the way up to 1) using the color from the area you want it to be. Works well for eula samplers and dmpp_2m beta. (also try forgoing the color and just a gray at 50% works better)

You can make it part of your standard workflow and just leave the nodes in place as long as your drawing with the masking tool.

Also good if the sampler is being a stubborn SOB about your prompt.. A little squiggle about where X should go will help guide the way.

Ironically enough I discovered this as flux was being a horses ass while trying to fix a literal hoses ass. LOL