Skip to content
Filters & more
Model: Flux.2 Klein 4B
Recommended system memory: 64 GB
20 min
Beginner
image-generationimage-editingthenoiseflux-2-klein
AMD GPU Driver Latest from Ryzen AI Developer Center
TheNoise 0.15.1
AMD GPU Driver 26.8.1 (from Ryzen AI Developer Center)
TheNoise 0.15.1
AMD GPU Driver Latest inbox driver
TheNoise 0.15.1
AMD GPU Driver Adrenalin 26.10.1
TheNoise 0.15.1
AMD GPU Driver Latest inbox driver
TheNoise 0.15.1
AMD GPU Driver Adrenalin 26.10.1
TheNoise 0.15.1
AMD GPU Driver Latest inbox driver
TheNoise 0.15.1
AMD GPU Driver Adrenalin 26.10.1
TheNoise 0.15.1
AMD GPU Driver RSL 26.14
TheNoise 0.15.1
AMD GPU Driver Adrenalin 26.10.1
TheNoise 0.15.1
AMD GPU Driver RSL 26.14
TheNoise 0.15.1
AMD GPU Driver Adrenalin 26.10.1
TheNoise 0.15.1
AMD GPU Driver RSL 26.14
TheNoise 0.15.1
AMD GPU Driver Adrenalin 26.10.1
TheNoise 0.15.1
Last validated: October 2026
Device Family
Processor
OS

Editing Images with TheNoise and Flux.2 Klein

Edit images with text instructions using TheNoise and the Flux.2 Klein 4B model on AMD ROCm™ software.

Editing Images with TheNoise and Flux.2 Klein

Overview

TheNoise is a focused, open-source image generation and editing engine built on AMD ROCm™ software. It is tuned to run fast on AMD GPUs — from the AMD Ryzen™ AI Halo Developer Platform to AMD Radeon™ discrete graphics.

This tutorial shows you how to edit images with TheNoise using the Flux.2 Klein 4B model — a distilled flow-matching model that generates in only 4 steps and can also edit an existing image from a text instruction. You will generate a picture, then instruct the model to change it, all on your GPU.

What You’ll Learn

  • How to install TheNoise and download the Flux.2 Klein 4B model
  • The difference between image generation and image editing in a diffusion model
  • How to edit an image from a text instruction with the edit command
  • How to use the Web UI to edit interactively

Setting the Memory Configuration

Install AMD Software: Adrenalin Edition

Download and install the latest AMD Software: Adrenalin Edition from amd.com/en/products/software/adrenalin.html.

Advanced: Increasing GPU memory (Optional)

You may need to increase the memory allocated to the GPU to run certain larger models or longer contexts. These devices use unified memory — the GPU shares system RAM — so this means letting the GPU claim more of that shared pool. Leave roughly 20% of system RAM for the operating system. This step is optional; the default allocation is enough for most workloads.

On Windows, adjust the memory in AMD Software: Adrenalin Edition: open it and navigate to Performance → Tuning → AMD Variable Graphics Memory. Set the value you need and reboot for the change to take effect.

AMD Software Adrenalin Edition — AMD Variable Graphics Memory panel

Backup method (BIOS). If your system does not show the Variable Graphics Memory option in Adrenalin (some OEM systems hide it), set the UMA Frame Buffer Size in the system BIOS/UEFI instead: reboot, enter setup (usually Del, F2, or Esc), find UMA Frame Buffer Size — also labeled Integrated Graphics or dedicated GPU memory, often under Advanced or AMD CBS → NBIO Common Options — set it to the size you need, save, and reboot. Menu names vary by vendor, and some BIOS do not expose it either.

On the AMD Ryzen™ AI Halo, adjust the shared memory in the pre-installed AMD Ryzen™ AI Developer Center: open it, go to the Settings tab, and under Graphics Performance Settings increase the Shared Video Memory slider. Click Apply Changes and reboot for the change to take effect.

AMD Ryzen AI Developer Center — Graphics Performance Settings with Shared Video Memory slider

On Linux, raise the shared GTT/TTM pool so the GPU can map more system memory. AMD recommends setting the minimum dedicated VRAM in the BIOS (0.5 GB) so the maximum is available as shared memory.

  1. Install the amd-debug-tools helper:

    Terminal window
    sudo apt install pipx
    pipx ensurepath
    pipx install amd-debug-tools
  2. Query the current shared-memory limit:

    Terminal window
    amd-ttm
  3. Raise it (value in GB — pick a size that leaves headroom for the OS):

    Terminal window
    amd-ttm --set <NUM>
  4. Reboot for the change to take effect.

Check for Software Updates

Before starting, ensure your Ryzen AI Halo has the latest software installed. Open the AMD Ryzen™ AI Developer Center and check for available updates, both to the app itself and additional software.

Go to the Updates tab. If updates are available, install them and reboot before continuing.

AMD Ryzen AI Developer Center — Updates tab on Windows

Go to the Manage tab. If updates are available, install them and reboot before continuing.

AMD Ryzen AI Developer Center — Manage tab on Linux

Installing Software Prerequisites

AMD GPU Driver

Update to the latest AMD GPU driver using AMD Software: Adrenalin Edition™.

  1. Open AMD Software: Adrenalin Edition from your Start menu or system tray.
  2. Navigate to Driver and Software, click Manage Updates.
  3. If an update is available, follow the prompts to download and install.

AMD GPU Driver

Install the AMD GPU Driver (amdgpu) using the Radeon Software for Linux (RSL) flow. For instructions for your distribution, see the ROCm installation at: Install the kernel driver.

For the driver itself, see Linux® Drivers for AMD Radeon™

Grant your user access to GPU devices (log out and back in for this to take effect):

Terminal window
sudo usermod -aG render,video $LOGNAME

AMD GPU Driver

Update to the latest AMD GPU driver using AMD Software: Adrenalin Edition™.

  1. Open AMD Software: Adrenalin Edition from your Start menu or system tray.
  2. Navigate to Driver and Software, click Manage Updates.
  3. If an update is available, follow the prompts to download and install.

AMD GPU Driver

Install the AMD GPU Driver (amdgpu) using the Radeon Software for Linux (RSL) flow. For instructions for your distribution, see the ROCm installation at: Install the kernel driver.

For the driver itself, see Linux® Drivers for AMD Radeon™

TheNoise uses uv to create a managed Python environment and installs its own ROCm build of PyTorch automatically. The only system prerequisites are uv itself and Git, which is needed for the clone below.

Installing TheNoise

Installing uv

uv is a fast Python package/environment manager. It provides a managed Python interpreter and installs dependencies.

Install uv with the official script:

Terminal window
curl -LsSf https://astral.sh/uv/install.sh | sh

uv installs into ~/.local/bin; make sure that directory is on your PATH.

Install uv with the official script:

Terminal window
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Windows leaves script execution disabled by default, hence the -ExecutionPolicy ByPass.

Open a new terminal so the updated PATH takes effect, or refresh it in the current session:

Terminal window
$env:Path = [System.Environment]::GetEnvironmentVariable('Path','User') + ';' + [System.Environment]::GetEnvironmentVariable('Path','Machine')

Clone TheNoise

TheNoise is developed on GitHub and bootstrapped with uv. uv provides a managed Python and installs every dependency; the launcher scripts create the virtual environment and install the ROCm build of PyTorch for your GPU automatically.

Terminal window
git clone https://github.com/lemonade-sdk/thenoise.git
cd thenoise
Terminal window
git clone https://github.com/lemonade-sdk/thenoise.git
cd thenoise

(Optional) Checkout a specific version

Terminal window
git checkout v0.15.1
Terminal window
git checkout v0.15.1

First run

Terminal window
export PATH="$HOME/.local/bin:$PATH" #hide
./thenoise.sh --help

The first run of ./thenoise.sh creates a .venv, installs the ROCm torch build for your GPU (auto-detected from /sys/class/kfd), and makes ./thenoise.sh ready to use. Expect this first run to take a few minutes.

Terminal window
.\thenoise.bat --help

The first run of thenoise.bat creates a .venv and installs the ROCm torch build for your GPU (detected automatically; set $env:GFX_ARCH to override). Expect this first run to take a few minutes.

From here on, use the launcher in the clone root — ./thenoise.sh on Linux, thenoise.bat on Windows — for every generate, edit, and serve command. All commands in this playbook assume you are in the thenoise clone directory.

Downloading the Flux.2 Klein 4B Model

Flux.2 Klein is a distilled flow-matching MMDiT in two sizes (4B and 9B). The 4B is the speed pick and the default for this playbook. It can edit: give it one or more reference images plus an instruction and it returns the edited image.

The project ships a model download helper. Fetch the 4B checkpoints (DiT, text encoder, and the shared Flux.2 VAE all land in ./models/klein/):

Terminal window
.venv/bin/python scripts/download.py --model klein
Terminal window
& .\.venv\Scripts\python.exe scripts/download.py --model klein

The three files are the model itself and everything it depends on:

File Role
flux-2-klein-4b.safetensors The DiT — the core flow-matching network that denoises latents into an image
qwen_3_4b.safetensors The text encoder — turns your prompt into embeddings
flux2-vae.safetensors The VAE — encodes images to/from latent space

Understanding Image Editing

A diffusion model creates an image by starting from pure random noise and, guided by a text description, gradually removing that noise step by step until a clear picture remains. It works on a compact internal representation called latent space, and refines it over a few denoising steps.

Generation starts from that pure noise and produces a brand-new image from your text. Editing runs the same loop — TheNoise first encodes your photo into latent space into reference tokens, concatenated with the prompt embeddings into the sequence the DiT attends over, thus influencing the normal denoising process and producing the edited image.

Flux.2 Klein is trained to accept one or more reference images alongside the text instruction. When you run edit, TheNoise passes those images to the model automatically — you provide a photo and an instruction, and the model does the rest.

The Pieces

Component What it does
Text Encoder (Qwen3-4B) Converts your text instruction into a set of numbers (embeddings) the model can use
Diffusion Model (Flux.2 Klein 4B) The core network that repeatedly denoises the latent representation to produce the image
VAE Encodes the input image into latent space and decodes the final latents back into pixels
Reference images The photo(s) the edit is conditioned on; the first one sets the output size

Editing Your First Image

Let’s start with a clean image to edit. First generate one, then instruct the model to change it. This is the fun part: you’ll watch the same picture change based on a couple of sentences.

Terminal window
export PATH="$HOME/.local/bin:$PATH" #hide
./thenoise.sh generate \
--dit ./models/klein/split_files/diffusion_models/flux-2-klein-4b.safetensors \
--vae ./models/klein/split_files/vae/flux2-vae.safetensors \
--text-encoder ./models/klein/split_files/text_encoders/qwen_3_4b.safetensors \
--prompt "An expansive urban landscape at dusk, polished panoramic view. A sea of trees in the foreground leading to a dense skyscraper skyline. Silhouette of a vibrant evening city against a fiery sunset sky. Colors: burnt orange, dusty rose, deep violet, and charcoal gray. Moody, cinematic lighting, heavy atmospheric haze, photorealistic but dreamy. Inspired by wide-angle architectural photography." \
--width 960 --height 540 \
--out city.png
Terminal window
& .\thenoise.bat generate `
--dit .\models\klein\split_files\diffusion_models\flux-2-klein-4b.safetensors `
--vae .\models\klein\split_files\vae\flux2-vae.safetensors `
--text-encoder .\models\klein\split_files\text_encoders\qwen_3_4b.safetensors `
--prompt "An expansive urban landscape at dusk, polished panoramic view. A sea of trees in the foreground leading to a dense skyscraper skyline. Silhouette of a vibrant evening city against a fiery sunset sky. Colors: burnt orange, dusty rose, deep violet, and charcoal gray. Moody, cinematic lighting, heavy atmospheric haze, photorealistic but dreamy. Inspired by wide-angle architectural photography." `
--width 960 --height 540 `
--out city.png

Now edit that image. Compared to generation, you switch the command from generate to edit, add --image with the photo to change, and write the prompt as the instruction for the change you want:

Terminal window
export PATH="$HOME/.local/bin:$PATH" #hide
./thenoise.sh edit \
--dit ./models/klein/split_files/diffusion_models/flux-2-klein-4b.safetensors \
--vae ./models/klein/split_files/vae/flux2-vae.safetensors \
--text-encoder ./models/klein/split_files/text_encoders/qwen_3_4b.safetensors \
--image city.png \
--prompt "Set the scene to early evening. Light up the city's windows. Increase the contrast. Add the text 'AMD ROCm' in a monospaced font in the bottom-left corner." \
--out city_edited.png
Terminal window
& .\thenoise.bat edit `
--dit .\models\klein\split_files\diffusion_models\flux-2-klein-4b.safetensors `
--vae .\models\klein\split_files\vae\flux2-vae.safetensors `
--text-encoder .\models\klein\split_files\text_encoders\qwen_3_4b.safetensors `
--image city.png `
--prompt "Set the scene to early evening. Light up the city's windows. Increase the contrast. Add the text 'AMD ROCm' in a monospaced font in the bottom-left corner." `
--out city_edited.png

Open city_edited.png and compare it with city.png. The city is still the same, but the mood has changed: it’s now early evening, the lights are on, and there’s a short phrase written in a monospaced font in the bottom-left corner. The model changed only what your instruction asked for.

city_edited.png is also larger than city.png. With --width/--height omitted, edit takes the output size from the first reference image — about a megapixel in its aspect ratio, rounded onto the model’s size grid. Pass the two flags to choose the size yourself.

Editing in the Web UI

The CLI is great for reproducible, scripted edits, but TheNoise also has a simple Web UI for quicker iteration. Start the server with the same three checkpoints:

Terminal window
./thenoise.sh serve \
--dit ./models/klein/split_files/diffusion_models/flux-2-klein-4b.safetensors \
--vae ./models/klein/split_files/vae/flux2-vae.safetensors \
--text-encoder ./models/klein/split_files/text_encoders/qwen_3_4b.safetensors \
--host 127.0.0.1 --port 8000
Terminal window
& .\thenoise.bat serve `
--dit .\models\klein\split_files\diffusion_models\flux-2-klein-4b.safetensors `
--vae .\models\klein\split_files\vae\flux2-vae.safetensors `
--text-encoder .\models\klein\split_files\text_encoders\qwen_3_4b.safetensors `
--host 127.0.0.1 --port 8000

The server loads the model when it starts and then keeps it in memory, so this terminal stays busy until you press Ctrl+C. Wait for Uvicorn running on http://127.0.0.1:8000, then leave it running — the Web UI and the HTTP API both talk to it.

Open http://localhost:8000/. Because Flux.2 Klein supports editing, the interface shows an Edit tab alongside Generate.

TheNoise web UI Generate tab with Flux.2 Klein 4B loaded

  1. Click the Edit tab.
  2. Load your city.png (or any image) as the reference image.
  3. Type an instruction, for example: Set the scene to early evening. Light up the city's windows. Increase the contrast. Add the text 'AMD ROCm' in a monospaced font in the bottom-left corner..
  4. Click the Edit button and watch the image change.

TheNoise web UI Edit tab with an image and an instruction

Using Multiple Reference Images

You can use multiple images when editing. The first image sets the output size; the rest are used as additional references. Below is an example of how you tell a model to blend two subjects.

Prompt: Take the cityscape from image 2 and place it in the foreground of image 1. Preserve the mood and colors of image 2.

Image 1:

City

Image 2: City 2

Combining the two images with that prompt gives this result:

Multi-image editing

Adjusting Generation/Editing Parameters

Parameter What It Controls
Steps Number of denoising iterations. Increasing this produces cleaner images. Distilled models are trained for a specific step count, but allowing 1 or 2 extra steps can help in some situations.
Guidance Scale How closely to follow the instruction. A value ≤ 1.0 disables CFG, cutting generation time. Distilled models need guidance to be disabled or will produce “overcooked” images.
Sampler Can change the overall look of the image. Euler is the simplest and most universal option.
Seed Affects the noise latent initialization. Changing this will produce a different image even if all other parameters are equal.

Calling TheNoise from Other Software

The serve mode answers a small JSON API on the same address, so another program can drive the same edit. /edit takes a base64-encoded copy of the image in the request body and answers with the edited PNG — see the HTTP API reference for every field and endpoint.

Keep the server running, save this as edit_api.py in the thenoise folder — it is also included with this playbook as — and run it from a second terminal. It reads the port from THENOISE_PORT, 8000 by default.

import base64
import json
import os
import urllib.request
PORT = os.environ.get("THENOISE_PORT", "8000")
PROMPT = ("Set the scene to early evening. Light up the city's windows. Increase the "
"contrast. Add the text 'AMD ROCm' in a monospaced font in the bottom-left corner.")
with open("city.png", "rb") as f:
image = base64.b64encode(f.read()).decode()
body = json.dumps({"image": image, "prompt": PROMPT, "steps": 4}).encode()
request = urllib.request.Request(
f"http://127.0.0.1:{PORT}/edit",
data=body,
headers={"Content-Type": "application/json"},
)
with urllib.request.urlopen(request) as response:
with open("city_edited_api.png", "wb") as f:
f.write(response.read())
print("Saved city_edited_api.png")
Terminal window
.venv/bin/python edit_api.py
Terminal window
& .\.venv\Scripts\python.exe edit_api.py

The edited image lands in city_edited_api.png, next to the city_edited.png you wrote with the edit command.

Next Steps

  • Try other models: TheNoise also runs Qwen-Image-Edit, Mage-Flow, and the 9B Flux.2 Klein — the 9B is the quality pick if you have the memory.
  • Upscale your results: Use the built-in 2× latent refiner or a Real-ESRGAN pixel upscaler for up to 8× output.
  • Add LoRAs: Apply style or subject adapters with --lora-dir and per-image --lora file:weight flags.
  • Post-process: Add film grain (--film-grain) and RCAS sharpening (--sharpening) to finish your edit.
  • Automate it: Wire the HTTP API into a pipeline, or serve TheNoise through Lemonade, which ships TheNoise as a backend.

For more, see the TheNoise documentation — the CLI reference, the HTTP API reference, and per-model pages cover every flag and endpoint.

Need help with this playbook?

Run into an issue or have a question? Open a GitHub issue and our team will take a look.